From 6a5fe635c8f7d9e299833adb6fdb7d702df8a61e Mon Sep 17 00:00:00 2001 From: vedantsahai18 Date: Wed, 25 Dec 2024 18:47:03 -0500 Subject: [PATCH] chore: misc checks --- .../agents_api/queries/executions/list_executions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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, [