Skip to content

Your lightweight open-source personal agent.

fix: handle list-type tool arguments in _tool_hint

Michael-lhh11f1880c0216
diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py
index 6fe37e910..e30ed2338 100644
--- a/nanobot/agent/loop.py
+++ b/nanobot/agent/loop.py
@@ -163,7 +163,10 @@ class AgentLoop:
def _tool_hint(tool_calls: list) -> str:
"""Format tool calls as concise hint, e.g. 'web_search("query")'."""
def _fmt(tc):
- val = next(iter(tc.arguments.values()), None) if tc.arguments else None
+ args = tc.arguments
+ if isinstance(args, list) and args:
+ args = args[0]
+ val = next(iter(args.values()), None) if isinstance(args, dict) and args else None
if not isinstance(val, str):
return tc.name
return f'{tc.name}("{val[:40]}…")' if len(val) > 40 else f'{tc.name}("{val}")'