pub const AGENT_EVENT_CHANNEL_CAPACITY: usize = 8_192;Expand description
[tokio::sync::mpsc] channel capacity for streaming AgentEvents
produced by a single crate::ports::AgentLoopPort::run call.
Sized so that a full run at the maximum ceiling configuration
(MAX_ITERATIONS_CEILING × (MAX_PARALLEL_TOOLS_CEILING × 2 + 1) + 1
structural events ≈ 5 051 with MAX_ITERATIONS_CEILING = 50 and
MAX_PARALLEL_TOOLS_CEILING = 50) fits without back-pressure on the hot
streaming path. Any value ≥ 5 051 satisfies the structural ceiling test;
8 192 leaves comfortable headroom for TextDelta bursts.
Filling the channel causes tx.send().await to back-pressure on every
token, with measurable latency impact, so the constant is set well above
the hard floor.
8 192 fits comfortably in under a megabyte of memory per active agent session.
All callers (SSE handlers, CLI REPL) should use this constant instead of a magic literal.