BerriAI/litellm · error · ImportError

The 'a2a' package is required for A2A agent invocation. Inst

Error message

The 'a2a' package is required for A2A agent invocation. Install it with: pip install a2a-sdk

What it means

Error "The 'a2a' package is required for A2A agent invocation. Install it with: pip install a2a-sdk" thrown in BerriAI/litellm.

Source

Thrown at litellm/a2a_protocol/main.py:248

def _to_core_send_message_request(request: "SendMessageRequest") -> "CoreSendMessageRequest":
    from a2a.compat.v0_3 import conversions

    return conversions.to_core_send_message_request(request)


def _to_compat_stream_response(
    event: "CoreStreamResponse", request_id: str | int
) -> "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(

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Install the a2a package: pip install a2a-sdk.

When it happens

Trigger: Thrown at litellm/a2a_protocol/main.py:248 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/d80ea484c5813631. Report an issue: GitHub.