Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: add pagination for listing agents (#517)

Sarah Wooderscde0fc9c0bf1
diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py
index 986c8512f..96d29777b 100644
--- a/letta/server/rest_api/routers/v1/agents.py
+++ b/letta/server/rest_api/routers/v1/agents.py
@@ -46,6 +46,8 @@ def list_agents(
),
server: "SyncServer" = Depends(get_letta_server),
user_id: Optional[str] = Header(None, alias="user_id"),
+ cursor: Optional[int] = Query(None, description="Cursor for pagination"),
+ limit: Optional[int] = Query(None, description="Limit for pagination"),
# Extract user_id from header, default to None if not present
):
"""
@@ -66,7 +68,7 @@ def list_agents(
}
# Call list_agents with the dynamic kwargs
- agents = server.agent_manager.list_agents(actor=actor, **kwargs)
+ agents = server.agent_manager.list_agents(actor=actor, cursor=cursor, limit=limit, **kwargs)
return agents