Hey, I encountered the following issue while using the sdk:
spawn_stdio_transport was crashing with this error:
asyncio.exceptions.LimitOverrunError: Separator is found, but chunk is longer than limit
After digging into it, I figured out what's happening. The SDK uses newline-delimited JSON-RPC over asyncio streams, and asyncio has a default 64KB buffer limit for line-based operations. When messages get larger than that, everything explodes.
The issue is that:
- The ACP SDK creates
asyncio.StreamReader without specifying a limit parameter
- This means it defaults to 64KB
- There's no way to configure this in the SDK - it's just hardcoded to use the default
What I ended up doing is that I implemented my own version of spawn_stdio_transport and set the limit explicitly when creating the subprocess:
process = await asyncio.create_subprocess_exec(
...,
limit=10 * 1024 * 1024 # 10MB buffer limit
)
This works fine for my use case.
If you're asking me, you should expose limit as a parameter in both:
spawn_stdio_transport() - for subprocess-based agents
stdio_streams() - for agents reading their own stdio
Hey, I encountered the following issue while using the sdk:
spawn_stdio_transport was crashing with this error:
After digging into it, I figured out what's happening. The SDK uses newline-delimited JSON-RPC over asyncio streams, and asyncio has a default 64KB buffer limit for line-based operations. When messages get larger than that, everything explodes.
The issue is that:
asyncio.StreamReaderwithout specifying alimitparameterWhat I ended up doing is that I implemented my own version of
spawn_stdio_transportand set the limit explicitly when creating the subprocess:This works fine for my use case.
If you're asking me, you should expose
limitas a parameter in both:spawn_stdio_transport()- for subprocess-based agentsstdio_streams()- for agents reading their own stdio