BerriAI/litellm · error · RuntimeError

Failed to fetch AgentOps token: {response.text}

Error message

Failed to fetch AgentOps token: {response.text}

What it means

Error "Failed to fetch AgentOps token: {response.text}" thrown in BerriAI/litellm.

Source

Thrown at litellm/integrations/otel/presets/agentops.py:128

            return super().export(spans)

    options: Final = spec.options or {}
    return _LazyAuthAgentOpsExporter(endpoint=spec.endpoint, api_key=options.get("api_key"))


def _fetch_agentops_jwt(api_key: str) -> dict[str, Any]:
    # Own a short-lived client rather than ``_get_httpx_client()``: that returns
    # a process-wide cached ``HTTPHandler`` whose connection pool is shared by
    # every caller, so closing it here would break concurrent/subsequent
    # requests. This one-shot auth call gets its own client to close.
    with httpx.Client(timeout=10) as client:
        response: Final = client.post(
            url=_AGENTOPS_AUTH_ENDPOINT,
            headers={"Content-Type": "application/json", "Connection": "keep-alive"},
            json={"api_key": api_key},
        )
        if response.status_code != 200:
            raise RuntimeError(f"Failed to fetch AgentOps token: {response.text}")
        return response.json()


register_exporter_factory(_AGENTOPS_EXPORTER_KIND, _build_agentops_exporter)

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Check the AgentOps API key and endpoint; see the response text for details.

When it happens

Trigger: Thrown at litellm/integrations/otel/presets/agentops.py:128 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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