Skip to content

Commit

Permalink
fix: Remove load agent in recall cursor (#2286)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 authored Dec 19, 2024
1 parent f71d921 commit 77f9c4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
12 changes: 1 addition & 11 deletions letta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,6 @@ def get_agent_recall_cursor(
)
actor = self.user_manager.get_user_or_default(user_id=user_id)

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Loading agent object for agent_id={agent_id} (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
letta_agent = self.load_agent(agent_id=agent_id, actor=actor)

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Resolving start_date and end_date for filtering messages (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
Expand All @@ -1005,7 +1000,7 @@ def get_agent_recall_cursor(
logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Fetching messages for agent_id={agent_id}, start_date={start_date}, end_date={end_date}, limit={limit}, reverse={reverse} (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
records = letta_agent.message_manager.list_messages_for_agent(
records = self.message_manager.list_messages_for_agent(
agent_id=agent_id,
actor=actor,
start_date=start_date,
Expand All @@ -1014,11 +1009,6 @@ def get_agent_recall_cursor(
ascending=not reverse,
)

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Validating message types (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
assert all(isinstance(m, Message) for m in records)

if not return_message_object:
logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Converting messages to LettaMessage objects (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
Expand Down
1 change: 1 addition & 0 deletions letta/services/message_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def list_user_messages_for_agent(
limit=limit,
filters=message_filters,
query_text=query_text,
ascending=ascending,
)

@enforce_types
Expand Down

0 comments on commit 77f9c4a

Please sign in to comment.