Claude Agent SDK: 80+ second startup time on Windows

Resolved 💬 6 comments Opened Jan 1, 2026 by sarukas Closed Feb 23, 2026

Environment

  • claude-agent-sdk version: 0.1.18
  • Python: 3.11.13
  • Platform: Windows 10/11 (win32)
  • Claude CLI: Bundled with SDK

Problem

The Claude Agent SDK takes ~80 seconds to produce the first message when using the query() function. This makes the SDK nearly unusable for interactive applications.

Reproduction

Minimal test script:

import asyncio
import time
from claude_agent_sdk import query, ClaudeAgentOptions

async def test():
    options = ClaudeAgentOptions(
        mcp_servers={},
        allowed_tools=["Read"],
        cwd=".",
        model="claude-sonnet-4-5-20250929",
        permission_mode="bypassPermissions",
        max_turns=1,
    )
    
    t0 = time.perf_counter()
    async for message in query(prompt="Say 'Hello'", options=options):
        t1 = time.perf_counter()
        print(f"First message at {t1 - t0:.1f}s: {type(message).__name__}")
        break

asyncio.run(test())

Actual Results

======================================================================
  SDK INITIALIZATION TIMING REPORT
  Generated: 2026-01-01T23:06:17.242568
======================================================================

  ENVIRONMENT:
    - claude-agent-sdk: 0.1.18
    - Python: 3.11.13
    - Platform: win32

======================================================================
  TEST 1: query() function (non-interactive)
======================================================================
[0.000s] Starting query()...
[79.511s] First message received: SystemMessage
[83.164s] Message #2: AssistantMessage
          Text: Hello World - SDK test successful!...
[83.215s] Message #3: ResultMessage

  RESPONSE: Hello World - SDK test successful!
  RESULT: Total=84.699s, FirstMsg=79.511s, MsgCount=3

79.5 seconds to first message for a simple "say hello" query.

Expected Results

First message should arrive within 5-10 seconds maximum.

Additional Context

  • This is a clean test without any MCP servers or complex tool configurations
  • The delay appears to be in CLI subprocess startup, not API latency
  • Using ClaudeSDKClient directly shows __aenter__() completes in ~11 seconds, but the scope handling has issues
  • We are building a production application on top of the SDK and this startup time makes it unusable

Questions

  1. Is this expected behavior on Windows?
  2. Are there any configuration options to reduce startup time?
  3. Is there a way to keep a "warm" CLI subprocess that can be reused across queries?

Thank you!

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗