{"record":{"id":"d89fc413885934bc","repo":"BerriAI/litellm","slug":"request-is-required-for-completion-bridge","errorCode":null,"errorMessage":"request is required for completion bridge","messagePattern":"request is required for completion bridge","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/main.py","lineNumber":448,"sourceCode":"                message={\"role\": \"user\", \"parts\": [{\"kind\": \"text\", \"text\": \"Hello!\"}], \"messageId\": uuid4().hex}\n            )\n        )\n        response = await asend_message(\n            request=request,\n            api_base=\"http://localhost:2024\",\n            litellm_params={\"custom_llm_provider\": \"langgraph\", \"model\": \"agent\"},\n        )\n        ```\n    \"\"\"\n    litellm_params = litellm_params or {}\n    logging_obj: Final = kwargs.get(\"litellm_logging_obj\")\n    trace_id = getattr(logging_obj, \"litellm_trace_id\", None) if logging_obj else None\n    custom_llm_provider: Final = litellm_params.get(\"custom_llm_provider\")\n\n    # Route through completion bridge if custom_llm_provider is set\n    if custom_llm_provider:\n        if request is None:\n            raise ValueError(\"request is required for completion bridge\")\n        return await _send_message_via_completion_bridge(\n            request=request,\n            custom_llm_provider=custom_llm_provider,\n            api_base=api_base,\n            litellm_params=litellm_params,\n            agent_extra_headers=agent_extra_headers,\n        )\n\n    # Standard A2A client flow\n    if request is None:\n        raise ValueError(\"request is required\")\n\n    # Create A2A client if not provided but api_base is available\n    if a2a_client is None:\n        if api_base is None:\n            raise ValueError(\"Either a2a_client or api_base is required for standard A2A flow\")\n        trace_id = trace_id or str(uuid.uuid4())\n        extra_headers: Final[dict[str, str]] = {\"X-LiteLLM-Trace-Id\": trace_id}","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/a2a_protocol/main.py#L430-L466","documentation":"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.","triggerScenarios":"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.","commonSituations":"Wiring a completion-bridge provider in proxy config while invoking the a2a function directly without a request object; refactors that dropped the request parameter.","solutions":["Pass request=SendMessageRequest(id=..., params=MessageSendParams(message=...)) alongside custom_llm_provider","If you meant the standard A2A flow instead, remove custom_llm_provider from litellm_params and pass request plus api_base or a2a_client"],"exampleFix":"# before\nawait asend_message(litellm_params={'custom_llm_provider': 'langgraph'})\n\n# after\nfrom uuid import uuid4\nfrom a2a.types import SendMessageRequest, MessageSendParams\nreq = SendMessageRequest(\n    id=str(uuid4()),\n    params=MessageSendParams(message={'role': 'user', 'parts': [{'kind': 'text', 'text': 'Hi'}], 'messageId': uuid4().hex}),\n)\nawait asend_message(request=req, api_base='http://localhost:2024', litellm_params={'custom_llm_provider': 'langgraph', 'model': 'agent'})","handlingStrategy":"validation","validationCode":"def validate_bridge_call(litellm_params: dict, request) -> None:\n    if litellm_params.get('custom_llm_provider') and request is None:\n        raise ValueError(\n            'asend_message with custom_llm_provider requires a SendMessageRequest'\n        )\n\n\nvalidate_bridge_call(litellm_params, request)","typeGuard":null,"tryCatchPattern":"try:\n    resp = await asend_message(litellm_params=litellm_params, request=request)\nexcept ValueError as e:\n    if 'completion bridge' in str(e):\n        raise ValueError(f'Build a SendMessageRequest before calling: {e}') from e\n    raise","preventionTips":["Centralize request construction in one helper so no call site can forget it","Treat custom_llm_provider in litellm_params as a contract: bridge implies request","Add a thin wrapper around asend_message that asserts required args per branch"],"tags":["a2a","validation","parameter","completion-bridge"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}