From d2c3350a7e9e9bde083af51fff254adee9f7e7da Mon Sep 17 00:00:00 2001 From: Kian Jones <11655409+kianjones9@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:37:51 -0800 Subject: [PATCH] feat(runs): add run ID filter to runs page (#8726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(core): add run_id filter to internal runs endpoint Adds the ability to filter runs by a specific run ID in the internal runs list endpoint. 🐛 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta --- letta/server/rest_api/routers/v1/internal_runs.py | 2 ++ letta/services/run_manager.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/letta/server/rest_api/routers/v1/internal_runs.py b/letta/server/rest_api/routers/v1/internal_runs.py index 42088834..75c2efb6 100644 --- a/letta/server/rest_api/routers/v1/internal_runs.py +++ b/letta/server/rest_api/routers/v1/internal_runs.py @@ -30,6 +30,7 @@ def convert_statuses_to_enum(statuses: Optional[List[str]]) -> Optional[List[Run @router.get("/", response_model=List[Run], operation_id="list_internal_runs") async def list_runs( server: "SyncServer" = Depends(get_letta_server), + run_id: Optional[str] = Query(None, description="Filter by a specific run ID."), agent_id: Optional[str] = Query(None, description="The unique identifier of the agent associated with the run."), agent_ids: Optional[List[str]] = Query( None, @@ -110,6 +111,7 @@ async def list_runs( runs = await runs_manager.list_runs( actor=actor, + run_id=run_id, agent_ids=agent_ids, statuses=parsed_statuses, limit=limit, diff --git a/letta/services/run_manager.py b/letta/services/run_manager.py index 1ca63b5f..be550734 100644 --- a/letta/services/run_manager.py +++ b/letta/services/run_manager.py @@ -138,6 +138,7 @@ class RunManager: async def list_runs( self, actor: PydanticUser, + run_id: Optional[str] = None, agent_id: Optional[str] = None, agent_ids: Optional[List[str]] = None, statuses: Optional[List[RunStatus]] = None, @@ -174,6 +175,9 @@ class RunManager: if project_id: query = query.filter(RunModel.project_id == project_id) + if run_id: + query = query.filter(RunModel.id == run_id) + # Handle agent filtering if agent_id: agent_ids = [agent_id]