diff --git a/run_agent.py b/run_agent.py index afce4e923..3e0d9537f 100644 --- a/run_agent.py +++ b/run_agent.py @@ -2692,12 +2692,17 @@ class AIAgent: } response = self.client.chat.completions.create(**api_kwargs, timeout=30.0) - # Extract tool calls from the response, handling both API formats + # Extract tool calls from the response, handling all API formats tool_calls = [] if self.api_mode == "codex_responses" and not _aux_available: assistant_msg, _ = self._normalize_codex_response(response) if assistant_msg and assistant_msg.tool_calls: tool_calls = assistant_msg.tool_calls + elif self.api_mode == "anthropic_messages" and not _aux_available: + from agent.anthropic_adapter import normalize_anthropic_response as _nar_flush + _flush_msg, _ = _nar_flush(response) + if _flush_msg and _flush_msg.tool_calls: + tool_calls = _flush_msg.tool_calls elif hasattr(response, "choices") and response.choices: assistant_message = response.choices[0].message if assistant_message.tool_calls: