Skip to content

Commit

Permalink
fix: Add save agents (#2080)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 authored Nov 21, 2024
1 parent 4b4ddb2 commit 1ce7aa5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions letta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@ def __init__(
)
)

def save_agents(self):
"""Saves all the agents that are in the in-memory object store"""
for agent_d in self.active_agents:
try:
save_agent(agent_d["agent"], self.ms)
logger.info(f"Saved agent {agent_d['agent_id']}")
except Exception as e:
logger.exception(f"Error occurred while trying to save agent {agent_d['agent_id']}:\n{e}")

def _get_agent(self, user_id: str, agent_id: str) -> Union[Agent, None]:
"""Get the agent object from the in-memory object store"""
for d in self.active_agents:
Expand Down

0 comments on commit 1ce7aa5

Please sign in to comment.