diff --git a/letta/agent.py b/letta/agent.py index 371595a6e6..1096668e37 100644 --- a/letta/agent.py +++ b/letta/agent.py @@ -237,8 +237,8 @@ def execute_tool_and_persist_state(self, function_name: str, function_args: dict ) function_response, updated_agent_state = sandbox_run_result.func_return, sandbox_run_result.agent_state assert orig_memory_str == self.agent_state.memory.compile(), "Memory should not be modified in a sandbox tool" - - self.update_memory_if_change(updated_agent_state.memory) + if updated_agent_state is not None: + self.update_memory_if_change(updated_agent_state.memory) except Exception as e: # Need to catch error here, or else trunction wont happen # TODO: modify to function execution error