diff --git a/nanobot/agent/runner.py b/nanobot/agent/runner.py index 6b887f14..d6fdc5f9 100644 --- a/nanobot/agent/runner.py +++ b/nanobot/agent/runner.py @@ -40,17 +40,10 @@ _MAX_INJECTION_CYCLES = 5 _SNIP_SAFETY_BUFFER = 1024 _MICROCOMPACT_KEEP_RECENT = 10 _MICROCOMPACT_MIN_CHARS = 500 -_COMPACTABLE_TOOLS = frozenset( - { - "read_file", - "exec", - "grep", - "glob", - "web_search", - "web_fetch", - "list_dir", - } -) +_COMPACTABLE_TOOLS = frozenset({ + "read_file", "exec", "grep", "glob", + "web_search", "web_fetch", "list_dir", +}) _BACKFILL_CONTENT = "[Tool result unavailable — call was interrupted or lost]" diff --git a/nanobot/providers/base.py b/nanobot/providers/base.py index 92de0bc6..27ea1e18 100644 --- a/nanobot/providers/base.py +++ b/nanobot/providers/base.py @@ -81,7 +81,11 @@ class LLMResponse: """ if not self.has_tool_calls: return False - return self.finish_reason == "tool_calls" + if self.finish_reason == "tool_calls": + return True + if self.finish_reason == "stop": + return True + return False @dataclass(frozen=True)