BerriAI/litellm · error · ValueError

litellm_params is required for LangFlowA2AConfig (must conta

Error message

litellm_params is required for LangFlowA2AConfig (must contain custom_llm_provider and model)

What it means

LangFlowA2AConfig.handle_non_streaming raises ValueError when kwargs lacks `litellm_params`. LangFlow routing needs custom_llm_provider and model from litellm_params, and also uses them to bind the LangFlow session (contextId) to the caller's API key hash.

Source

Thrown at litellm/a2a_protocol/providers/langflow/config.py:25

)
from litellm.a2a_protocol.providers.base import BaseA2AProviderConfig
from litellm.llms.langflow.a2a import merge_a2a_session_into_litellm_params


class LangFlowA2AConfig(BaseA2AProviderConfig):
    """A2A bridge for LangFlow: scopes contextId to the authenticated key as the
    LangFlow session_id, then uses completion."""

    async def handle_non_streaming(
        self,
        request_id: str,
        params: dict[str, Any],
        api_base: str | None = None,
        **kwargs,
    ) -> dict[str, Any]:
        litellm_params = kwargs.get("litellm_params")
        if not litellm_params:
            raise ValueError(
                "litellm_params is required for LangFlowA2AConfig (must contain custom_llm_provider and model)"
            )
        litellm_params = merge_a2a_session_into_litellm_params(
            litellm_params, params, litellm_params.get(A2A_USER_API_KEY_HASH_PARAM)
        )
        return await A2ACompletionBridgeHandler.handle_non_streaming(
            request_id=request_id,
            params=params,
            litellm_params=litellm_params,
            api_base=api_base,
            _skip_a2a_provider_routing=True,
        )

    async def handle_streaming(
        self,
        request_id: str,
        params: dict[str, Any],
        api_base: str | None = None,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass litellm_params containing custom_llm_provider ('langflow') and model
  2. Use LiteLLM's standard a2a bridge entry points so params are populated automatically

Example fix

# before
resp = await config.handle_non_streaming(request_id=rid, params=params)
# after
resp = await config.handle_non_streaming(request_id=rid, params=params, litellm_params={"custom_llm_provider": "langflow", "model": "agent"})
Defensive patterns

Strategy: validation

Validate before calling

lp = kwargs.get("litellm_params")
if not lp or not lp.get("custom_llm_provider") or not lp.get("model"):
    raise ValueError("langflow bridge needs custom_llm_provider and model")

Prevention

When it happens

Trigger: Direct invocation of the LangFlow A2A config handler without litellm_params in kwargs.

Common situations: Manual provider-handler dispatch in tests or custom routers; a gateway path that fails to forward litellm_params.

Related errors


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