diff --git a/app/desktop/studio_server/tool_api.py b/app/desktop/studio_server/tool_api.py index 10afa6969..efe462317 100644 --- a/app/desktop/studio_server/tool_api.py +++ b/app/desktop/studio_server/tool_api.py @@ -32,7 +32,11 @@ from kiln_ai.utils.exhaustive_error import raise_exhaustive_enum_error from kiln_server.project_api import project_from_id from kiln_server.task_api import task_from_id -from kiln_server.utils.agent_checks.policy import ALLOW_AGENT, DENY_AGENT +from kiln_server.utils.agent_checks.policy import ( + ALLOW_AGENT, + DENY_AGENT, + agent_policy_require_approval, +) from mcp.types import Tool as MCPTool from pydantic import BaseModel, Field @@ -818,7 +822,9 @@ def _validate_kiln_task_tool_task_and_run_config( @app.post( "/api/projects/{project_id}/kiln_task_tool", tags=["Tools & MCP"], - openapi_extra=DENY_AGENT, + openapi_extra=agent_policy_require_approval( + "Register a Kiln task as a tool (also called a sub-agent), making it callable by other agents and run configs." + ), ) async def add_kiln_task_tool( project_id: Annotated[ @@ -852,7 +858,9 @@ async def add_kiln_task_tool( @app.patch( "/api/projects/{project_id}/edit_kiln_task_tool/{tool_server_id}", tags=["Tools & MCP"], - openapi_extra=DENY_AGENT, + openapi_extra=agent_policy_require_approval( + "Edit a Kiln task tool (also called a sub-agent), including its name, description, underlying task, or run config." + ), ) async def edit_kiln_task_tool( project_id: Annotated[ diff --git a/libs/server/kiln_server/utils/agent_checks/annotations/patch_api_projects_project_id_edit_kiln_task_tool_tool_server_id.json b/libs/server/kiln_server/utils/agent_checks/annotations/patch_api_projects_project_id_edit_kiln_task_tool_tool_server_id.json index 4f6e04f59..7e4aaa0dc 100644 --- a/libs/server/kiln_server/utils/agent_checks/annotations/patch_api_projects_project_id_edit_kiln_task_tool_tool_server_id.json +++ b/libs/server/kiln_server/utils/agent_checks/annotations/patch_api_projects_project_id_edit_kiln_task_tool_tool_server_id.json @@ -2,7 +2,8 @@ "method": "patch", "path": "/api/projects/{project_id}/edit_kiln_task_tool/{tool_server_id}", "agent_policy": { - "permission": "deny", - "requires_approval": false + "permission": "allow", + "requires_approval": true, + "approval_description": "Edit a Kiln task tool (also called a sub-agent), including its name, description, underlying task, or run config." } } diff --git a/libs/server/kiln_server/utils/agent_checks/annotations/post_api_projects_project_id_kiln_task_tool.json b/libs/server/kiln_server/utils/agent_checks/annotations/post_api_projects_project_id_kiln_task_tool.json index 9bd388f49..6d92ffeff 100644 --- a/libs/server/kiln_server/utils/agent_checks/annotations/post_api_projects_project_id_kiln_task_tool.json +++ b/libs/server/kiln_server/utils/agent_checks/annotations/post_api_projects_project_id_kiln_task_tool.json @@ -2,7 +2,8 @@ "method": "post", "path": "/api/projects/{project_id}/kiln_task_tool", "agent_policy": { - "permission": "deny", - "requires_approval": false + "permission": "allow", + "requires_approval": true, + "approval_description": "Register a Kiln task as a tool (also called a sub-agent), making it callable by other agents and run configs." } }