{"record":{"id":"25232ca07514169e","repo":"BerriAI/litellm","slug":"api-base-is-required-for-pydanticaiproviderconfig","errorCode":null,"errorMessage":"api_base is required for PydanticAIProviderConfig","messagePattern":"api_base is required for PydanticAIProviderConfig","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/providers/pydantic_ai_agents/config.py","lineNumber":29,"sourceCode":"\nclass PydanticAIProviderConfig(BaseA2AProviderConfig):\n    \"\"\"\n    Provider configuration for Pydantic AI agents.\n\n    Pydantic AI agents follow A2A protocol but don't support streaming natively.\n    This config provides fake streaming by converting non-streaming responses into streaming chunks.\n    \"\"\"\n\n    async def handle_non_streaming(\n        self,\n        request_id: str,\n        params: dict[str, Any],\n        api_base: str | None = None,\n        **kwargs: Any,\n    ) -> dict[str, Any]:\n        \"\"\"Handle non-streaming request to Pydantic AI agent.\"\"\"\n        if api_base is None:\n            raise ValueError(\"api_base is required for PydanticAIProviderConfig\")\n        return await PydanticAIHandler.handle_non_streaming(\n            request_id=request_id,\n            params=params,\n            api_base=api_base,\n            timeout=kwargs.get(\"timeout\", 60.0),\n            agent_extra_headers=kwargs.get(\"agent_extra_headers\"),\n        )\n\n    async def handle_streaming(\n        self,\n        request_id: str,\n        params: dict[str, Any],\n        api_base: str | None = None,\n        **kwargs,\n    ) -> AsyncIterator[dict[str, Any]]:\n        \"\"\"Handle streaming request with fake streaming.\"\"\"\n        if not api_base:\n            raise ValueError(\"api_base is required for Pydantic AI agents\")","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/a2a_protocol/providers/pydantic_ai_agents/config.py#L11-L47","documentation":"PydanticAIProviderConfig.handle_non_streaming raises ValueError when api_base is None. Pydantic AI agents are reached over plain HTTP; there is no model-to-endpoint derivation, so the agent URL must be supplied.","triggerScenarios":"Calling the pydantic_ai_agents config handler for a non-streaming request with api_base=None in kwargs.","commonSituations":"Model added in the proxy without `api_base`; assuming the handler reads the base URL from litellm_params like AgentCore does.","solutions":["Pass api_base (the Pydantic AI agent server URL) to the handler","In LiteLLM proxy config, set api_base on the pydantic-ai agent deployment"],"exampleFix":"# before\nresp = await config.handle_non_streaming(request_id=rid, params=params)\n# after\nresp = await config.handle_non_streaming(request_id=rid, params=params, api_base=\"http://localhost:8000\")","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\nif not api_base or not urlparse(api_base).scheme:\n    raise ValueError(\"pydantic-ai agent requires a valid api_base URL\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set api_base on every pydantic-ai deployment","Resolve api_base from config at startup and fail fast if missing"],"tags":["a2a","litellm","pydantic-ai","missing-endpoint","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}