BerriAI/litellm · error · AzureAIAgentsError

Streaming request failed

Error message

Streaming request failed: {error_text.decode()}

What it means

Error "Streaming request failed: {error_text.decode()}" thrown in BerriAI/litellm.

Solutions

  1. Read the decoded error text in the message; fix the streaming request accordingly (auth, model, or payload).

When it happens

Trigger: Thrown at litellm/llms/azure_ai/agents/handler.py:623 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/464f795389029ad5. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/azure_ai/agents/handler.py:623

        url: Final = self._build_create_thread_and_run_url(api_base, api_version)
        verbose_logger.debug("Azure AI Agents streaming - URL: %s", url)

        # Use LiteLLM's async HTTP client for streaming
        client: Final = get_async_httpx_client(
            llm_provider=litellm.LlmProviders.AZURE_AI,
            params={"ssl_verify": litellm_params.get("ssl_verify", None)},
        )

        response: Final = await client.post(
            url=url,
            headers=headers,
            data=json.dumps(payload),
            stream=True,
        )

        if response.status_code not in [200, 201]:
            error_text: Final = await response.aread()
            raise AzureAIAgentsError(
                status_code=response.status_code,
                message=f"Streaming request failed: {error_text.decode()}",
            )

        async for chunk in self._process_sse_stream(response, model):
            yield chunk

    async def _process_sse_stream(
        self,
        response: httpx.Response,
        model: str,
    ) -> AsyncIterator[ModelResponseStream]:
        """Process SSE stream and yield OpenAI-compatible streaming chunks."""
        from litellm.types.utils import Delta, ModelResponseStream, StreamingChoices

        response_id: Final = f"chatcmpl-{uuid.uuid4().hex[:8]}"
        created: Final = int(time.time())
        thread_id = None

View on GitHub (pinned to 77b7c6c40c)