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
refactor(agentic-loop): narrow logging_obj before building the fake stream wrapper
shivama14daf18d6eb
diff --git a/litellm/litellm_core_utils/chat_completion_agentic_loop.py b/litellm/litellm_core_utils/chat_completion_agentic_loop.pyindex a5f5c6ac68f..c8e9e2583ba 100644--- a/litellm/litellm_core_utils/chat_completion_agentic_loop.py+++ b/litellm/litellm_core_utils/chat_completion_agentic_loop.py@@ -10,6 +10,8 @@ from litellm.litellm_core_utils.agentic_loop_settings import (DEFAULT_MAX_AGENTIC_LOOPS,validated_max_agentic_loops,)+from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObject+from litellm.llms.base_llm.base_model_iterator import MockResponseIteratorfrom litellm.types.integrations.custom_logger import (CHAT_COMPLETION_AGENTIC_SURFACE,HEADROOM_CONVERTED_STREAM_KEY,@@ -104,9 +106,8 @@ def _wrap_response_as_fake_stream() -> object:if isinstance(response, CustomStreamWrapper):return response- if not isinstance(response, ModelResponse):+ if not isinstance(response, ModelResponse) or not isinstance(logging_obj, LiteLLMLoggingObject):return response- from litellm.llms.base_llm.base_model_iterator import MockResponseIteratorreturn CustomStreamWrapper(completion_stream=MockResponseIterator(model_response=response),