Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove load agent in recall cursor #2286

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove load agent
  • Loading branch information
mattzh72 committed Dec 19, 2024
commit d30f15db0154711047a4ccdd504abc3d4980fb06
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
Loading