Claude Agent SDK: 80+ second startup time on Windows
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 6 comments · opened Jan 1, 2026 · 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
ClaudeSDKClientdirectly 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
- Is this expected behavior on Windows?
- Are there any configuration options to reduce startup time?
- Is there a way to keep a "warm" CLI subprocess that can be reused across queries?
Thank you!
6 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The other issue is similar, but on MacOS and quite old. Mine is new and shuold be reproducible on windows. This does not occur in Claude Code, just via SDK.
Update: Found SDK timeout configuration
After further investigation, I found the root cause of why pre-initialization doesn't help:
The SDK has an internal 60-second default timeout that fires before our wrapper timeout:
Since Windows SDK initialization takes ~80+ seconds, the default 60s timeout causes
Control request timeout: initializeerrors.Workaround
Set the environment variable before SDK initialization:
Request
Could the SDK either:
The current 60s default makes the SDK essentially unusable on Windows without this workaround.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has dissapeared somewhere along way with the SDK version updates. This can now be closed. Thanks!
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.