diff --git a/agents-api/agents_api/queries/executions/list_executions.py b/agents-api/agents_api/queries/executions/list_executions.py index 57daf30c5..d19b4dcc4 100644 --- a/agents-api/agents_api/queries/executions/list_executions.py +++ b/agents-api/agents_api/queries/executions/list_executions.py @@ -75,6 +75,16 @@ async def list_executions( Returns: tuple[str, list]: SQL query and parameters for listing executions. """ + + if sort_by not in ["created_at", "updated_at"]: + raise HTTPException(status_code=400, detail="Invalid sort field") + + if limit > 100 or limit < 1: + raise HTTPException(status_code=400, detail="Limit must be between 1 and 100") + + if offset < 0: + raise HTTPException(status_code=400, detail="Offset must be >= 0") + return ( list_executions_query, [