From af23e6cda1968da8fceee686401d1e514181a440 Mon Sep 17 00:00:00 2001 From: cthomas Date: Wed, 1 Oct 2025 17:50:45 -0700 Subject: [PATCH] feat: add pagination to run messages endpoint (#5082) * feat: add pagination to run messages endpoint * chore: regenerate API client with pagination parameters --- fern/openapi.json | 13 +++++++++++++ letta/server/rest_api/routers/v1/runs.py | 1 + 2 files changed, 14 insertions(+) diff --git a/fern/openapi.json b/fern/openapi.json index af2f31dc..8d6db742 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -10207,6 +10207,19 @@ "title": "Order" }, "description": "Sort order for messages 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" } ], "responses": { diff --git a/letta/server/rest_api/routers/v1/runs.py b/letta/server/rest_api/routers/v1/runs.py index b8bab7db..0577eba9 100644 --- a/letta/server/rest_api/routers/v1/runs.py +++ b/letta/server/rest_api/routers/v1/runs.py @@ -187,6 +187,7 @@ async def list_run_messages( order: Literal["asc", "desc"] = Query( "asc", description="Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first" ), + order_by: Literal["created_at"] = Query("created_at", description="Field to sort by"), ): """Get response messages associated with a run.""" actor = await server.user_manager.get_actor_or_default_async(actor_id=headers.actor_id)