The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
docs: say the loop ceiling covers non-streaming /v1/messages
mateo-berri206e3b856072
diff --git a/litellm/integrations/websearch_interception/ARCHITECTURE.md b/litellm/integrations/websearch_interception/ARCHITECTURE.mdindex ff49b43fa2d..0cce648003e 100644--- a/litellm/integrations/websearch_interception/ARCHITECTURE.md+++ b/litellm/integrations/websearch_interception/ARCHITECTURE.md@@ -235,15 +235,17 @@ model_list:Clients cannot set it. `max_agentic_loops` is on the proxy's untrusted-field list, so a request body thatcarries it is ignored and one request can never drive an unbounded number of upstream model calls.-When the ceiling is reached on a `/v1/messages` request, the turn ends there and the client gets the last-response back with the internal `litellm_web_search` tool call removed and `stop_reason: end_turn`. The client-never declared that tool, so leaving the block in would hand it a tool call it has no way to answer. The answer can be less complete than it would have been with more loops,-which is the tradeoff the ceiling buys, and where the refused call was the only block left the turn can come-back with no text in it at all.--Streaming is covered by the same path rather than a separate one, because interception always converts an-intercepted `stream=True` request to non-streaming before the loop runs, then rebuilds the SSE stream from the-finalized turn. So the ceiling is reached on a response the client has not seen yet either way.+When the ceiling is reached on a non-streaming `/v1/messages` request, the turn ends there and the client gets+the last response back with the internal `litellm_web_search` tool call removed and `stop_reason: end_turn`.+The client never declared that tool, so leaving the block in would hand it a tool call it has no way to answer.+The answer can be less complete than it would have been with more loops, which is the tradeoff the ceiling+buys. Where the refused call was the only block left, the turn comes back with no text in it at all.++Non-streaming is not a limitation on the client here, because a client that asked for a stream gets the same+treatment. Interception converts an intercepted `stream=True` request to non-streaming before the loop runs and+rebuilds the SSE stream from the finalized turn afterwards, so the ceiling is always reached on a response the+client has not seen yet. The guard is written against the flag anyway, so a caller added later that reaches the+loop with a stream already open keeps raising rather than replacing a turn that is halfway to the client.Two other surfaces do not get that treatment yet. `/v1/responses` returns its own shape that the finalizer doesnot rewrite, so it still hands back the internal call. And `/v1/chat/completions` runs its own copy of these