Skip to content

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]

docs: scope the loop-ceiling docs to the paths the fix actually covers

mateo-berri7c02c089f650
diff --git a/litellm/integrations/websearch_interception/ARCHITECTURE.md b/litellm/integrations/websearch_interception/ARCHITECTURE.md
index 691bb26880e..62863bd052a 100644
--- a/litellm/integrations/websearch_interception/ARCHITECTURE.md
+++ b/litellm/integrations/websearch_interception/ARCHITECTURE.md
@@ -235,10 +235,18 @@ model_list:
Clients cannot set it. `max_agentic_loops` is on the proxy's untrusted-field list, so a request body that
carries it is ignored and one request can never drive an unbounded number of upstream model calls.
-When the ceiling is reached, 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
+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`.
+A streaming request the interceptor converted to non-streaming counts as one of these, since the client is
+still waiting on a single response. 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.
+
+Two paths do not get that treatment yet. A request that streams all the way through, meaning one the
+interceptor did not convert, has already put its message on the wire before the ceiling is checked. And
+`/v1/responses` returns its own shape that the finalizer does not rewrite, so it still hands back the internal
+call. Both are tracked separately
---
diff --git a/litellm/types/integrations/custom_logger.py b/litellm/types/integrations/custom_logger.py
index 6b1bb2f449f..2cca16351af 100644
--- a/litellm/types/integrations/custom_logger.py
+++ b/litellm/types/integrations/custom_logger.py
@@ -30,6 +30,11 @@ class AgenticLoopSafetyError(ValueError):
Covers both rails: the bounded-loop cap (``max_agentic_loops``) and the
repeated tool-call fingerprint cycle break. Subclasses ``ValueError`` so
callers that already catch the broader type keep working.
+
+ Only the anthropic messages loop raises this today. The chat completions
+ loop in ``litellm_core_utils/chat_completion_agentic_loop.py`` still raises
+ a plain ``ValueError`` from its own copy of the same rails, so catching
+ this type alone will not cover that surface until it is moved over.
"""