BerriAI/litellm · error · ValueError

request is required for completion bridge

Error message

request is required for completion bridge

What it means

asend_message routes through LiteLLM's completion bridge whenever litellm_params contains custom_llm_provider (e.g. 'langgraph' or 'bedrock/agentcore'). The bridge extracts its parameters from the raw A2A SendMessageRequest, so request=None together with custom_llm_provider set fails fast with this ValueError before any network call.

Solutions

  1. Pass request=SendMessageRequest(id=..., params=MessageSendParams(message=...)) alongside custom_llm_provider
  2. If you meant the standard A2A flow instead, remove custom_llm_provider from litellm_params and pass request plus api_base or a2a_client

Example fix

# before
await asend_message(litellm_params={'custom_llm_provider': 'langgraph'})

# after
from uuid import uuid4
from a2a.types import SendMessageRequest, MessageSendParams
req = SendMessageRequest(
    id=str(uuid4()),
    params=MessageSendParams(message={'role': 'user', 'parts': [{'kind': 'text', 'text': 'Hi'}], 'messageId': uuid4().hex}),
)
await asend_message(request=req, api_base='http://localhost:2024', litellm_params={'custom_llm_provider': 'langgraph', 'model': 'agent'})
Defensive patterns

Strategy: validation

Validate before calling

def validate_bridge_call(litellm_params: dict, request) -> None:
    if litellm_params.get('custom_llm_provider') and request is None:
        raise ValueError(
            'asend_message with custom_llm_provider requires a SendMessageRequest'
        )


validate_bridge_call(litellm_params, request)

Try / catch

try:
    resp = await asend_message(litellm_params=litellm_params, request=request)
except ValueError as e:
    if 'completion bridge' in str(e):
        raise ValueError(f'Build a SendMessageRequest before calling: {e}') from e
    raise

Prevention

When it happens

Trigger: Calling asend_message(litellm_params={'custom_llm_provider': 'langgraph', ...}) without passing request; completion-style invocations routed to A2A where the caller passed only messages-like kwargs.

Common situations: Wiring a completion-bridge provider in proxy config while invoking the a2a function directly without a request object; refactors that dropped the request parameter.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at litellm/a2a_protocol/main.py:448

                message={"role": "user", "parts": [{"kind": "text", "text": "Hello!"}], "messageId": uuid4().hex}
            )
        )
        response = await asend_message(
            request=request,
            api_base="http://localhost:2024",
            litellm_params={"custom_llm_provider": "langgraph", "model": "agent"},
        )
        ```
    """
    litellm_params = litellm_params or {}
    logging_obj: Final = kwargs.get("litellm_logging_obj")
    trace_id = getattr(logging_obj, "litellm_trace_id", None) if logging_obj else None
    custom_llm_provider: Final = litellm_params.get("custom_llm_provider")

    # Route through completion bridge if custom_llm_provider is set
    if custom_llm_provider:
        if request is None:
            raise ValueError("request is required for completion bridge")
        return await _send_message_via_completion_bridge(
            request=request,
            custom_llm_provider=custom_llm_provider,
            api_base=api_base,
            litellm_params=litellm_params,
            agent_extra_headers=agent_extra_headers,
        )

    # Standard A2A client flow
    if request is None:
        raise ValueError("request is required")

    # Create A2A client if not provided but api_base is available
    if a2a_client is None:
        if api_base is None:
            raise ValueError("Either a2a_client or api_base is required for standard A2A flow")
        trace_id = trace_id or str(uuid.uuid4())
        extra_headers: Final[dict[str, str]] = {"X-LiteLLM-Trace-Id": trace_id}

View on GitHub (pinned to 77b7c6c40c)