BerriAI/litellm · error · RuntimeError
A2A send_message_streaming failed: no response received…
Error message
A2A send_message_streaming failed: no response received after retry attempts.
What it means
_execute_a2a_stream_with_retry iterates the streaming send (retrying once after a localhost-card rewrite) and tracks a stream_succeeded flag set only when at least one chunk was yielded. If the loop ends with the flag still false — no chunk was ever produced across attempts — this RuntimeError is raised. It is the streaming aggregate 'attempted but never got a chunk' error.
Solutions
- Verify agent reachability: curl <api_base>/.well-known/agent-card.json
- Check logs for the localhost-retry warning and fix the agent's advertised URL if present
- Test a direct streaming call against the agent to see whether it yields any chunks at all
- Add caller-side retry with backoff around asend_message_streaming for transient failures
Defensive patterns
Strategy: retry
Validate before calling
import httpx
async with httpx.AsyncClient(timeout=5) as hc:
r = await hc.get(f'{api_base.rstrip("/")}/.well-known/agent-card.json')
if not r.is_success:
raise RuntimeError(f'Streaming target not reachable: {api_base} ({r.status_code})') Try / catch
for attempt in range(3):
try:
async for chunk in asend_message_streaming(api_base=api_base, request=req):
handle(chunk)
break
except RuntimeError as e:
if 'after retry attempts' not in str(e):
raise
await asyncio.sleep(2 ** attempt)
else:
raise RuntimeError(f'A2A streaming never produced a chunk from {api_base}') Prevention
- Probe the agent's card endpoint before opening streams
- Set sane read/idle timeouts on proxies in front of agents so streams are not silently cut
- Monitor first-chunk latency; zero chunks ever is the signature of this failure
When it happens
Trigger: api_base unreachable so the iterator raises before the first chunk; the localhost-card rewrite happened but the retried stream still produced nothing; agent closing streams before emitting any event.
Common situations: Stopped/misaddressed agent containers; wrong port in api_base; proxies killing streams on connect; agent crashing on the first JSON-RPC message.
Related errors
- A2A send_message failed: no response received after retry…
- Cannot retry A2A localhost URL fix: no agent card is…
- Cannot retry A2A localhost URL fix: the client was not…
- A2A SDK is required for localhost retry handling. Install…
- A2A send_message failed: no response received from agent.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8475320a69731d5b.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/a2a_protocol/main.py:375
card_url = get_agent_card_url(agent_card) if agent_card else None
continue
except Exception as e:
if response_started:
raise
try:
map_a2a_exception(e, card_url, api_base, model=agent_name)
except A2ALocalhostURLError as localhost_err:
a2a_client = await handle_a2a_localhost_retry(
error=localhost_err,
agent_card=agent_card,
a2a_client=a2a_client,
is_streaming=True,
)
card_url = get_agent_card_url(agent_card) if agent_card else None
continue
raise
if not stream_succeeded:
raise RuntimeError("A2A send_message_streaming failed: no response received after retry attempts.")
@client
async def asend_message(
a2a_client: Optional["A2AClientType"] = None,
request: Optional["SendMessageRequest"] = None,
api_base: str | None = None,
litellm_params: dict[str, object] | None = None,
agent_id: str | None = None,
agent_extra_headers: dict[str, str] | None = None,
**kwargs: object,
) -> LiteLLMSendMessageResponse:
"""
Async: Send a message to an A2A agent.
Uses the @client decorator for LiteLLM logging and tracking.
If litellm_params contains custom_llm_provider, routes through the completion bridge.
View on GitHub (pinned to 77b7c6c40c)