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: patched pop (#1232)

Charles Packerbca1f9ba8c74
diff --git a/memgpt/main.py b/memgpt/main.py
index 5334b4f08..d8d31aae8 100644
--- a/memgpt/main.py
+++ b/memgpt/main.py
@@ -11,6 +11,7 @@ from memgpt.constants import FUNC_FAILED_HEARTBEAT_MESSAGE, JSON_ENSURE_ASCII, J
console = Console()
+from memgpt.agent import save_agent
from memgpt.agent_store.storage import StorageConnector, TableType
from memgpt.interface import CLIInterface as interface # for printing to terminal
from memgpt.config import MemGPTConfig
@@ -192,7 +193,9 @@ def run_agent_loop(memgpt_agent, config: MemGPTConfig, first, ms: MetadataStore,
else:
print(f"Popping last {pop_amount} messages from stack")
for _ in range(min(pop_amount, len(memgpt_agent.messages))):
- memgpt_agent.messages.pop()
+ memgpt_agent._messages.pop()
+ # Persist the state
+ save_agent(agent=memgpt_agent, ms=ms)
continue
elif user_input.lower() == "/retry":