From a312ee7b4c099201bae53176fc2a2f351522eb2b Mon Sep 17 00:00:00 2001 From: Teknium Date: Tue, 24 Mar 2026 07:16:18 -0700 Subject: [PATCH] fix(agent): ensure first delta is fired during reasoning updates - Added calls to `_fire_first_delta()` in the `AIAgent` class to ensure that the first delta is triggered for both reasoning and thinking updates. This change improves the handling of delta events during streaming, enhancing the responsiveness of the agent's reasoning capabilities. --- run_agent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_agent.py b/run_agent.py index 2f75598e1f..6e0cac97ed 100644 --- a/run_agent.py +++ b/run_agent.py @@ -3616,6 +3616,7 @@ class AIAgent: reasoning_text = getattr(delta, "reasoning_content", None) or getattr(delta, "reasoning", None) if reasoning_text: reasoning_parts.append(reasoning_text) + _fire_first_delta() self._fire_reasoning_delta(reasoning_text) # Accumulate text content — fire callback only when no tool calls @@ -3730,6 +3731,7 @@ class AIAgent: elif delta_type == "thinking_delta": thinking_text = getattr(delta, "thinking", "") if thinking_text: + _fire_first_delta() self._fire_reasoning_delta(thinking_text) # Return the native Anthropic Message for downstream processing