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.

chore: add order_by param to list archives [LET-5839] (#5734)

jnjpng949320ab254e
diff --git a/fern/openapi.json b/fern/openapi.json
index f1a565bf3..6675a63e0 100644
--- a/fern/openapi.json
+++ b/fern/openapi.json
@@ -134,6 +134,19 @@
},
"description": "Sort order for archives by creation time. 'asc' for oldest first, 'desc' for newest first"
},
+ {
+ "name": "order_by",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "const": "created_at",
+ "type": "string",
+ "description": "Field to sort by",
+ "default": "created_at",
+ "title": "Order By"
+ },
+ "description": "Field to sort by"
+ },
{
"name": "name",
"in": "query",
diff --git a/letta/server/rest_api/routers/v1/archives.py b/letta/server/rest_api/routers/v1/archives.py
index 83bf85ab4..3bf3dcb35 100644
--- a/letta/server/rest_api/routers/v1/archives.py
+++ b/letta/server/rest_api/routers/v1/archives.py
@@ -69,6 +69,7 @@ async def list_archives(
order: Literal["asc", "desc"] = Query(
"desc", description="Sort order for archives by creation time. 'asc' for oldest first, 'desc' for newest first"
),
+ order_by: Literal["created_at"] = Query("created_at", description="Field to sort by"),
name: Optional[str] = Query(None, description="Filter by archive name (exact match)"),
agent_id: Optional[str] = Query(None, description="Only archives attached to this agent ID"),
server: "SyncServer" = Depends(get_letta_server),