Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: CLI patches - patch runtime error on main loop + duplicate internal monologue (#1852)
Charles Packerfa0b0a5b9f51
diff --git a/letta/agent.py b/letta/agent.pyindex 5589fec06..b8cc51f25 100644--- a/letta/agent.py+++ b/letta/agent.py@@ -556,9 +556,12 @@ class Agent(BaseAgent):) # extend conversation with assistant's replyprintd(f"Function call message: {messages[-1]}")+ nonnull_content = Falseif response_message.content:# The content if then internal monologue, not chatself.interface.internal_monologue(response_message.content, msg_obj=messages[-1])+ # Flag to avoid printing a duplicate if inner thoughts get popped from the function call+ nonnull_content = True# Step 3: call the function# Note: the JSON response may not always be valid; be sure to handle errors@@ -619,7 +622,7 @@ class Agent(BaseAgent):if "inner_thoughts" in function_args:response_message.content = function_args.pop("inner_thoughts")# The content if then internal monologue, not chat- if response_message.content:+ if response_message.content and not nonnull_content:self.interface.internal_monologue(response_message.content, msg_obj=messages[-1])# (Still parsing function args)diff --git a/letta/main.py b/letta/main.pyindex 160b83dac..f663148de 100644--- a/letta/main.py+++ b/letta/main.py@@ -366,7 +366,7 @@ def run_agent_loop(first_message=False,skip_verify=no_verify,stream=stream,- inner_thoughts_in_kwargs=inner_thoughts_in_kwargs,+ inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs,ms=ms,)new_messages = step_response.messages