feat(runs): add run ID filter to runs page (#8726)
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 <noreply@letta.com>
This commit is contained in:
committed by
Sarah Wooders
parent
6b6ca91183
commit
d2c3350a7e
@@ -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,
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user