From 98ab655765e8a5c8beba2c492b942bc1493e5069 Mon Sep 17 00:00:00 2001 From: Kian Jones <11655409+kianjones9@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:46:08 -0800 Subject: [PATCH] chore: add add limit of 100 (#6143) * add limit of 100 * revert scheduler logging * api changes * remove redundant None type check --- fern/openapi.json | 1 + letta/server/rest_api/routers/v1/agents.py | 2 +- letta/services/agent_manager.py | 15 ++++++--------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fern/openapi.json b/fern/openapi.json index 12c21220..72ceccfb 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -6783,6 +6783,7 @@ } ], "description": "How many results to include in the response.", + "default": 100, "title": "Limit" }, "description": "How many results to include in the response." diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py index ec54fe97..b8bb6d6a 100644 --- a/letta/server/rest_api/routers/v1/agents.py +++ b/letta/server/rest_api/routers/v1/agents.py @@ -1145,7 +1145,7 @@ async def list_passages( server: "SyncServer" = Depends(get_letta_server), after: str | None = Query(None, description="Unique ID of the memory to start the query range at."), before: str | None = Query(None, description="Unique ID of the memory to end the query range at."), - limit: int | None = Query(None, description="How many results to include in the response."), + limit: int | None = Query(100, description="How many results to include in the response."), search: str | None = Query(None, description="Search passages by text"), ascending: bool | None = Query( True, description="Whether to sort passages oldest to newest (True, default) or newest to oldest (False)" diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.py index 0e62579e..521b3ced 100644 --- a/letta/services/agent_manager.py +++ b/letta/services/agent_manager.py @@ -2001,9 +2001,8 @@ class AgentManager: agent_only=agent_only, ) - # Add limit - if limit: - main_query = main_query.limit(limit) + # Add limit (enforce default if not provided) + main_query = main_query.limit(limit) # Execute query result = await session.execute(main_query) @@ -2077,9 +2076,8 @@ class AgentManager: agent_only=agent_only, ) - # Add limit - if limit: - main_query = main_query.limit(limit) + # Add limit (enforce default if not provided) + main_query = main_query.limit(limit) # Execute query result = await session.execute(main_query) @@ -2139,9 +2137,8 @@ class AgentManager: embedding_config=embedding_config, ) - # Add limit - if limit: - main_query = main_query.limit(limit) + # Add limit (enforce default if not provided) + main_query = main_query.limit(limit) # Execute query result = await session.execute(main_query)