From e317a9c18a90566da4048a71db5279938eca7362 Mon Sep 17 00:00:00 2001 From: abhi1992002 Date: Thu, 5 Feb 2026 16:10:09 +0530 Subject: [PATCH] feat(chat): Add tool response schema endpoint for OpenAPI code generation - Introduced a new endpoint `/api/chat/schema/tool-responses` to expose tool response models for frontend code generation. - Defined a `ToolResponseUnion` type that aggregates various response models, enhancing type safety and clarity in API responses. - Updated OpenAPI schema to include detailed descriptions and response structures for the new endpoint. - Added `AgentDetailsResponse` and other related schemas to improve agent information handling. --- .../backend/api/features/chat/routes.py | 62 ++ .../frontend/src/app/api/openapi.json | 930 ++++++++++++++++++ 2 files changed, 992 insertions(+) diff --git a/autogpt_platform/backend/backend/api/features/chat/routes.py b/autogpt_platform/backend/backend/api/features/chat/routes.py index 3e731d86ac..2cb17ae397 100644 --- a/autogpt_platform/backend/backend/api/features/chat/routes.py +++ b/autogpt_platform/backend/backend/api/features/chat/routes.py @@ -18,6 +18,29 @@ from .completion_handler import process_operation_failure, process_operation_suc from .config import ChatConfig from .model import ChatSession, create_chat_session, get_chat_session, get_user_sessions from .response_model import StreamFinish, StreamHeartbeat, StreamStart +from .tools.models import ( + AgentDetailsResponse, + AgentOutputResponse, + AgentPreviewResponse, + AgentSavedResponse, + AgentsFoundResponse, + BlockListResponse, + BlockOutputResponse, + ClarificationNeededResponse, + DocPageResponse, + DocSearchResultsResponse, + ErrorResponse, + ExecutionStartedResponse, + InputValidationErrorResponse, + NeedLoginResponse, + NoResultsResponse, + OperationInProgressResponse, + OperationPendingResponse, + OperationStartedResponse, + ResponseType, + SetupRequirementsResponse, + UnderstandingUpdatedResponse, +) config = ChatConfig() @@ -751,3 +774,42 @@ async def health_check() -> dict: "service": "chat", "version": "0.1.0", } + + +# ========== Schema Export (for OpenAPI / Orval codegen) ========== + +ToolResponseUnion = ( + AgentsFoundResponse + | NoResultsResponse + | AgentDetailsResponse + | SetupRequirementsResponse + | ExecutionStartedResponse + | NeedLoginResponse + | ErrorResponse + | InputValidationErrorResponse + | AgentOutputResponse + | UnderstandingUpdatedResponse + | AgentPreviewResponse + | AgentSavedResponse + | ClarificationNeededResponse + | BlockListResponse + | BlockOutputResponse + | DocSearchResultsResponse + | DocPageResponse + | OperationStartedResponse + | OperationPendingResponse + | OperationInProgressResponse +) + + +@router.get( + "/schema/tool-responses", + response_model=ToolResponseUnion, + include_in_schema=True, + summary="[Dummy] Tool response type export for codegen", + description="This endpoint is not meant to be called. It exists solely to " + "expose tool response models in the OpenAPI schema for frontend codegen.", +) +async def _tool_response_schema() -> ToolResponseUnion: # type: ignore[return] + """Never called at runtime. Exists only so Orval generates TS types.""" + raise HTTPException(status_code=501, detail="Schema-only endpoint") diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json index 5ed449829d..f269f432f2 100644 --- a/autogpt_platform/frontend/src/app/api/openapi.json +++ b/autogpt_platform/frontend/src/app/api/openapi.json @@ -1018,6 +1018,58 @@ } } }, + "/api/chat/schema/tool-responses": { + "get": { + "tags": ["v2", "chat", "chat"], + "summary": "[Dummy] Tool response type export for codegen", + "description": "This endpoint is not meant to be called. It exists solely to expose tool response models in the OpenAPI schema for frontend codegen.", + "operationId": "getV2[dummy] tool response type export for codegen", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { "$ref": "#/components/schemas/AgentsFoundResponse" }, + { "$ref": "#/components/schemas/NoResultsResponse" }, + { "$ref": "#/components/schemas/AgentDetailsResponse" }, + { + "$ref": "#/components/schemas/SetupRequirementsResponse" + }, + { "$ref": "#/components/schemas/ExecutionStartedResponse" }, + { "$ref": "#/components/schemas/NeedLoginResponse" }, + { "$ref": "#/components/schemas/ErrorResponse" }, + { + "$ref": "#/components/schemas/InputValidationErrorResponse" + }, + { "$ref": "#/components/schemas/AgentOutputResponse" }, + { + "$ref": "#/components/schemas/UnderstandingUpdatedResponse" + }, + { "$ref": "#/components/schemas/AgentPreviewResponse" }, + { "$ref": "#/components/schemas/AgentSavedResponse" }, + { + "$ref": "#/components/schemas/ClarificationNeededResponse" + }, + { "$ref": "#/components/schemas/BlockListResponse" }, + { "$ref": "#/components/schemas/BlockOutputResponse" }, + { "$ref": "#/components/schemas/DocSearchResultsResponse" }, + { "$ref": "#/components/schemas/DocPageResponse" }, + { "$ref": "#/components/schemas/OperationStartedResponse" }, + { "$ref": "#/components/schemas/OperationPendingResponse" }, + { + "$ref": "#/components/schemas/OperationInProgressResponse" + } + ], + "title": "Response Getv2[Dummy] Tool Response Type Export For Codegen" + } + } + } + } + } + } + }, "/api/chat/sessions": { "get": { "tags": ["v2", "chat", "chat"], @@ -6356,6 +6408,75 @@ "required": ["new_balance", "transaction_key"], "title": "AddUserCreditsResponse" }, + "AgentDetails": { + "properties": { + "id": { "type": "string", "title": "Id" }, + "name": { "type": "string", "title": "Name" }, + "description": { "type": "string", "title": "Description" }, + "in_library": { + "type": "boolean", + "title": "In Library", + "default": false + }, + "inputs": { + "additionalProperties": true, + "type": "object", + "title": "Inputs", + "default": {} + }, + "credentials": { + "items": { "$ref": "#/components/schemas/CredentialsMetaInput" }, + "type": "array", + "title": "Credentials", + "default": [] + }, + "execution_options": { + "$ref": "#/components/schemas/ExecutionOptions" + }, + "trigger_info": { + "anyOf": [ + { "additionalProperties": true, "type": "object" }, + { "type": "null" } + ], + "title": "Trigger Info" + } + }, + "type": "object", + "required": ["id", "name", "description"], + "title": "AgentDetails", + "description": "Detailed agent information." + }, + "AgentDetailsResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "agent_details" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "agent": { "$ref": "#/components/schemas/AgentDetails" }, + "user_authenticated": { + "type": "boolean", + "title": "User Authenticated", + "default": false + }, + "graph_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Graph Id" + }, + "graph_version": { + "anyOf": [{ "type": "integer" }, { "type": "null" }], + "title": "Graph Version" + } + }, + "type": "object", + "required": ["message", "agent"], + "title": "AgentDetailsResponse", + "description": "Response for get_details action." + }, "AgentExecutionStatus": { "type": "string", "enum": [ @@ -6369,6 +6490,224 @@ ], "title": "AgentExecutionStatus" }, + "AgentInfo": { + "properties": { + "id": { "type": "string", "title": "Id" }, + "name": { "type": "string", "title": "Name" }, + "description": { "type": "string", "title": "Description" }, + "source": { + "type": "string", + "title": "Source", + "description": "marketplace or library" + }, + "in_library": { + "type": "boolean", + "title": "In Library", + "default": false + }, + "creator": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Creator" + }, + "category": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Category" + }, + "rating": { + "anyOf": [{ "type": "number" }, { "type": "null" }], + "title": "Rating" + }, + "runs": { + "anyOf": [{ "type": "integer" }, { "type": "null" }], + "title": "Runs" + }, + "is_featured": { + "anyOf": [{ "type": "boolean" }, { "type": "null" }], + "title": "Is Featured" + }, + "status": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Status" + }, + "can_access_graph": { + "anyOf": [{ "type": "boolean" }, { "type": "null" }], + "title": "Can Access Graph" + }, + "has_external_trigger": { + "anyOf": [{ "type": "boolean" }, { "type": "null" }], + "title": "Has External Trigger" + }, + "new_output": { + "anyOf": [{ "type": "boolean" }, { "type": "null" }], + "title": "New Output" + }, + "graph_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Graph Id" + }, + "inputs": { + "anyOf": [ + { "additionalProperties": true, "type": "object" }, + { "type": "null" } + ], + "title": "Inputs", + "description": "Input schema for the agent, including field names, types, and defaults" + } + }, + "type": "object", + "required": ["id", "name", "description", "source"], + "title": "AgentInfo", + "description": "Information about an agent." + }, + "AgentOutputResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "agent_output" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "agent_name": { "type": "string", "title": "Agent Name" }, + "agent_id": { "type": "string", "title": "Agent Id" }, + "library_agent_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Library Agent Id" + }, + "library_agent_link": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Library Agent Link" + }, + "execution": { + "anyOf": [ + { "$ref": "#/components/schemas/ExecutionOutputInfo" }, + { "type": "null" } + ] + }, + "available_executions": { + "anyOf": [ + { + "items": { "additionalProperties": true, "type": "object" }, + "type": "array" + }, + { "type": "null" } + ], + "title": "Available Executions" + }, + "total_executions": { + "type": "integer", + "title": "Total Executions", + "default": 0 + } + }, + "type": "object", + "required": ["message", "agent_name", "agent_id"], + "title": "AgentOutputResponse", + "description": "Response for agent_output tool." + }, + "AgentPreviewResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "agent_preview" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "agent_json": { + "additionalProperties": true, + "type": "object", + "title": "Agent Json" + }, + "agent_name": { "type": "string", "title": "Agent Name" }, + "description": { "type": "string", "title": "Description" }, + "node_count": { "type": "integer", "title": "Node Count" }, + "link_count": { + "type": "integer", + "title": "Link Count", + "default": 0 + } + }, + "type": "object", + "required": [ + "message", + "agent_json", + "agent_name", + "description", + "node_count" + ], + "title": "AgentPreviewResponse", + "description": "Response for previewing a generated agent before saving." + }, + "AgentSavedResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "agent_saved" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "agent_id": { "type": "string", "title": "Agent Id" }, + "agent_name": { "type": "string", "title": "Agent Name" }, + "library_agent_id": { "type": "string", "title": "Library Agent Id" }, + "library_agent_link": { + "type": "string", + "title": "Library Agent Link" + }, + "agent_page_link": { "type": "string", "title": "Agent Page Link" } + }, + "type": "object", + "required": [ + "message", + "agent_id", + "agent_name", + "library_agent_id", + "library_agent_link", + "agent_page_link" + ], + "title": "AgentSavedResponse", + "description": "Response when an agent is saved to the library." + }, + "AgentsFoundResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "agents_found" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "title": { + "type": "string", + "title": "Title", + "default": "Available Agents" + }, + "agents": { + "items": { "$ref": "#/components/schemas/AgentInfo" }, + "type": "array", + "title": "Agents" + }, + "count": { "type": "integer", "title": "Count" }, + "name": { + "type": "string", + "title": "Name", + "default": "agents_found" + } + }, + "type": "object", + "required": ["message", "agents", "count"], + "title": "AgentsFoundResponse", + "description": "Response for find_agent tool." + }, "ApiResponse": { "properties": { "answer": { "type": "string", "title": "Answer" }, @@ -6691,6 +7030,120 @@ ], "title": "BlockInfo" }, + "BlockInfoSummary": { + "properties": { + "id": { "type": "string", "title": "Id" }, + "name": { "type": "string", "title": "Name" }, + "description": { "type": "string", "title": "Description" }, + "categories": { + "items": { "type": "string" }, + "type": "array", + "title": "Categories" + }, + "input_schema": { + "additionalProperties": true, + "type": "object", + "title": "Input Schema" + }, + "output_schema": { + "additionalProperties": true, + "type": "object", + "title": "Output Schema" + }, + "required_inputs": { + "items": { "$ref": "#/components/schemas/BlockInputFieldInfo" }, + "type": "array", + "title": "Required Inputs", + "description": "List of required input fields for this block" + } + }, + "type": "object", + "required": [ + "id", + "name", + "description", + "categories", + "input_schema", + "output_schema" + ], + "title": "BlockInfoSummary", + "description": "Summary of a block for search results." + }, + "BlockInputFieldInfo": { + "properties": { + "name": { "type": "string", "title": "Name" }, + "type": { "type": "string", "title": "Type" }, + "description": { + "type": "string", + "title": "Description", + "default": "" + }, + "required": { + "type": "boolean", + "title": "Required", + "default": false + }, + "default": { "anyOf": [{}, { "type": "null" }], "title": "Default" } + }, + "type": "object", + "required": ["name", "type"], + "title": "BlockInputFieldInfo", + "description": "Information about a block input field." + }, + "BlockListResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "block_list" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "blocks": { + "items": { "$ref": "#/components/schemas/BlockInfoSummary" }, + "type": "array", + "title": "Blocks" + }, + "count": { "type": "integer", "title": "Count" }, + "query": { "type": "string", "title": "Query" }, + "usage_hint": { + "type": "string", + "title": "Usage Hint", + "default": "To execute a block, call run_block with block_id set to the block's 'id' field and input_data containing the required fields from input_schema." + } + }, + "type": "object", + "required": ["message", "blocks", "count", "query"], + "title": "BlockListResponse", + "description": "Response for find_block tool." + }, + "BlockOutputResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "block_output" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "block_id": { "type": "string", "title": "Block Id" }, + "block_name": { "type": "string", "title": "Block Name" }, + "outputs": { + "additionalProperties": { "items": {}, "type": "array" }, + "type": "object", + "title": "Outputs" + }, + "success": { "type": "boolean", "title": "Success", "default": true } + }, + "type": "object", + "required": ["message", "block_id", "block_name", "outputs"], + "title": "BlockOutputResponse", + "description": "Response for run_block tool." + }, "BlockResponse": { "properties": { "blocks": { @@ -6937,6 +7390,42 @@ "required": ["query", "conversation_history", "message_id"], "title": "ChatRequest" }, + "ClarificationNeededResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "clarification_needed" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "questions": { + "items": { "$ref": "#/components/schemas/ClarifyingQuestion" }, + "type": "array", + "title": "Questions" + } + }, + "type": "object", + "required": ["message"], + "title": "ClarificationNeededResponse", + "description": "Response when the LLM needs more information from the user." + }, + "ClarifyingQuestion": { + "properties": { + "question": { "type": "string", "title": "Question" }, + "keyword": { "type": "string", "title": "Keyword" }, + "example": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Example" + } + }, + "type": "object", + "required": ["question", "keyword"], + "title": "ClarifyingQuestion", + "description": "A question that needs user clarification." + }, "CountResponse": { "properties": { "all_blocks": { "type": "integer", "title": "All Blocks" }, @@ -7195,6 +7684,71 @@ "required": ["version_counts"], "title": "DeleteGraphResponse" }, + "DocPageResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "doc_page" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "title": { "type": "string", "title": "Title" }, + "path": { "type": "string", "title": "Path" }, + "content": { "type": "string", "title": "Content" }, + "doc_url": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Doc Url" + } + }, + "type": "object", + "required": ["message", "title", "path", "content"], + "title": "DocPageResponse", + "description": "Response for get_doc_page tool." + }, + "DocSearchResult": { + "properties": { + "title": { "type": "string", "title": "Title" }, + "path": { "type": "string", "title": "Path" }, + "section": { "type": "string", "title": "Section" }, + "snippet": { "type": "string", "title": "Snippet" }, + "score": { "type": "number", "title": "Score" }, + "doc_url": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Doc Url" + } + }, + "type": "object", + "required": ["title", "path", "section", "snippet", "score"], + "title": "DocSearchResult", + "description": "A single documentation search result." + }, + "DocSearchResultsResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "doc_search_results" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "results": { + "items": { "$ref": "#/components/schemas/DocSearchResult" }, + "type": "array", + "title": "Results" + }, + "count": { "type": "integer", "title": "Count" }, + "query": { "type": "string", "title": "Query" } + }, + "type": "object", + "required": ["message", "results", "count", "query"], + "title": "DocSearchResultsResponse", + "description": "Response for search_docs tool." + }, "Document": { "properties": { "url": { "type": "string", "title": "Url" }, @@ -7204,6 +7758,34 @@ "required": ["url", "relevance_score"], "title": "Document" }, + "ErrorResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "error" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "error": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Error" + }, + "details": { + "anyOf": [ + { "additionalProperties": true, "type": "object" }, + { "type": "null" } + ], + "title": "Details" + } + }, + "type": "object", + "required": ["message"], + "title": "ErrorResponse", + "description": "Response for errors." + }, "ExecutionAnalyticsConfig": { "properties": { "available_models": { @@ -7380,6 +7962,85 @@ ], "title": "ExecutionAnalyticsResult" }, + "ExecutionOptions": { + "properties": { + "manual": { "type": "boolean", "title": "Manual", "default": true }, + "scheduled": { + "type": "boolean", + "title": "Scheduled", + "default": true + }, + "webhook": { "type": "boolean", "title": "Webhook", "default": false } + }, + "type": "object", + "title": "ExecutionOptions", + "description": "Available execution options for an agent." + }, + "ExecutionOutputInfo": { + "properties": { + "execution_id": { "type": "string", "title": "Execution Id" }, + "status": { "type": "string", "title": "Status" }, + "started_at": { + "anyOf": [ + { "type": "string", "format": "date-time" }, + { "type": "null" } + ], + "title": "Started At" + }, + "ended_at": { + "anyOf": [ + { "type": "string", "format": "date-time" }, + { "type": "null" } + ], + "title": "Ended At" + }, + "outputs": { + "additionalProperties": { "items": {}, "type": "array" }, + "type": "object", + "title": "Outputs" + }, + "inputs_summary": { + "anyOf": [ + { "additionalProperties": true, "type": "object" }, + { "type": "null" } + ], + "title": "Inputs Summary" + } + }, + "type": "object", + "required": ["execution_id", "status", "outputs"], + "title": "ExecutionOutputInfo", + "description": "Summary of a single execution's outputs." + }, + "ExecutionStartedResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "execution_started" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "execution_id": { "type": "string", "title": "Execution Id" }, + "graph_id": { "type": "string", "title": "Graph Id" }, + "graph_name": { "type": "string", "title": "Graph Name" }, + "library_agent_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Library Agent Id" + }, + "library_agent_link": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Library Agent Link" + }, + "status": { "type": "string", "title": "Status", "default": "QUEUED" } + }, + "type": "object", + "required": ["message", "execution_id", "graph_id", "graph_name"], + "title": "ExecutionStartedResponse", + "description": "Response for run/schedule actions." + }, "Graph": { "properties": { "id": { "type": "string", "title": "Id" }, @@ -8088,6 +8749,43 @@ "required": ["provider", "host"], "title": "HostScopedCredentials" }, + "InputValidationErrorResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "input_validation_error" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "unrecognized_fields": { + "items": { "type": "string" }, + "type": "array", + "title": "Unrecognized Fields", + "description": "List of input field names that were not recognized" + }, + "inputs": { + "additionalProperties": true, + "type": "object", + "title": "Inputs", + "description": "The agent's valid input schema for reference" + }, + "graph_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Graph Id" + }, + "graph_version": { + "anyOf": [{ "type": "integer" }, { "type": "null" }], + "title": "Graph Version" + } + }, + "type": "object", + "required": ["message", "unrecognized_fields", "inputs"], + "title": "InputValidationErrorResponse", + "description": "Response when run_agent receives unknown input fields." + }, "LibraryAgent": { "properties": { "id": { "type": "string", "title": "Id" }, @@ -8606,6 +9304,54 @@ "required": ["agents", "pagination"], "title": "MyAgentsResponse" }, + "NeedLoginResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "need_login" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "agent_info": { + "anyOf": [ + { "additionalProperties": true, "type": "object" }, + { "type": "null" } + ], + "title": "Agent Info" + } + }, + "type": "object", + "required": ["message"], + "title": "NeedLoginResponse", + "description": "Response when login is needed." + }, + "NoResultsResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "no_results" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "suggestions": { + "items": { "type": "string" }, + "type": "array", + "title": "Suggestions", + "default": [] + }, + "name": { "type": "string", "title": "Name", "default": "no_results" } + }, + "type": "object", + "required": ["message"], + "title": "NoResultsResponse", + "description": "Response when no agents found." + }, "Node": { "properties": { "id": { "type": "string", "title": "Id" }, @@ -9023,6 +9769,66 @@ "title": "OperationCompleteRequest", "description": "Request model for external completion webhook." }, + "OperationInProgressResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "operation_in_progress" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "tool_call_id": { "type": "string", "title": "Tool Call Id" } + }, + "type": "object", + "required": ["message", "tool_call_id"], + "title": "OperationInProgressResponse", + "description": "Response when an operation is already in progress.\n\nReturned for idempotency when the same tool_call_id is requested again\nwhile the background task is still running." + }, + "OperationPendingResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "operation_pending" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "operation_id": { "type": "string", "title": "Operation Id" }, + "tool_name": { "type": "string", "title": "Tool Name" } + }, + "type": "object", + "required": ["message", "operation_id", "tool_name"], + "title": "OperationPendingResponse", + "description": "Response stored in chat history while a long-running operation is executing.\n\nThis is persisted to the database so users see a pending state when they\nrefresh before the operation completes." + }, + "OperationStartedResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "operation_started" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "operation_id": { "type": "string", "title": "Operation Id" }, + "tool_name": { "type": "string", "title": "Tool Name" }, + "task_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Task Id" + } + }, + "type": "object", + "required": ["message", "operation_id", "tool_name"], + "title": "OperationStartedResponse", + "description": "Response when a long-running operation has been started in the background.\n\nThis is returned immediately to the client while the operation continues\nto execute. The user can close the tab and check back later.\n\nThe task_id can be used to reconnect to the SSE stream via\nGET /chat/tasks/{task_id}/stream?last_idx=0" + }, "Pagination": { "properties": { "total_items": { @@ -9654,6 +10460,38 @@ "required": ["credit_amount"], "title": "RequestTopUp" }, + "ResponseType": { + "type": "string", + "enum": [ + "agents_found", + "agent_details", + "setup_requirements", + "execution_started", + "need_login", + "error", + "no_results", + "agent_output", + "understanding_updated", + "agent_preview", + "agent_saved", + "clarification_needed", + "block_list", + "block_output", + "doc_search_results", + "doc_page", + "workspace_file_list", + "workspace_file_content", + "workspace_file_metadata", + "workspace_file_written", + "workspace_file_deleted", + "operation_started", + "operation_pending", + "operation_in_progress", + "input_validation_error" + ], + "title": "ResponseType", + "description": "Types of tool responses." + }, "ReviewItem": { "properties": { "node_exec_id": { @@ -9917,6 +10755,48 @@ "required": ["active_graph_version"], "title": "SetGraphActiveVersion" }, + "SetupInfo": { + "properties": { + "agent_id": { "type": "string", "title": "Agent Id" }, + "agent_name": { "type": "string", "title": "Agent Name" }, + "requirements": { + "additionalProperties": { "items": {}, "type": "array" }, + "type": "object", + "title": "Requirements" + }, + "user_readiness": { "$ref": "#/components/schemas/UserReadiness" } + }, + "type": "object", + "required": ["agent_id", "agent_name"], + "title": "SetupInfo", + "description": "Complete setup information." + }, + "SetupRequirementsResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "setup_requirements" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "setup_info": { "$ref": "#/components/schemas/SetupInfo" }, + "graph_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Graph Id" + }, + "graph_version": { + "anyOf": [{ "type": "integer" }, { "type": "null" }], + "title": "Graph Version" + } + }, + "type": "object", + "required": ["message", "setup_info"], + "title": "SetupRequirementsResponse", + "description": "Response for validate action." + }, "ShareRequest": { "properties": {}, "type": "object", @@ -11313,6 +12193,33 @@ "required": ["name", "graph_id", "graph_version", "trigger_config"], "title": "TriggeredPresetSetupRequest" }, + "UnderstandingUpdatedResponse": { + "properties": { + "type": { + "$ref": "#/components/schemas/ResponseType", + "default": "understanding_updated" + }, + "message": { "type": "string", "title": "Message" }, + "session_id": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Session Id" + }, + "updated_fields": { + "items": { "type": "string" }, + "type": "array", + "title": "Updated Fields" + }, + "current_understanding": { + "additionalProperties": true, + "type": "object", + "title": "Current Understanding" + } + }, + "type": "object", + "required": ["message"], + "title": "UnderstandingUpdatedResponse", + "description": "Response for add_understanding tool." + }, "UnifiedSearchResponse": { "properties": { "results": { @@ -12191,6 +13098,29 @@ "required": ["provider", "username", "password"], "title": "UserPasswordCredentials" }, + "UserReadiness": { + "properties": { + "has_all_credentials": { + "type": "boolean", + "title": "Has All Credentials", + "default": false + }, + "missing_credentials": { + "additionalProperties": true, + "type": "object", + "title": "Missing Credentials", + "default": {} + }, + "ready_to_run": { + "type": "boolean", + "title": "Ready To Run", + "default": false + } + }, + "type": "object", + "title": "UserReadiness", + "description": "User readiness status." + }, "UserTransaction": { "properties": { "transaction_key": {