BerriAI/litellm · error · ValueError

'wxo_agent_id' is required in litellm_params for WXO agents

Error message

'wxo_agent_id' is required in litellm_params for WXO agents

What it means

Configuration validation error from the WXO handler: 'wxo_agent_id' is missing or empty in litellm_params. LiteLLM needs the specific watsonx Orchestrate agent id to route the request to that agent; without it the call cannot be addressed and fails fast with ValueError.

Source

Thrown at litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py:201

                continue
            chunk_text = WatsonxOrchestrateTransformation.extract_text_from_wxo_result(event)
            if chunk_text:
                accumulated_text += chunk_text
        return accumulated_text

    @staticmethod
    def _extract_litellm_params(litellm_params: dict[str, Any]) -> WXORequestParams:
        cp4d_host: Final = litellm_params.get("cp4d_host") or ""
        instance_id: Final = litellm_params.get("instance_id") or ""
        wxo_agent_id: Final = litellm_params.get("wxo_agent_id") or ""
        api_key: Final = litellm_params.get("api_key") or ""

        if not cp4d_host:
            raise ValueError("'cp4d_host' is required in litellm_params for WXO agents")
        if not instance_id:
            raise ValueError("'instance_id' is required in litellm_params for WXO agents")
        if not wxo_agent_id:
            raise ValueError("'wxo_agent_id' is required in litellm_params for WXO agents")
        if not api_key:
            raise ValueError("'api_key' is required in litellm_params for WXO agents")

        return WXORequestParams(
            cp4d_host=cp4d_host,
            instance_id=instance_id,
            wxo_agent_id=wxo_agent_id,
            api_key=api_key,
            username=litellm_params.get("username") or None,
            auth_mode=litellm_params.get("auth_mode") or "cp4d",
            thread_id=litellm_params.get("thread_id") or None,
        )

    @staticmethod
    async def handle_non_streaming(
        request_id: str,
        params: dict[str, Any],
        litellm_params: dict[str, Any],

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Add 'wxo_agent_id' to litellm_params with the exact agent id shown in the watsonx Orchestrate UI/API.
  2. Confirm the agent still exists in the target WXO instance (deleted agents keep configs stale).
  3. Check spelling: it must be 'wxo_agent_id', not 'agent_id' or 'skill_id'.

Example fix

# before
litellm_params:
  model: watsonx_orchestrate/agent
  cp4d_host: https://cpd.example.com:443
  instance_id: 1f2a3b4c-...

# after
litellm_params:
  model: watsonx_orchestrate/agent
  cp4d_host: https://cpd.example.com:443
  instance_id: 1f2a3b4c-...
  wxo_agent_id: my-agent-id
Defensive patterns

Strategy: validation

Validate before calling

def validate_wxo_config(litellm_params: dict) -> None:
    missing = [k for k in ("cp4d_host", "instance_id", "wxo_agent_id", "api_key") if not litellm_params.get(k)]
    if missing:
        raise ConfigError(f"WXO config missing: {missing}")

Type guard

def has_valid_wxo_config(p: dict) -> bool:
    return all(isinstance(p.get(k), str) and p[k].strip() for k in ("cp4d_host", "instance_id", "wxo_agent_id", "api_key"))

Prevention

When it happens

Trigger: WXO model config that omits 'wxo_agent_id' or passes an empty value. Fired only after cp4d_host, instance_id, and api_key-adjacent checks that precede it have passed (it runs third in the ordered checks).

Common situations: Using a WXO 'skill' id instead of the agent id; agent deleted or recreated in WXO and the config never updated; key misspelled as 'agent_id' instead of 'wxo_agent_id'.

Related errors


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