diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py index 2fe2f9e9ba..69b97c764e 100644 --- a/letta/server/rest_api/routers/v1/agents.py +++ b/letta/server/rest_api/routers/v1/agents.py @@ -456,13 +456,6 @@ def get_agent_messages( """ actor = server.user_manager.get_user_or_default(user_id=user_id) - # TODO: Temporary debugging logs for debugging very slow endpoint - import uuid - - temp_rand_uuid = uuid.uuid4() - - logger.info(f"[{temp_rand_uuid}] RECEIVED GET /messages for agent_id={agent_id} before={before} limit={limit}") - return server.get_agent_recall_cursor( user_id=actor.id, agent_id=agent_id, @@ -472,7 +465,6 @@ def get_agent_messages( return_message_object=msg_object, assistant_message_tool_name=assistant_message_tool_name, assistant_message_tool_kwarg=assistant_message_tool_kwarg, - temp_rand_uuid=temp_rand_uuid, ) diff --git a/letta/server/server.py b/letta/server/server.py index c885b96538..1b8ff9cdc7 100644 --- a/letta/server/server.py +++ b/letta/server/server.py @@ -979,27 +979,13 @@ def get_agent_recall_cursor( return_message_object: bool = True, assistant_message_tool_name: str = constants.DEFAULT_MESSAGE_TOOL, assistant_message_tool_kwarg: str = constants.DEFAULT_MESSAGE_TOOL_KWARG, - temp_rand_uuid: Optional[str] = None, ) -> Union[List[Message], List[LettaMessage]]: # TODO: Thread actor directly through this function, since the top level caller most likely already retrieved the user - import datetime - start_time = datetime.datetime.utcnow() - - logger.info( - f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Fetching actor for user_id={user_id} (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)" - ) actor = self.user_manager.get_user_or_default(user_id=user_id) - - 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)" - ) start_date = self.message_manager.get_message_by_id(after, actor=actor).created_at if after else None end_date = self.message_manager.get_message_by_id(before, actor=actor).created_at if before else None - 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 = self.message_manager.list_messages_for_agent( agent_id=agent_id, actor=actor, @@ -1010,9 +996,6 @@ def get_agent_recall_cursor( ) 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)" - ) records = [ msg for m in records @@ -1023,14 +1006,8 @@ def get_agent_recall_cursor( ] if reverse: - logger.info( - f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Reversing message order (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)" - ) records = records[::-1] - logger.info( - f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Returning {len(records)} messages (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)" - ) return records def get_server_config(self, include_defaults: bool = False) -> dict: