BerriAI/litellm · error · RuntimeError

A2A send_message failed: no response received from agent.

Error message

A2A send_message failed: no response received from agent.

What it means

_send_message iterates the a2a-sdk event stream for a non-streaming message/send and keeps the last event. If the agent completes the exchange without yielding a single protocol event (empty/aborted JSON-RPC response, or the connection dropping before any event arrives), last_event stays None and this RuntimeError is raised. It means the transport technically succeeded but zero events were produced.

Solutions

  1. Check the target agent's logs/health — it accepted the request but emitted nothing
  2. Reproduce outside litellm with a direct a2a-sdk or curl JSON-RPC message/send to isolate agent vs client
  3. Retry the call once; genuinely transient stream drops surface as this error
  4. If a proxy fronts the agent, disable response buffering and raise idle/stream timeouts
Defensive patterns

Strategy: retry

Validate before calling

# Pre-flight: confirm the agent answers a cheap JSON-RPC call before
# relying on message/send.
import httpx
async with httpx.AsyncClient() as hc:
    r = await hc.get(f'{api_base.rstrip("/")}/.well-known/agent-card.json')
    r.raise_for_status()  # agent down/unreachable surfaces here, with a clear error

Try / catch

for attempt in range(3):
    try:
        resp = await asend_message(a2a_client=client, request=req)
        break
    except RuntimeError as e:
        if 'no response received from agent' not in str(e):
            raise
        if attempt == 2:
            raise  # agent consistently emits nothing — its bug, escalate
        await asyncio.backoff_sleep(attempt)  # transient empty stream

Prevention

When it happens

Trigger: Agent accepts the request (HTTP 200) but returns an empty or immediately-closed stream; an intermediary proxy or sidecar cuts the response body; the agent crashes after sending headers.

Common situations: Half-deployed or crashing agents; reverse proxies buffering or truncating SSE/JSON-RPC streams; agents returning 200 with empty body on internal errors.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/91dfdfd1edf34284. Report an issue: GitHub.

Appendix: source

Thrown at litellm/a2a_protocol/main.py:257

) -> "SendStreamingMessageSuccessResponse":
    from a2a.compat.v0_3 import conversions

    return conversions.to_compat_stream_response(event, request_id=request_id)


async def _send_message(a2a_client: "A2AClientType", request: "SendMessageRequest") -> "SendMessageResponse":
    """Send a non-streaming message via a2a-sdk 1.x and return JSON-RPC response."""
    if _a2a_conversions is None:
        raise ImportError(
            "The 'a2a' package is required for A2A agent invocation. Install it with: pip install a2a-sdk"
        )

    pb_request: Final = _to_core_send_message_request(request)
    last_event = None
    async for event in a2a_client.send_message(pb_request, context=_get_a2a_call_context(a2a_client)):
        last_event = event
    if last_event is None:
        raise RuntimeError("A2A send_message failed: no response received from agent.")

    stream_compat: Final = _to_compat_stream_response(last_event, request_id=request.id)
    result: Final = stream_compat.result
    if not isinstance(result, (Message, Task)):
        raise RuntimeError(
            "A2A send_message failed: non-streaming message/send expects the "
            "agent's final event to be a Message or Task result."
        )
    return SendMessageResponse(
        root=SendMessageSuccessResponse(
            id=request.id,
            result=result,
        )
    )


async def _execute_a2a_send_with_retry(
    a2a_client: "A2AClientType",

View on GitHub (pinned to 77b7c6c40c)