From 05fc1371e47efa96c086e8a9881f709d0e2365dc Mon Sep 17 00:00:00 2001 From: Ahmad Haidar Date: Mon, 13 Jan 2025 14:31:46 +0300 Subject: [PATCH 1/5] fix(agents-api): enable agent tool endpoints --- agents-api/agents_api/routers/agents/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/agents-api/agents_api/routers/agents/__init__.py b/agents-api/agents_api/routers/agents/__init__.py index 95354363c..c9e5efc04 100644 --- a/agents-api/agents_api/routers/agents/__init__.py +++ b/agents-api/agents_api/routers/agents/__init__.py @@ -2,18 +2,18 @@ from .create_agent import create_agent -# from .create_agent_tool import create_agent_tool +from .create_agent_tool import create_agent_tool from .create_or_update_agent import create_or_update_agent from .delete_agent import delete_agent -# from .delete_agent_tool import delete_agent_tool +from .delete_agent_tool import delete_agent_tool from .get_agent_details import get_agent_details -# from .list_agent_tools import list_agent_tools +from .list_agent_tools import list_agent_tools from .list_agents import list_agents from .patch_agent import patch_agent -# from .patch_agent_tool import patch_agent_tool +from .patch_agent_tool import patch_agent_tool from .router import router from .update_agent import update_agent -# from .update_agent_tool import update_agent_tool +from .update_agent_tool import update_agent_tool From 0f679c505ed83ef6436fd7af1341eea2e11a99d8 Mon Sep 17 00:00:00 2001 From: Ahmad-mtos Date: Mon, 13 Jan 2025 11:32:58 +0000 Subject: [PATCH 2/5] refactor: Lint agents-api (CI) --- agents-api/agents_api/routers/agents/__init__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/agents-api/agents_api/routers/agents/__init__.py b/agents-api/agents_api/routers/agents/__init__.py index c9e5efc04..2eadecb3d 100644 --- a/agents-api/agents_api/routers/agents/__init__.py +++ b/agents-api/agents_api/routers/agents/__init__.py @@ -1,18 +1,14 @@ # ruff: noqa: F401 from .create_agent import create_agent - from .create_agent_tool import create_agent_tool from .create_or_update_agent import create_or_update_agent from .delete_agent import delete_agent - from .delete_agent_tool import delete_agent_tool from .get_agent_details import get_agent_details - from .list_agent_tools import list_agent_tools from .list_agents import list_agents from .patch_agent import patch_agent - from .patch_agent_tool import patch_agent_tool from .router import router from .update_agent import update_agent From eb29b1179b8348d8e08e4160366e001f620cacb6 Mon Sep 17 00:00:00 2001 From: Ahmad Haidar Date: Mon, 13 Jan 2025 14:49:39 +0300 Subject: [PATCH 3/5] fix(agents-api): fix create agent tool endpoint --- agents-api/agents_api/routers/agents/create_agent_tool.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/agents-api/agents_api/routers/agents/create_agent_tool.py b/agents-api/agents_api/routers/agents/create_agent_tool.py index 74e98b3f9..67256862b 100644 --- a/agents-api/agents_api/routers/agents/create_agent_tool.py +++ b/agents-api/agents_api/routers/agents/create_agent_tool.py @@ -19,10 +19,13 @@ async def create_agent_tool( x_developer_id: Annotated[UUID, Depends(get_developer_id)], data: CreateToolRequest, ) -> ResourceCreatedResponse: - tool = await create_tools_query( + tools = await create_tools_query( developer_id=x_developer_id, agent_id=agent_id, data=[data], - )[0] + ) + + tool = tools[0] return ResourceCreatedResponse(id=tool.id, created_at=tool.created_at, jobs=[]) + From 34e3bc573dfd4cac8d4541e739ad4e9eb352f4dd Mon Sep 17 00:00:00 2001 From: Ahmad-mtos Date: Mon, 13 Jan 2025 11:50:44 +0000 Subject: [PATCH 4/5] refactor: Lint agents-api (CI) --- agents-api/agents_api/routers/agents/create_agent_tool.py | 1 - 1 file changed, 1 deletion(-) diff --git a/agents-api/agents_api/routers/agents/create_agent_tool.py b/agents-api/agents_api/routers/agents/create_agent_tool.py index 67256862b..ebaf93ed5 100644 --- a/agents-api/agents_api/routers/agents/create_agent_tool.py +++ b/agents-api/agents_api/routers/agents/create_agent_tool.py @@ -28,4 +28,3 @@ async def create_agent_tool( tool = tools[0] return ResourceCreatedResponse(id=tool.id, created_at=tool.created_at, jobs=[]) - From 05f10a393185c202e0a34b90708ace999f31c7df Mon Sep 17 00:00:00 2001 From: Ahmad Haidar Date: Mon, 13 Jan 2025 18:10:53 +0300 Subject: [PATCH 5/5] hotfix: switch query table to transitions --- .../queries/executions/get_paused_execution_token.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agents-api/agents_api/queries/executions/get_paused_execution_token.py b/agents-api/agents_api/queries/executions/get_paused_execution_token.py index 677fd91a3..46344708a 100644 --- a/agents-api/agents_api/queries/executions/get_paused_execution_token.py +++ b/agents-api/agents_api/queries/executions/get_paused_execution_token.py @@ -6,9 +6,10 @@ from ...common.utils.db_exceptions import common_db_exceptions from ..utils import pg_query, rewrap_exceptions, wrap_in_class +# FIXME: We should use latest_transitions instead of transitions # Query to get a paused execution token get_paused_execution_token_query = """ -SELECT * FROM latest_transitions +SELECT * FROM transitions WHERE execution_id = $1 AND type = 'wait'