Skip to main content

DEFAULT_STREAM_IDLE_TIMEOUT

Constant DEFAULT_STREAM_IDLE_TIMEOUT 

Source
pub const DEFAULT_STREAM_IDLE_TIMEOUT: Duration;
Expand description

Default for ClientConfig::stream_idle_timeout: 5 minutes.

The bound exists because a stream whose server stops sending — a hung agent, a half-open connection behind a proxy — otherwise holds its consumer forever. The value is chosen against what a healthy peer does:

  • This repository’s server writes an SSE : keep-alive comment after 30 seconds without an event (DispatchConfig::sse_keep_alive_interval), so a healthy stream from it is never quiet for 5 minutes; the bound sits ten heartbeats out, and a server whose interval was raised to a few minutes still clears it.
  • a2a-go v2.5.0 sends keep-alives only when the server opts in (a2asrv.WithTransportKeepAlive; “If interval is 0 or negative, keep-alive is disabled (default behavior)”), so a Go agent is silent between events. Its own client gives a whole request, stream included, 3 minutes by default (a2aclient/transport.go: defaultRequestTimeout = 3 * time.Minute), so a Go agent that is silent for longer than this is already outside what its own SDK’s defaults tolerate.
  • Common reverse proxies and load balancers close a connection that is silent for about 60 seconds (nginx proxy_read_timeout, AWS ALB idle_timeout), so a stream that survives 5 silent minutes is one that crossed no such hop.

Expiry is recoverable — the task keeps running and A2aClient::subscribe_to_task picks it up — so the cost of a too-short bound is one resubscribe, while the cost of no bound is a consumer that never returns.