BerriAI/litellm · error · AzureAIAgentsError

Run timed out waiting for completion

Error message

Run timed out waiting for completion

What it means

Error "Run timed out waiting for completion" thrown in BerriAI/litellm.

Solutions

  1. Increase the wait timeout or investigate the stuck run in Azure AI Foundry.

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

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

        status_url: Final = self._build_run_status_url(api_base, thread_id, run_id, api_version)
        for _ in range(self.config.MAX_POLL_ATTEMPTS):
            response = make_request("GET", status_url)
            self._check_response(response, [200], "Failed to get run status")

            status_data: _RunStatus = response.json()
            status = status_data.get("status")
            verbose_logger.debug("Run status: %s", status)

            if status == "completed":
                break
            elif status in ["failed", "cancelled", "expired"]:
                error_data: _RunStatus = response.json()
                error_msg = error_data.get("last_error", {}).get("message", "Unknown error")
                raise AzureAIAgentsError(status_code=500, message=f"Run {status}: {error_msg}")

            time.sleep(self.config.POLL_INTERVAL_SECONDS)
        else:
            raise AzureAIAgentsError(status_code=408, message="Run timed out waiting for completion")

        # Step 5: Get messages
        response = make_request("GET", self._build_list_messages_url(api_base, thread_id, api_version))
        self._check_response(response, [200], "Failed to get messages")

        messages_data: Final[_AzureMessagesData] = response.json()
        content, annotations = self._extract_content_from_messages(messages_data)
        return thread_id, content, annotations

    # -------------------------------------------------------------------------
    # Async Completion
    # -------------------------------------------------------------------------
    async def acompletion(
        self,
        model: str,
        messages: list[dict[str, object]],
        api_base: str,
        api_key: str,

View on GitHub (pinned to 77b7c6c40c)