Skip to content

Your lightweight open-source personal agent.

fix(agent): prevent tool hints from overwriting reasoning in streaming drafts

Sergio Sánchez Vallésc27d2b15220b
diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py
index 5eea6e610..fc1fd751c 100644
--- a/nanobot/agent/loop.py
+++ b/nanobot/agent/loop.py
@@ -209,10 +209,13 @@ class AgentLoop:
for b in (response.thinking_blocks or []) if isinstance(b, dict) and "signature" in b)
]
- if combined := "\n\n".join(filter(None, thoughts)):
- await on_progress(combined)
-
- await on_progress(self._tool_hint(response.tool_calls), tool_hint=True)
+ combined_thoughts = "\n\n".join(filter(None, thoughts))
+ tool_hint_str = self._tool_hint(response.tool_calls)
+
+ if combined_thoughts:
+ await on_progress(f"{combined_thoughts}\n\n{tool_hint_str}", tool_hint=True)
+ else:
+ await on_progress(tool_hint_str, tool_hint=True)
tool_call_dicts = [
{