BerriAI/litellm · error · RuntimeError

A2A send_message failed: non-streaming message/send expects

Error message

A2A send_message failed: non-streaming message/send expects the agent's final event to be a Message or Task result.

What it means

Error "A2A send_message failed: non-streaming message/send expects the agent's final event to be a Message or Task result." thrown in BerriAI/litellm.

Source

Thrown at litellm/a2a_protocol/main.py:262

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",
    request: "SendMessageRequest",
    agent_card: Optional["AgentCard"],
    card_url: str | None,
    api_base: str | None,
    agent_name: str | None,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Ensure the agent returns a final Message or Task result for message/send; check the agent implementation.

When it happens

Trigger: Thrown at litellm/a2a_protocol/main.py:262 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/a26fbe94396ea27f. Report an issue: GitHub.