Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: move request_heartbeat extraction to fix final_step bug (#2844)

Shangyin Tan980bcc9350bd
diff --git a/letta/agents/letta_agent.py b/letta/agents/letta_agent.py
index 619d09021..beed72d2c 100644
--- a/letta/agents/letta_agent.py
+++ b/letta/agents/letta_agent.py
@@ -913,13 +913,13 @@ class LettaAgent(BaseAgent):
except AssertionError:
tool_args = json.loads(tool_args)
+ # Get request heartbeats and coerce to bool
+ request_heartbeat = tool_args.pop("request_heartbeat", False)
if is_final_step:
stop_reason = LettaStopReason(stop_reason=StopReasonType.max_steps.value)
logger.info("Agent has reached max steps.")
request_heartbeat = False
else:
- # Get request heartbeats and coerce to bool
- request_heartbeat = tool_args.pop("request_heartbeat", False)
# Pre-emptively pop out inner_thoughts
tool_args.pop(INNER_THOUGHTS_KWARG, "")