{ "openapi": "3.0.0", "info": { "version": "3.0.0", "title": "AI Agents API", "description": "API for configuring and invoking AI agents in epilot platform", "termsOfService": "https://epilot.cloud/agb", "contact": { "name": "Support", "email": "info@epilot.cloud", "url": "https://help.epilot.cloud" } }, "security": [ { "EpilotAuth": [] } ], "servers": [ { "url": "https://ai-agents.sls.epilot.io" } ], "tags": [ { "name": "Agents Configuration", "description": "Everything about AI Agent configuration" }, { "name": "Customer Chat", "description": "Org-scoped configuration for website and portal chat agents" }, { "name": "Agent Execution", "description": "Execute AI agents and manage executions" }, { "name": "Chat", "description": "Streaming chat with AI agents" }, { "name": "Conversations", "description": "Manage conversation history" }, { "name": "Knowledge", "description": "Manage knowledge sources used by custom agents" }, { "name": "Sessions", "description": "Agents API v2 durable agent sessions, used by the Luna panel and the epilot MCP; currently deployed on dev only" } ], "paths": { "/v1/agents": { "post": { "tags": [ "Agents Configuration" ], "summary": "Create Agent definition", "description": "Creates a new custom agent. System skills cannot be created via this endpoint.", "operationId": "createAgent", "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAgentRequest" } } } }, "responses": { "201": { "description": "Agent Created Successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentDefinition" } } } }, "400": { "description": "Error while creating the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "get": { "tags": [ "Agents Configuration" ], "summary": "List all agent configurations", "description": "Lists agents from both system skills and custom agents.\nUse query parameters to filter by source, availability, or entity schema.\n", "operationId": "listAgents", "parameters": [ { "name": "source", "in": "query", "schema": { "$ref": "#/components/schemas/AgentSource" }, "description": "Filter by agent source (system = pre-built skills, custom = user-created)" }, { "name": "availability", "in": "query", "schema": { "$ref": "#/components/schemas/SkillAvailability" }, "description": "Filter by availability context (flows, copilot)" }, { "name": "entity_schema", "in": "query", "schema": { "type": "string" }, "description": "Filter by allowed entity schema (e.g., \"message\" for email-related skills)" } ], "responses": { "200": { "description": "List of agents", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListAgentsResponse" } } } }, "400": { "description": "Error fetching the agent configs", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/agents/{agent_id}": { "get": { "tags": [ "Agents Configuration" ], "summary": "Get the agent configuration by ID", "description": "Retrieves an agent by ID. Supports both:\n- System skill IDs (prefixed): \"skill:email-categorizer\"\n- Custom agent IDs (UUID): \"0336a235-9417-4dd8-894c-fe81285bba75\"\n", "operationId": "getAgentById", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/AgentId" } } ], "responses": { "200": { "description": "Agent fetched Successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentDefinition" } } } }, "400": { "description": "Error while creating the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "tags": [ "Agents Configuration" ], "summary": "Update the agent configuration by ID", "description": "Updates a custom agent. System skills cannot be updated via this endpoint.", "operationId": "updateAgentById", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/AgentId" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAgentRequest" } } } }, "responses": { "200": { "description": "Agent updated Successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentDefinition" } } } }, "400": { "description": "Error while updating the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "Agent changed during the update; retry the request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": [ "Agents Configuration" ], "summary": "Delete the agent configuration by ID", "description": "Deletes a custom agent. System skills cannot be deleted via this endpoint.", "security": [ { "EpilotAuth": [] } ], "operationId": "deleteAgentById", "parameters": [ { "name": "agent_id", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/AgentId" } } ], "responses": { "204": { "description": "Agent deleted Successfully" }, "400": { "description": "Error while deleting the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/agents/{agent_id}/agent-auth": { "parameters": [ { "name": "agent_id", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/AgentId" } } ], "get": { "tags": [ "Agents Configuration" ], "summary": "Get the agent's identity for Flows runs", "description": "The agent's own identity for runs started by Flows (internal auth): an autonomous Agent Auth agent at the\nAccess Token API, owned by the admin who activated it. `inactive` when none was activated; `expired` once\nits lifetime (90 days) is over. Runs of an agent with an activation (behind the `agent-flows-identity`\norganization flag) mint their tokens from it instead of using the platform service token, and fail with\n`AGENT_IDENTITY_EXPIRED` when it has expired or was revoked.\n", "operationId": "getAgentAuth", "security": [ { "EpilotAuth": [] } ], "responses": { "200": { "description": "The agent's identity status", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentAuthStatus" } } } }, "400": { "description": "Not a custom agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "tags": [ "Agents Configuration" ], "summary": "Activate the agent's identity for Flows runs", "description": "Registers a new autonomous agent for this custom agent at the Access Token API (90 days) and stores the\nactivation on the agent. The caller must be a 360 user calling with their login token in their login\norganization, allowed `token:create`; they become the agent's owner, and the agent acts with the owner's\ncurrent roles under `access_profile`. Activating again replaces (and revokes) the previous activation.\nAvailable only while the PostHog flag `agent-flows-identity` is on for the organization; otherwise `403`\nwith `code: FEATURE_DISABLED` (`GET` and `DELETE` stay available).\n", "operationId": "activateAgentAuth", "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentAuthActivationRequest" } } } }, "responses": { "200": { "description": "The activated identity", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentAuthStatus" } } } }, "400": { "description": "Invalid request, or not a custom agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "403": { "description": "`code: FEATURE_DISABLED`: `agent-flows-identity` is off for the organization. Otherwise not a 360 user's\nlogin token, another organization, or not allowed `token:create`.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "The agent's identity was activated or deactivated by someone else meanwhile; the agent registered by\nthis request was revoked. Reload the status and try again.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "502": { "description": "The Access Token API did not register the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": [ "Agents Configuration" ], "summary": "Deactivate the agent's identity for Flows runs", "description": "Revokes the agent's autonomous agent at the Access Token API (with every token it issued) and removes the\nactivation. Needs `token:create`. Later Flows runs use the platform service token again.\n", "operationId": "deactivateAgentAuth", "security": [ { "EpilotAuth": [] } ], "responses": { "204": { "description": "Deactivated (or there was nothing to deactivate)" }, "400": { "description": "Not a custom agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "403": { "description": "Not allowed `token:create`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "502": { "description": "The Access Token API did not revoke the agent; the activation is kept", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/customer-chat": { "get": { "tags": [ "Customer Chat" ], "summary": "List customer chat agents", "description": "Returns the org's website agent (at most one) first, then its portal agents ordered by created_at ascending.", "operationId": "listCustomerChat", "security": [ { "EpilotAuth": [] } ], "responses": { "200": { "description": "Customer Chat agents", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListCustomerChatResponse" } } } }, "400": { "description": "Error listing customer chat", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "post": { "tags": [ "Customer Chat" ], "summary": "Create a customer chat agent with default config", "description": "Mints agent_id (equal to runtime_agent_id) and compiles the runtime AgentRecord. An org can have at most one website agent (409 on a second one) and any number of portal agents.", "operationId": "createCustomerChatAgent", "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateCustomerChatAgentRequest" } } } }, "responses": { "201": { "description": "Customer Chat agent created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerChatAgent" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "The org already has a website agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/customer-chat/capabilities": { "get": { "tags": [ "Customer Chat" ], "summary": "List the capability catalog", "description": "Capabilities admins can enable and the places they are offered on.\nSingle source of truth for Agent Builder; capabilities that are no\nlonger offered are omitted, while already-enabled instances of them\nkeep working.\n", "operationId": "listCustomerChatCapabilities", "security": [ { "EpilotAuth": [] } ], "responses": { "200": { "description": "Capability catalog", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListCustomerChatCapabilitiesResponse" } } } } } } }, "/v1/customer-chat/{agent_id}": { "get": { "tags": [ "Customer Chat" ], "summary": "Get a customer chat agent", "operationId": "getCustomerChatAgent", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/CustomerChatAgentIdPath" } ], "responses": { "200": { "description": "Customer Chat agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerChatAgent" } } } }, "404": { "description": "Customer Chat agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "patch": { "tags": [ "Customer Chat" ], "summary": "Rename a customer chat agent", "operationId": "renameCustomerChatAgent", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/CustomerChatAgentIdPath" }, { "$ref": "#/components/parameters/IfMatchUpdatedAt" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RenameCustomerChatAgentRequest" } } } }, "responses": { "200": { "description": "Customer Chat agent renamed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerChatAgent" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Customer Chat agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "Stale update", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": [ "Customer Chat" ], "summary": "Remove a customer chat agent and its runtime projection", "description": "Deletes the place agent. For portal agents, also clears\n`feature_settings.portal_copilot_agent_id` on linked portals (pass\n`portal_id` when known, otherwise the API scans org portal configs)\nbefore deleting, so a single request cannot leave an orphan agent.\n", "operationId": "deleteCustomerChatAgent", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/CustomerChatAgentIdPath" }, { "$ref": "#/components/parameters/IfMatchUpdatedAt" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteCustomerChatAgentRequest" } } } }, "responses": { "204": { "description": "Customer Chat agent deleted" }, "404": { "description": "Customer Chat agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "Stale update", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/customer-chat/{agent_id}/config": { "put": { "tags": [ "Customer Chat" ], "summary": "Replace the AgentConfig and compile the runtime AgentRecord", "operationId": "saveCustomerChatConfig", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/CustomerChatAgentIdPath" }, { "$ref": "#/components/parameters/IfMatchUpdatedAt" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SaveCustomerChatConfigRequest" } } } }, "responses": { "200": { "description": "Config saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerChatAgent" } } } }, "400": { "description": "Invalid config", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Customer Chat agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "Stale update", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/customer-chat/{agent_id}/conversations": { "get": { "tags": [ "Customer Chat" ], "summary": "List a portal agent's conversations", "description": "Lists the conversations portal customers had with this agent, most recent first.\nRequires `entity:view` on contacts. With `has_ticket=true` a page can hold fewer\nthan `limit` conversations; keep following `next_cursor`. `from` and `to` narrow the\nlist to conversations last active in that period; keep them unchanged while following\n`next_cursor`.\n", "operationId": "listCustomerChatConversations", "x-epilot-permissions": [ { "action": "entity:view", "resource": "contact:*" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/CustomerChatAgentIdPath" }, { "name": "has_ticket", "in": "query", "schema": { "type": "boolean" }, "description": "Only conversations in which the agent created a ticket" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 } }, { "name": "cursor", "in": "query", "schema": { "type": "string" } }, { "name": "from", "in": "query", "schema": { "type": "string", "format": "date-time" }, "description": "Only conversations last active at or after this time" }, { "name": "to", "in": "query", "schema": { "type": "string", "format": "date-time" }, "description": "Only conversations last active at or before this time" } ], "responses": { "200": { "description": "The agent's conversations", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListCustomerChatConversationsResponse" } } } }, "403": { "description": "Not permitted to read customer conversations", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Portal agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/customer-chat/{agent_id}/conversations/{conversation_id}": { "get": { "tags": [ "Customer Chat" ], "summary": "Get a portal agent conversation transcript", "description": "Customer and agent messages of one conversation, oldest first. Requires `entity:view` on contacts.", "operationId": "getCustomerChatConversation", "x-epilot-permissions": [ { "action": "entity:view", "resource": "contact:*" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/CustomerChatAgentIdPath" }, { "name": "conversation_id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "The conversation and its transcript", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomerChatConversationTranscript" } } } }, "403": { "description": "Not permitted to read customer conversations", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Conversation not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/agents/{agent_id}/execute": { "post": { "tags": [ "Agent Execution" ], "summary": "Execute an agent", "description": "Executes an agent (system skill or custom agent).\nSupports both:\n- System skill IDs (prefixed): \"skill:email-categorizer\"\n- Custom agent IDs (UUID): \"0336a235-9417-4dd8-894c-fe81285bba75\"\n", "operationId": "executeAgent", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/AgentId" } } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecuteAgentRequest" } } } }, "responses": { "200": { "description": "Completed execution (`mode: sync`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionResponse" } } } }, "201": { "description": "Execution accepted; poll it by `execution_id`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionResponse" } } } }, "400": { "description": "Error while executing the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "422": { "description": "`mode: sync`: the input exceeds the model's context window (`error: INPUT_TOO_LONG`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "504": { "description": "`mode: sync`: the model did not answer within the request timeout (`error: TIMEOUT`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/agents/{agent_id}/execute/stream": { "post": { "tags": [ "Agent Execution" ], "summary": "Execute an agent with streaming response", "description": "Executes an agent with real-time streaming of tokens and tool events.\nReturns Server-Sent Events (SSE) stream with token-by-token output,\ntool call progress, and completion status.\n\nUnlike the async `/execute` endpoint which returns immediately with\nan execution_id for polling, this endpoint streams all events in real-time.\n\nSupports both:\n- System skill IDs (prefixed): \"skill:email-categorizer\"\n- Custom agent IDs (UUID): \"0336a235-9417-4dd8-894c-fe81285bba75\"\n", "operationId": "executeAgentStream", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/AgentId" } } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecuteAgentStreamRequest" } } } }, "responses": { "200": { "description": "SSE stream of execution events", "content": { "text/event-stream": { "schema": { "$ref": "#/components/schemas/StreamEvent" } } } }, "400": { "description": "Error while executing the agent", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions": { "get": { "tags": [ "Agent Execution" ], "summary": "List executions", "description": "Lists the executions of the caller's organization, optionally filtered by agent and status.\nWith a filter, a page can hold fewer than `limit` executions, or none, while more follow:\nkeep following `next_cursor` until it is null, with the same filters.\n", "operationId": "listExecutions", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "query", "schema": { "type": "string" }, "description": "Filter by agent ID" }, { "name": "status", "in": "query", "schema": { "$ref": "#/components/schemas/ExecutionStatus" }, "description": "Filter by status" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 50 }, "description": "Maximum number of executions to return. Values above 100 are capped at 100." }, { "name": "cursor", "in": "query", "schema": { "type": "string" }, "description": "`next_cursor` of the previous page" } ], "responses": { "200": { "description": "List of executions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListExecutionsResponse" } } } }, "400": { "description": "Error fetching executions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}": { "get": { "tags": [ "Agent Execution" ], "summary": "Get execution by ID", "description": "Get execution by ID", "operationId": "getExecution", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Execution details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionResponse" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": [ "Agent Execution" ], "summary": "Cancel execution", "description": "Cancel execution", "operationId": "cancelExecution", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Execution cancelled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionResponse" } } } }, "400": { "description": "Cannot cancel execution (already completed or failed)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}/trace": { "get": { "tags": [ "Agent Execution" ], "summary": "Get execution trace/iterations", "description": "Returns the step-by-step reasoning and tool calls for ReAct mode executions. Returns empty iterations array for direct mode executions.", "operationId": "getExecutionTrace", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Execution trace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionTrace" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}/screenshots": { "get": { "tags": [ "Agent Execution" ], "summary": "Get execution screenshots", "description": "The screenshots the execution's browser tools (`web.explore`, `web.screenshot`, `web.record`)\ntook, oldest first, as JPEG data URLs, so the people reviewing a result can see what the agent\nlooked at. Pass `after` to get only the screenshots from that index on while the execution runs.\n", "operationId": "getExecutionScreenshots", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "after", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 0 } } ], "responses": { "200": { "description": "Screenshots of the execution", "content": { "application/json": { "schema": { "type": "object", "properties": { "execution_id": { "type": "string" }, "screenshots": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "integer" }, "label": { "type": "string", "description": "What the screenshot shows, e.g. \"desktop, first screen\"" }, "kind": { "type": "string", "enum": [ "page", "cta", "logo", "heading" ], "description": "A page, or a close-up of the element a brand token is read from" }, "box": { "type": "object", "description": "Where a close-up sits on the page, in CSS pixels (the desktop first screen starts at 0,0)", "properties": { "x": { "type": "number" }, "y": { "type": "number" }, "width": { "type": "number" }, "height": { "type": "number" } } }, "page_url": { "type": "string" }, "tool": { "type": "string" }, "taken_at": { "type": "string", "format": "date-time" }, "data_url": { "type": "string", "description": "JPEG as a data URL" } }, "required": [ "index", "label", "kind", "page_url", "tool", "taken_at", "data_url" ] } } }, "required": [ "execution_id", "screenshots" ] } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}/feedback": { "get": { "tags": [ "Agent Execution" ], "summary": "Get execution feedback", "description": "Returns the authenticated user's feedback for an execution.", "operationId": "getExecutionFeedback", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Feedback state", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionFeedbackResponse" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "put": { "tags": [ "Agent Execution" ], "summary": "Submit execution feedback", "description": "Upserts thumbs up/down feedback and mirrors it to the execution's Langfuse trace.", "operationId": "putExecutionFeedback", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PutExecutionFeedbackRequest" } } } }, "responses": { "200": { "description": "Feedback recorded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionFeedbackResponse" } } } }, "400": { "description": "Invalid feedback", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "Execution cannot be rated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}/approve": { "post": { "tags": [ "Agent Execution" ], "summary": "Approve pending action", "description": "Approves a pending tool action when execution is in waiting_approval status", "operationId": "approveExecution", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApproveExecutionRequest" } } } }, "responses": { "200": { "description": "Action approved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionResponse" } } } }, "400": { "description": "No pending action to approve", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "403": { "description": "The caller may not approve this execution (code APPROVER_NOT_ALLOWED). Only with the PostHog flag agents-strict-approvals on for the organization: then only the user who started it, or internal auth, can decide; an agent token never can.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "The paused run cannot take this decision: code APPROVAL_EXPIRED when the approval wait already expired or was decided, code APPROVAL_NOT_SUPPORTED when the execution was paused by a streaming run, which cannot be resumed (cancel it instead).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}/reject": { "post": { "tags": [ "Agent Execution" ], "summary": "Reject pending action", "description": "Rejects a pending tool action when execution is in waiting_approval status", "operationId": "rejectExecution", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RejectExecutionRequest" } } } }, "responses": { "200": { "description": "Action rejected", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionResponse" } } } }, "400": { "description": "No pending action to reject", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "403": { "description": "The caller may not reject this execution (code APPROVER_NOT_ALLOWED). Only with the PostHog flag agents-strict-approvals on for the organization: then only the user who started it, or internal auth, can decide; an agent token never can.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "The paused run cannot take this decision: code APPROVAL_EXPIRED when the approval wait already expired or was decided, code APPROVAL_NOT_SUPPORTED when the execution was paused by a streaming run, which cannot be resumed (cancel it instead).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/executions/{execution_id}/stream": { "get": { "tags": [ "Agent Execution" ], "summary": "Reconnect to execution stream", "description": "Reconnects to an execution's event stream after approval. Replays missed events from event log and continues streaming if execution is still running.", "operationId": "streamExecution", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "execution_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "from_sequence", "in": "query", "schema": { "type": "integer" }, "description": "Resume from this event sequence number (for reconnection)" } ], "responses": { "200": { "description": "SSE stream of execution events", "content": { "text/event-stream": { "schema": { "$ref": "#/components/schemas/StreamEvent" } } } }, "404": { "description": "Execution not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/chat": { "post": { "tags": [ "Chat" ], "summary": "Streaming chat with AI agent", "description": "Initiates a streaming chat session with an AI agent. Supports server-side conversation memory via conversationId or client-provided history via clientHistory.", "operationId": "chat", "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatRequest" } } } }, "responses": { "200": { "description": "SSE stream of chat events", "content": { "text/event-stream": { "schema": { "$ref": "#/components/schemas/StreamEvent" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Agent not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/conversations": { "get": { "tags": [ "Conversations" ], "summary": "List conversations", "description": "Lists conversations for the authenticated user, sorted by most recent.", "operationId": "listConversations", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "query", "schema": { "type": "string" }, "description": "Filter by agent ID" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20 }, "description": "Maximum number of conversations to return" }, { "name": "cursor", "in": "query", "schema": { "type": "string" }, "description": "Pagination cursor" } ], "responses": { "200": { "description": "List of conversations", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListConversationsResponse" } } } }, "400": { "description": "Error fetching conversations", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/conversations/{conversation_id}": { "get": { "tags": [ "Conversations" ], "summary": "Get conversation with messages", "description": "Retrieves a conversation and its message history.", "operationId": "getConversation", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "message_limit", "in": "query", "schema": { "type": "integer", "default": 100 }, "description": "Maximum number of messages to return" } ], "responses": { "200": { "description": "Conversation with messages", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationWithMessages" } } } }, "404": { "description": "Conversation not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "tags": [ "Conversations" ], "summary": "Delete conversation", "description": "Deletes a conversation and all its messages.", "operationId": "deleteConversation", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "204": { "description": "Conversation deleted" }, "404": { "description": "Conversation not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v1/conversations/{conversation_id}/feedback": { "post": { "tags": [ "Conversations" ], "summary": "Submit feedback for an assistant turn", "description": "Records a thumbs up/down (with optional comment) for the assistant turn identified by its Langfuse trace id. The rating is persisted on the message and mirrored to Langfuse as a trace score.\n", "operationId": "submitConversationFeedback", "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubmitFeedbackRequest" } } } }, "responses": { "200": { "description": "Feedback recorded", "content": { "application/json": { "schema": { "type": "object", "properties": { "feedback": { "$ref": "#/components/schemas/MessageFeedback" } } } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Conversation or message not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/v2/portal/sessions": { "post": { "tags": [ "Portal Sessions" ], "summary": "Start a portal chat", "description": "An end customer signed in to a portal starts a chat with the portal's agent, optionally with their\nfirst message. The agent is the portal's chat as its settings name it (never the client's choice); it\nworks with the customer's own portal token. With a `requestId`, a retried request gets the chat its\nfirst attempt created.\n", "operationId": "createPortalSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatePortalSessionRequest" } } } }, "parameters": [ { "$ref": "#/components/parameters/PortalDomainQuery" } ], "responses": { "201": { "description": "The chat, and its events so far", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatedSession" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/SessionsNotEnabled" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" }, "503": { "$ref": "#/components/responses/PortalScreeningUnavailable" } } }, "get": { "tags": [ "Portal Sessions" ], "summary": "List the portal user's chats", "description": "The caller's own portal chats, most recently updated first.", "operationId": "listPortalSessions", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/PortalDomainQuery" }, { "name": "limit", "in": "query", "required": false, "description": "How many chats, at most 200", "schema": { "type": "integer", "minimum": 1, "default": 30 } }, { "name": "before", "in": "query", "required": false, "description": "Only chats updated before this time (the last listed chat's `updatedAt`)", "schema": { "type": "string", "format": "date-time" } } ], "responses": { "200": { "description": "The caller's chats", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionList" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/portal/sessions/{sessionId}": { "get": { "tags": [ "Portal Sessions" ], "summary": "Get a portal chat", "description": "One of the caller's portal chats, with its current status. Anyone else's is not found.", "operationId": "getPortalSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/PortalDomainQuery" }, { "$ref": "#/components/parameters/SessionIdPath" } ], "responses": { "200": { "description": "The chat", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionResponse" } } } }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } }, "delete": { "tags": [ "Portal Sessions" ], "summary": "Delete a portal chat", "description": "Deletes the chat and everything it keeps.", "operationId": "deletePortalSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/PortalDomainQuery" }, { "$ref": "#/components/parameters/SessionIdPath" } ], "responses": { "204": { "description": "Deleted" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/portal/sessions/{sessionId}/events": { "get": { "tags": [ "Portal Sessions" ], "summary": "List a portal chat's events", "description": "As `listSessionEvents`, for the caller's own portal chat.", "operationId": "listPortalSessionEvents", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/PortalDomainQuery" }, { "$ref": "#/components/parameters/SessionIdPath" }, { "name": "after", "in": "query", "required": false, "description": "Only events after this `seq`", "schema": { "type": "integer", "minimum": 0, "default": 0 } }, { "name": "limit", "in": "query", "required": false, "description": "How many stored events to read, at most 10000", "schema": { "type": "integer", "minimum": 1, "default": 10000 } } ], "responses": { "200": { "description": "A page of the chat's events", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionEventsPage" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } }, "post": { "tags": [ "Portal Sessions" ], "summary": "Send to a portal chat", "description": "As `sendSessionEvent`, for the caller's own portal chat: a message (no files), an approval decision,\nanswers, or an interrupt. Each one acts with the customer's token it comes with.\n", "operationId": "sendPortalSessionEvent", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/PortalDomainQuery" }, { "$ref": "#/components/parameters/SessionIdPath" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ClientInput" } } } }, "responses": { "202": { "description": "Accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionInputAccepted" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/SessionsNotEnabled" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "$ref": "#/components/responses/SessionsConflict" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" }, "503": { "$ref": "#/components/responses/PortalScreeningUnavailable" } } } }, "/v2/portal/config": { "get": { "tags": [ "Portal Sessions" ], "summary": "The portal's chat", "description": "How the chat of the portal this request comes from (its settings, by the request's domain) introduces\nitself; `agent: null` when the portal has no chat, or one this API can't answer yet (the portal\nthen keeps its v1 chat).\n", "operationId": "getPortalChatConfig", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "PortalAuth": [] } ], "parameters": [ { "name": "domain", "in": "query", "required": false, "description": "The portal's domain; without it, the request's `Origin`", "schema": { "type": "string" } }, { "name": "locale", "in": "query", "required": false, "description": "The customer's language, for the greeting and starters", "schema": { "type": "string" } } ], "responses": { "200": { "description": "The portal's chat", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PortalChatConfig" } } } }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions/uploads": { "post": { "tags": [ "Sessions" ], "summary": "Upload a file for a session", "description": "Registers a file the caller attaches to a message and returns a short-lived URL to `PUT` its bytes to,\nwith the headers to send. Attach it by its `fileId` in `createSession` or `sendSessionEvent` (`user.message`).\nOnly the listed media types, up to 10 MB.\n", "operationId": "createSessionUpload", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadRequest" } } } }, "responses": { "201": { "description": "The file, and where to upload its bytes", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionUpload" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/SessionsNotEnabled" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions": { "post": { "tags": [ "Sessions" ], "summary": "Start a session", "description": "Starts a session with an agent, optionally with the user's first message (`input`), which wakes the agent.\nWith a `requestId`, a retried request gets the session its first attempt created.\nWith `prepare` (and a `requestId`, no `input`), the session gets ready while the user still types: its\nagent is registered and its runtime starts, so the first message (sent with the same `requestId`) starts\nat once. Best effort: over the limits nothing starts, and the message is checked as always. A prepare's\nruntime yields to chats with a message and is reclaimed if no message comes; the list shows the session\nonce its message came.\n", "operationId": "createSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateSessionRequest" } } } }, "responses": { "201": { "description": "The session, and its events so far", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatedSession" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/SessionsNotEnabled" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "$ref": "#/components/responses/SessionsConflict" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } }, "get": { "tags": [ "Sessions" ], "summary": "List the caller's sessions", "description": "The caller's own sessions, most recently updated first. A chat only prepared for its first message (`prepare`) is listed once the message came.", "operationId": "listSessions", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agentId", "in": "query", "required": false, "description": "Only sessions with this agent", "schema": { "type": "string", "minLength": 1 } }, { "name": "origin", "in": "query", "required": false, "description": "Only sessions started from this origin (see `CreateSessionRequest.origin`); without it, sessions from any origin", "schema": { "$ref": "#/components/schemas/SessionOrigin" } }, { "name": "limit", "in": "query", "required": false, "description": "How many sessions, at most 200", "schema": { "type": "integer", "minimum": 1, "default": 30 } }, { "name": "before", "in": "query", "required": false, "description": "Only sessions updated before this time (the last listed session's `updatedAt`)", "schema": { "type": "string", "format": "date-time" } } ], "responses": { "200": { "description": "The caller's sessions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionList" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions/{sessionId}": { "get": { "tags": [ "Sessions" ], "summary": "Get a session", "description": "One of the caller's sessions, with its current status. Another user's session is not found.", "operationId": "getSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" } ], "responses": { "200": { "description": "The session", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionResponse" } } } }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } }, "patch": { "tags": [ "Sessions" ], "summary": "Rename a session", "description": "Sets the session's title (trimmed).", "operationId": "renameSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RenameSessionRequest" } } } }, "responses": { "200": { "description": "The renamed session", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionResponse" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } }, "delete": { "tags": [ "Sessions" ], "summary": "Delete a session", "description": "Deletes the session and everything it keeps (events, files, workspace).", "operationId": "deleteSession", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" } ], "responses": { "204": { "description": "Deleted" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions/{sessionId}/events": { "get": { "tags": [ "Sessions" ], "summary": "List a session's events", "description": "The session's history as client events, in pages: while `hasMore`, ask again with `after` set to `lastSeq`.\nEvery event carries the `seq` it comes from, so history and live messages can overlap.\n", "operationId": "listSessionEvents", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" }, { "name": "after", "in": "query", "required": false, "description": "Only events after this `seq`", "schema": { "type": "integer", "minimum": 0, "default": 0 } }, { "name": "limit", "in": "query", "required": false, "description": "How many stored events to read, at most 10000", "schema": { "type": "integer", "minimum": 1, "default": 10000 } } ], "responses": { "200": { "description": "A page of the session's events", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionEventsPage" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } }, "post": { "tags": [ "Sessions" ], "summary": "Send to a session", "description": "The user's input to the session: a message, an approval decision, answers to the agent's questions,\nor an interrupt (stop the turn). Accepted inputs are handled asynchronously; follow the session's events.\n", "operationId": "sendSessionEvent", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ClientInput" } } } }, "responses": { "202": { "description": "Accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionInputAccepted" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/SessionsNotEnabled" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "$ref": "#/components/responses/SessionsConflict" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" }, "502": { "description": "The agent couldn't get access to make the approved change; nothing was decided, try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } } } } }, "/v2/sessions/{sessionId}/files/{fileId}": { "get": { "tags": [ "Sessions" ], "summary": "Get a link to a session file", "description": "A short-lived link to a file of the session: one the user attached, or one the agent created.\nImages open in the browser unless `download=1`; anything else is downloaded under its name.\n", "operationId": "getSessionFileUrl", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" }, { "name": "fileId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid", "pattern": "^[0-9a-f-]{36}$" } }, { "name": "download", "in": "query", "required": false, "description": "`1`: always as a download", "schema": { "type": "string", "enum": [ "1" ] } } ], "responses": { "200": { "description": "The link", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionFileUrl" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions/scripts": { "post": { "tags": [ "Sessions" ], "summary": "Run a script", "description": "Runs a script in the caller's script session, without a model (the epilot MCP's `execute`). Its reads run\nwith the caller's token; the changes it records are not applied until `applyScriptRun`. Waits up to `waitMs`\nfor the result: `200` when it finished, `202` while it still runs (ask `getScriptRun`).\n", "operationId": "runScript", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunScriptRequest" } } } }, "responses": { "200": { "description": "The run finished", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScriptRunView" } } } }, "202": { "description": "The run is still running", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScriptRunView" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/ScriptsRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions/scripts/{runId}": { "get": { "tags": [ "Sessions" ], "summary": "Get a script run", "description": "Where a script run stands, waiting up to `waitMs` (at most 20000) for it to finish: `200` when it finished, `202` while it runs.", "operationId": "getScriptRun", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/ScriptRunIdPath" }, { "name": "waitMs", "in": "query", "required": false, "description": "How long to wait for the run to finish, in milliseconds; at most 20000", "schema": { "type": "integer", "minimum": 0, "default": 0 } } ], "responses": { "200": { "description": "The run finished", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScriptRunView" } } } }, "202": { "description": "The run is still running", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScriptRunView" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/sessions/scripts/{runId}/apply": { "post": { "tags": [ "Sessions" ], "summary": "Apply a script run's changes", "description": "Applies the changes a finished script run recorded, after the caller's client confirmed them, with the\ncaller's token. Each request runs for a while; call again until `done`. Refused (`409`, nothing runs) when\nthe script failed, recorded nothing, or asks for something the caller's roles don't allow.\n", "operationId": "applyScriptRun", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/ScriptRunIdPath" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApplyScriptRunRequest" } } } }, "responses": { "200": { "description": "The changes applied so far", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScriptApplyResult" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/ScriptsRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "description": "Refused (`code: refused`): nothing runs", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Refusal" } } } }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/agents/revoke": { "post": { "tags": [ "Sessions" ], "summary": "Revoke the caller's session agents", "description": "Logout. Every agent the caller's sessions act with ends now.", "operationId": "revokeSessionAgents", "x-epilot-agent": { "expose": false }, "x-epilot-permissions": [ { "access": "self" } ], "security": [ { "EpilotAuth": [] } ], "responses": { "204": { "description": "Revoked" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/internal/sessions": { "post": { "tags": [ "Sessions" ], "summary": "Start an unattended session (services only)", "description": "A service starts a session that runs with nobody watching, for a flow that may run\nunattended (today only `origin: blueprint-manifest` with\n`input.context.intent: blueprint-tests.suggest`).\nInternal auth only: the organization is the one the internal-auth token names (`org_id`,\nor `x-epilot-org-id`), never the body; a person's token gets 403. The session belongs to\n`owner.user_id`, who opens and continues it like any chat of theirs. The one call its\nflow pins is approved automatically in its own organization, also after the owner\njoined (every other change and batches ask a person).\nUntil the owner sends it an input, its questions don't wait for an answer. Without epilot access of its own\n(`unattended_access: false` in the response), nothing runs until the owner writes. A retry\nwith the same `client_token` gets the same session.\n", "operationId": "createInternalSession", "x-epilot-agent": { "expose": false }, "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateInternalSessionRequest" } } } }, "responses": { "201": { "description": "The session started", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatedInternalSession" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/UnattendedRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "$ref": "#/components/responses/SessionsConflict" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/internal/sessions/{sessionId}": { "get": { "tags": [ "Sessions" ], "summary": "What an unattended session is doing (services only)", "description": "Whether a session the service started with `POST /v2/internal/sessions` is working, waits\nfor its owner (their first message, an approval or an answer), is idle, or failed. Internal\nauth only, like starting one: the organization is the one the internal-auth token names, and a\nperson's token gets 403. A session of another organization, an unknown id and a session not\nstarted through `POST /v2/internal/sessions` are not found (404). No transcript content.\n", "operationId": "getInternalSession", "x-epilot-agent": { "expose": false }, "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" } ], "responses": { "200": { "description": "What the session is doing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InternalSessionStatus" } } } }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/UnattendedRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/internal/executions": { "post": { "tags": [ "Sessions" ], "summary": "Start a Flows execution as a background run (services only)", "description": "The agents API starts an agent execution of a Flows task as a v2 background run, in any\norganization. Internal auth only: the organization is the one the internal-auth token names,\nnever the body; a person's token gets 403. The run is the organization's: no person owns it,\nnobody is asked anything, and no one's chat list shows it. One session per `execution_id`: a\nretry gets the same session and adds its first message once. Refused (403, `refused`) when the\nagent is unknown, not available for Flows, has tools a v2 Flows run can't use yet (only\n`submit_result`, `knowledge_base_search`, v1's read tools and, given the run's mode, v1's write\ntools, with the service token) or runs as its own identity (activated in Agent Builder); `not_enabled`\nwhen AI is off for the organization.\n", "operationId": "createInternalExecution", "x-epilot-permissions": [ { "access": "internal" } ], "x-epilot-agent": { "expose": false }, "security": [ { "EpilotAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateInternalExecutionRequest" } } } }, "responses": { "201": { "description": "The run started", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatedInternalExecution" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/ExecutionRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "$ref": "#/components/responses/SessionsConflict" }, "413": { "$ref": "#/components/responses/SessionsPayloadTooLarge" }, "429": { "$ref": "#/components/responses/SessionsQuotaExceeded" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/internal/executions/{executionId}/decision": { "post": { "tags": [ "Sessions" ], "summary": "Decide what a Flows run on v2 waits for (services only)", "description": "A person's decision on the approval a Flows execution in `approval` mode waits for, from the\nagents API's approve or reject (which checked who may decide). Recorded as theirs\n(`flows:`); the run goes on with it. Internal auth only; the execution and its\napproval must be the organization's (404 otherwise). 409 when the approval can no longer be\ndecided (expired).\n", "operationId": "decideInternalExecution", "x-epilot-permissions": [ { "access": "internal" } ], "x-epilot-agent": { "expose": false }, "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "executionId", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionDecisionRequest" } } } }, "responses": { "200": { "description": "Decided", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutionDecision" } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/ExecutionRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "409": { "$ref": "#/components/responses/SessionsConflict" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/internal/portal-chats": { "get": { "tags": [ "Sessions" ], "summary": "An agent's portal chats on v2, for Agent Builder's history (services only)", "description": "The v2 portal chats customers had with a portal agent, for v1's\n`GET /v1/customer-chat/{agent_id}/conversations`, which merges them with v1's and keeps its own\nauthorization and shape. Internal auth only: the organization is the one the internal-auth token\nnames; only the agent's chats with portal customers (channel `portal`, owned by a portal user)\nthat have a message.\n\nA page says where each chat is: its id and `updated_at`, when its last message was stored\n(v1's `updated_at`; not the session's activity, which moves on every event). Newest first,\nthe filters applied before paging; `after_updated_at` and `after_id` (both or neither)\ncontinue after that chat, in that order. With `ids`, the rows of those chats instead, as a\npage of the history shows them, in that order, without paging (an id that isn't such a chat\nis left out).\n\nBounded like v1's filtered read: a page looks at ten pages' worth of chats at most. When that\nends it first (a selective `has_ticket`), the page is short, even empty, `has_more` is true and\n`read_to` is the last chat it looked at: continue after it.\n", "operationId": "listInternalPortalChats", "x-epilot-permissions": [ { "access": "internal" } ], "x-epilot-agent": { "expose": false }, "security": [ { "EpilotAuth": [] } ], "parameters": [ { "name": "agent_id", "in": "query", "required": true, "schema": { "type": "string", "minLength": 1 } }, { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 } }, { "name": "after_updated_at", "in": "query", "schema": { "type": "string", "format": "date-time" } }, { "name": "after_id", "in": "query", "schema": { "type": "string", "format": "uuid" } }, { "name": "from", "in": "query", "schema": { "type": "string", "format": "date-time" }, "description": "Only chats whose last message was stored at or after this time" }, { "name": "to", "in": "query", "schema": { "type": "string", "format": "date-time" }, "description": "Only chats whose last message was stored at or before this time" }, { "name": "has_ticket", "in": "query", "schema": { "type": "boolean" }, "description": "Only chats in which the agent created a ticket" }, { "name": "ids", "in": "query", "schema": { "type": "string" }, "description": "The rows of these chats (comma-separated session ids, at most 100) instead of a page" } ], "responses": { "200": { "description": "Where the agent's portal chats on v2 are, or the rows of those asked for", "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/InternalPortalChats" }, { "$ref": "#/components/schemas/InternalPortalChatRows" } ] } } } }, "400": { "$ref": "#/components/responses/SessionsBadRequest" }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/UnattendedRefused" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } }, "/v2/internal/portal-chats/{sessionId}": { "get": { "tags": [ "Sessions" ], "summary": "One portal chat on v2 with its transcript, for Agent Builder's history (services only)", "description": "A v2 portal chat of the agent and its first 100 messages as v1 stores them, oldest first: per\nturn the customer's message and one answer, an empty answer for an approval's outcome, a\nblocked customer message marked `blocked` and its fixed reply. v1's conversation detail filters\nthem as its transcript. Internal auth only; a chat of another organization, another agent or\nchannel, one without a message, a deleted or expired one, and an unknown id are not found (404).\n", "operationId": "getInternalPortalChat", "x-epilot-permissions": [ { "access": "internal" } ], "x-epilot-agent": { "expose": false }, "security": [ { "EpilotAuth": [] } ], "parameters": [ { "$ref": "#/components/parameters/SessionIdPath" }, { "name": "agent_id", "in": "query", "required": true, "schema": { "type": "string", "minLength": 1 } } ], "responses": { "200": { "description": "The chat and its transcript", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InternalPortalChatTranscript" } } } }, "401": { "$ref": "#/components/responses/SessionsUnauthorized" }, "403": { "$ref": "#/components/responses/UnattendedRefused" }, "404": { "$ref": "#/components/responses/SessionsNotFound" }, "500": { "$ref": "#/components/responses/SessionsInternalError" } } } } }, "components": { "securitySchemes": { "PortalAuth": { "type": "http", "scheme": "bearer", "description": "An end customer's portal token (the portal authorizer verifies it)." }, "EpilotAuth": { "type": "http", "scheme": "bearer", "description": "Authorization header with epilot OAuth2 bearer token. Supports RFC8725 for JWT validation.", "bearerFormat": "JWT" } }, "parameters": { "PortalDomainQuery": { "name": "domain", "in": "query", "required": false, "description": "The portal's domain, as the portal knows it; without it, the request's `Origin`", "schema": { "type": "string" } }, "CustomerChatAgentIdPath": { "name": "agent_id", "in": "path", "required": true, "description": "Customer Chat agent id", "schema": { "type": "string" } }, "IfMatchUpdatedAt": { "name": "If-Match", "in": "header", "required": false, "description": "Compare-and-swap token. The agent's current `updated_at`; may be sent as `updated_at` in the body instead.", "schema": { "type": "string" } }, "SessionIdPath": { "name": "sessionId", "in": "path", "required": true, "description": "The session's id", "schema": { "type": "string", "format": "uuid", "pattern": "^[0-9a-f-]{36}$" } }, "ScriptRunIdPath": { "name": "runId", "in": "path", "required": true, "description": "The script run's id: `.`", "schema": { "type": "string", "pattern": "^[0-9a-f-]{36}\\.[0-9a-f-]{36}$" } } }, "responses": { "SessionsBadRequest": { "description": "Invalid request: it doesn't match this spec (`issues` says where), or it can't be done as asked", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } }, "SessionsUnauthorized": { "description": "Not signed in", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } }, "PortalScreeningUnavailable": { "description": "Refused (`code: screening_unavailable`): the customer's message could not be checked (v1's screening failed). Nothing was stored; the client may send it again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Refusal" } } } }, "SessionsNotEnabled": { "description": "Refused (`code: not_enabled`): Luna is not enabled for the caller's organization", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Refusal" } } } }, "ScriptsRefused": { "description": "Refused: `not_enabled`, Luna is not enabled for the caller's organization; `refused`, the caller's login only sees anonymized data, and scripts need full data access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Refusal" } } } }, "UnattendedRefused": { "description": "Refused: `unattended_not_allowed`, the flow may not run unattended in this organization; `not_enabled`, Luna is not enabled for the organization; or the caller is not a service (internal auth)", "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/Refusal" }, { "$ref": "#/components/schemas/SessionsError" } ] } } } }, "ExecutionRefused": { "description": "Refused: `refused`, the agent is unknown, isn't available for Flows or has tools a v2 Flows run can't use yet; `not_enabled`, AI is off for the organization; or the caller is not a service (internal auth)", "content": { "application/json": { "schema": { "anyOf": [ { "$ref": "#/components/schemas/Refusal" }, { "$ref": "#/components/schemas/SessionsError" } ] } } } }, "SessionsNotFound": { "description": "Not found, or not the caller's", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } }, "SessionsConflict": { "description": "Conflicts with the session's state (e.g. an approval that expired, questions answered already)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } }, "SessionsPayloadTooLarge": { "description": "The request body is larger than 256 KB", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } }, "SessionsQuotaExceeded": { "description": "Refused (`code: quota_exceeded`): the caller or the organization has as many sessions running as allowed, or the organization's daily budget is used up", "headers": { "retry-after": { "description": "Seconds until it may work again", "schema": { "type": "integer" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Refusal" } } } }, "SessionsInternalError": { "description": "Internal error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionsError" } } } } }, "schemas": { "AgentConfig": { "type": "object", "required": [ "capabilities", "knowledgeSources", "escalation", "appearance" ], "properties": { "capabilities": { "description": "Configured capability instances, up to 30 per agent. The same\ncatalog `type` may appear more than once when `label` (name) or\n`guidance` (when to use) differs between siblings.\n", "type": "array", "items": { "$ref": "#/components/schemas/CapabilityInstance" } }, "knowledgeSources": { "type": "array", "items": { "$ref": "#/components/schemas/CustomerChatKnowledgeSource" } }, "escalation": { "$ref": "#/components/schemas/EscalationConfig" }, "appearance": { "$ref": "#/components/schemas/AppearanceConfig" }, "instructions": { "type": "string", "maxLength": 13000, "description": "Admin-editable briefing in the default `appearance.language`, one entry per line. Each new or changed entry is at most 500 characters; entries already saved stay valid. Prefilled with a place default on create; omitted on save keeps the saved value." }, "instructionTranslations": { "type": "object", "description": "Briefings for each language in `appearance.languages` other than `appearance.language`. Only present once the agent speaks a second language.", "properties": { "de": { "type": "string", "maxLength": 13000 }, "en": { "type": "string", "maxLength": 13000 } } }, "instructionsNeedsReview": { "type": "array", "description": "Languages whose briefing changed in another language and are not checked yet.", "items": { "type": "string", "enum": [ "de", "en" ] } } } }, "AppearanceConfig": { "type": "object", "required": [ "displayName", "greeting", "starters", "language", "formOfAddress" ], "properties": { "displayName": { "type": "string" }, "greeting": { "type": "string" }, "starters": { "type": "array", "items": { "type": "string" } }, "starterKeys": { "type": "array", "description": "One key per starter, in the order of `starters` and the same for a starter in every language; websites ask a starter by it with `startStarter(key)`. Absent for starters saved before keys, which readers key `starter-`.", "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" } }, "launcherLabel": { "type": "string", "maxLength": 40, "description": "Text on the Website Chat's epilot button, in the default language. Website place only; without it the Website Chat shows its own label." }, "language": { "type": "string", "description": "Default language. The top-level texts are written in it.", "enum": [ "de", "en" ] }, "formOfAddress": { "type": "string", "enum": [ "sie", "du" ] }, "followUps": { "type": "boolean", "description": "Suggest follow-ups after a reply. Defaults to on for website agents, off for portal agents." }, "languages": { "type": "array", "description": "Configured content languages for widget chrome (name, greeting, starters) and per-language instructions. Only present with two or more; always includes `language`.", "items": { "type": "string", "enum": [ "de", "en" ] } }, "translations": { "type": "object", "description": "Texts for each language in `languages` other than `language`.", "properties": { "de": { "$ref": "#/components/schemas/LocalizedAppearance" }, "en": { "$ref": "#/components/schemas/LocalizedAppearance" } } }, "needsReview": { "type": "object", "description": "Per language, texts that changed in another language and are not checked yet.", "properties": { "de": { "$ref": "#/components/schemas/LocalizedFieldList" }, "en": { "$ref": "#/components/schemas/LocalizedFieldList" } } } } }, "LocalizedAppearance": { "type": "object", "required": [ "displayName", "greeting", "starters" ], "properties": { "displayName": { "type": "string" }, "greeting": { "type": "string" }, "starters": { "type": "array", "items": { "type": "string" } }, "starterKeys": { "type": "array", "description": "One key per starter, in the order of `starters` and the same for a starter in every language; websites ask a starter by it with `startStarter(key)`. Absent for starters saved before keys, which readers key `starter-`.", "items": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" } }, "launcherLabel": { "type": "string", "maxLength": 40 } } }, "LocalizedFieldList": { "type": "array", "items": { "type": "string", "enum": [ "displayName", "greeting", "starters", "launcherLabel" ] } }, "CapabilityId": { "type": "string", "enum": [ "navigate_portal_pages", "search_portal_records", "view_billing", "view_meter_readings", "view_contracts", "search_web", "open_quick_actions", "view_hems_energy", "open_journey", "open_link", "submit_meter_reading" ] }, "AccessLevel": { "type": "string", "description": "Who may use a capability. `anonymous` = every visitor, `authenticated` =\nonly a customer authenticated by email code or portal login; others are\nasked to sign in first. Each capability type has a default and a\nminimum; values below the minimum are raised. Used today by\n`open_journey`, `open_link` and `submit_meter_reading` (always\n`authenticated`); other capability types ignore it.\n", "enum": [ "anonymous", "authenticated" ] }, "SelfServiceIntent": { "type": "string", "description": "What a journey, link or in-chat capability is for; names the action in the chat and in analytics.", "enum": [ "submit_meter_reading" ] }, "ActionAutonomy": { "type": "string", "description": "Action capabilities only (`open_quick_actions`): per-capability autonomy.\n`draft` = suggest only (proposal + deep link, nothing opens),\n`approval` = the customer confirms in a card first,\n`automatic` = run immediately. Defaults to `approval` when the\ncapability is enabled without one; unknown values become `approval`;\nvalues above the capability's maximum are clamped down.\n", "enum": [ "draft", "approval", "automatic" ] }, "CapabilityState": { "type": "object", "required": [ "enabled" ], "properties": { "enabled": { "type": "boolean" }, "meterTypes": { "type": "array", "items": { "type": "string" } }, "ticketType": { "type": "string" }, "allowedDomains": { "type": "array", "maxItems": 20, "description": "`search_web` only. Websites web search may use, normalized to\n`host[/path]` (scheme, `www.`, query, fragment and trailing slash\nremoved; host lowercased; duplicates dropped). Empty or missing\nallows any website. When set, only `web_search.search` is granted.\n", "items": { "type": "string" } }, "autonomy": { "$ref": "#/components/schemas/ActionAutonomy" }, "label": { "type": "string", "maxLength": 100, "description": "Admin label override. Kept on every capability so a disabled row stays listed." }, "guidance": { "type": "string", "maxLength": 1000, "description": "Admin guidance. Kept on every capability so a disabled row stays listed; action capabilities also inject it into the prompt." }, "blockIds": { "type": "array", "description": "`open_quick_actions` only. Reserved tile allowlist (at most 200);\nempty or missing allows every quick-action tile on the linked portal.\n", "items": { "type": "string" } }, "integrationId": { "type": "string", "format": "uuid", "description": "`view_hems_energy` only. Hub integration installation id used by\nHEMS portal tools (`portal.hems.snapshot` via list_devices, and\nwhen searchDeviceDocs is on also get_vendors /\nget_connection_options). Chosen in Agent Builder via the\nintegration picker.\n" }, "accessLevel": { "$ref": "#/components/schemas/AccessLevel" }, "intent": { "$ref": "#/components/schemas/SelfServiceIntent" }, "journeyId": { "type": "string", "format": "uuid", "description": "`open_journey` only. The journey the Website Chat embeds; the action is offered only once set." }, "journeyName": { "type": "string", "maxLength": 200, "description": "`open_journey` only. The journey's name, kept for display." }, "url": { "type": "string", "maxLength": 2048, "pattern": "^https://", "description": "`open_link` only. The page the Website Chat opens; the action is offered only once set." }, "searchDeviceDocs": { "type": "boolean", "description": "`view_hems_energy` only. When true or omitted, grants device\nonboarding docs tools (`portal.hems.vendors` via get_vendors +\n`portal.hems.onboarding_docs` via get_connection_options) once\nan integrationId is set. Set false to disable. Portal place only.\n" } } }, "CapabilityInstance": { "allOf": [ { "type": "object", "required": [ "type", "enabled" ], "properties": { "type": { "$ref": "#/components/schemas/CapabilityId" }, "instanceId": { "type": "string", "minLength": 1, "description": "Stable id for this instance within the agent. Generated when\nomitted; send it back unchanged on later saves.\n" } } }, { "$ref": "#/components/schemas/CapabilityState" } ] }, "CreateCustomerChatAgentRequest": { "type": "object", "required": [ "place" ], "properties": { "place": { "$ref": "#/components/schemas/CustomerChatPlace" }, "internal_name": { "type": "string", "minLength": 1, "maxLength": 100 } } }, "CustomerChatAgent": { "type": "object", "required": [ "org_id", "agent_id", "place", "internal_name", "runtime_agent_id", "config", "created_at", "updated_at" ], "properties": { "org_id": { "type": "string" }, "agent_id": { "type": "string", "format": "uuid", "description": "Stable id of the customer chat agent; equal to runtime_agent_id." }, "place": { "$ref": "#/components/schemas/CustomerChatPlace" }, "internal_name": { "type": "string" }, "runtime_agent_id": { "type": "string", "format": "uuid" }, "config": { "$ref": "#/components/schemas/AgentConfig" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } }, "CustomerChatCasRequest": { "type": "object", "properties": { "updated_at": { "type": "string", "format": "date-time" } } }, "DeleteCustomerChatAgentRequest": { "allOf": [ { "$ref": "#/components/schemas/CustomerChatCasRequest" }, { "type": "object", "properties": { "portal_id": { "type": "string", "format": "uuid", "description": "Portal linked to this agent (`feature_settings.portal_copilot_agent_id`).\nWhen set, only that portal is unlinked. When omitted for a portal agent,\norg portal configs are scanned for matching links.\n" } } } ] }, "CustomerChatPlace": { "type": "string", "enum": [ "website", "portal" ] }, "EscalationConfig": { "type": "object", "required": [ "websiteHandover" ], "properties": { "websiteHandover": { "$ref": "#/components/schemas/WebsiteHandover" }, "ticketPurpose": { "$ref": "#/components/schemas/TicketPurpose" } } }, "TicketPurpose": { "type": "object", "nullable": true, "description": "Portal places only: purpose set on tickets the portal chat creates when\nit hands over to the service team. Omit (or send `null`) for a plain ticket.\n", "required": [ "id" ], "properties": { "id": { "type": "string", "description": "Purpose taxonomy classification id, stored in the ticket's `_purpose`." }, "name": { "type": "string", "description": "The purpose's name, kept for display." } } }, "CustomerChatKnowledgeSource": { "type": "object", "required": [ "id", "type", "title", "targetId" ], "properties": { "id": { "type": "string" }, "type": { "$ref": "#/components/schemas/CustomerChatKnowledgeSourceType" }, "title": { "type": "string" }, "targetId": { "type": "string" }, "detail": { "type": "string" } } }, "CustomerChatKnowledgeSourceType": { "type": "string", "enum": [ "portal_page", "document", "catalogue", "url" ] }, "ListCustomerChatResponse": { "type": "object", "required": [ "agents" ], "properties": { "agents": { "type": "array", "items": { "$ref": "#/components/schemas/CustomerChatAgent" } } } }, "CustomerChatCapabilityCatalogEntry": { "type": "object", "required": [ "id", "places" ], "properties": { "id": { "$ref": "#/components/schemas/CapabilityId" }, "places": { "type": "array", "items": { "$ref": "#/components/schemas/CustomerChatPlace" } }, "singleInstance": { "type": "boolean", "description": "An agent can have this capability at most once. Agents that already\nhave more instances keep them, but cannot add another.\n" }, "requiresIntegration": { "type": "boolean", "description": "Only offer this capability when the organization has a matching\nintegration set up.\n" } } }, "ListCustomerChatCapabilitiesResponse": { "type": "object", "required": [ "capabilities" ], "properties": { "capabilities": { "type": "array", "items": { "$ref": "#/components/schemas/CustomerChatCapabilityCatalogEntry" } } } }, "RenameCustomerChatAgentRequest": { "type": "object", "required": [ "internal_name" ], "properties": { "internal_name": { "type": "string", "minLength": 1, "maxLength": 100 }, "updated_at": { "type": "string", "format": "date-time" } } }, "SaveCustomerChatConfigRequest": { "type": "object", "required": [ "config" ], "properties": { "config": { "$ref": "#/components/schemas/AgentConfig" }, "updated_at": { "type": "string", "format": "date-time" } } }, "WebsiteHandover": { "type": "object", "required": [ "kind", "value" ], "properties": { "kind": { "type": "string", "enum": [ "phone", "email", "journey", "ticket", "unset" ], "description": "Where the website agent hands over when it cannot help.\n- `phone`: the agent gives the customer the phone number in `value`.\n- `email`: the agent gives the customer the email address in `value`.\n- `journey`: the agent points the customer to the journey in `journeyId`.\n- `ticket`: an authenticated visitor can confirm a support ticket for the\n service team, with the chat transcript as a note. Anonymous\n visitors are asked to sign in first.\n- `unset`: nothing chosen yet; the agent offers no hand-over channel.\n" }, "value": { "type": "string", "description": "Phone number or email address for `phone` / `email`; empty otherwise." }, "journeyId": { "type": "string", "description": "The hand-over journey, for `journey`." }, "journeyName": { "type": "string", "description": "The journey's name, kept for display, for `journey`." } } }, "AgentId": { "type": "string", "description": "Agent identifier. Can be either:\n- System skill ID (prefixed): \"skill:email-categorizer\", \"skill:email-labeler\"\n- Custom agent UUID: \"0336a235-9417-4dd8-894c-fe81285bba75\"\n", "example": "skill:email-categorizer" }, "KnowledgeSourceIds": { "type": "array", "description": "Knowledge source IDs available to this agent. An empty array clears the selection.", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "AgentDomain": { "type": "string", "description": "Business domain selected in the agent builder.", "enum": [ "customer_service", "sales", "billing", "metering_grid", "other" ] }, "CreateAgentRequest": { "type": "object", "required": [ "name", "system_prompt", "execution_pattern" ], "properties": { "domain": { "$ref": "#/components/schemas/AgentDomain" }, "availability": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/components/schemas/SkillAvailability" } }, "name": { "type": "string", "minLength": 1, "maxLength": 100, "example": "Email Reply Generator" }, "description": { "type": "string", "maxLength": 1000 }, "category": { "$ref": "#/components/schemas/SkillCategory" }, "icon": { "type": "string", "example": "mail-reply" }, "system_prompt": { "type": "string", "minLength": 1, "description": "Core LLM instructions" }, "tools": { "type": "array", "items": { "type": "string" }, "description": "Tool IDs this agent can use", "example": [ "entity.search", "message.draft" ] }, "model_config": { "$ref": "#/components/schemas/ModelConfig" }, "max_iterations": { "type": "integer", "minimum": 1, "maximum": 20, "default": 10, "description": "Max ReAct loop iterations" }, "execution_pattern": { "$ref": "#/components/schemas/ExecutionPattern" }, "execution_mode": { "$ref": "#/components/schemas/ExecutionMode" }, "output_schema": { "type": "object", "description": "JSON Schema for expected output" }, "input_parameters_schema": { "$ref": "#/components/schemas/InputParametersSchema" }, "knowledge_source_ids": { "$ref": "#/components/schemas/KnowledgeSourceIds" } } }, "UpdateAgentRequest": { "type": "object", "properties": { "domain": { "$ref": "#/components/schemas/AgentDomain" }, "availability": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/components/schemas/SkillAvailability" } }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "description": { "type": "string", "maxLength": 1000 }, "category": { "$ref": "#/components/schemas/SkillCategory" }, "icon": { "type": "string" }, "system_prompt": { "type": "string", "minLength": 1 }, "tools": { "type": "array", "items": { "type": "string" } }, "model_config": { "$ref": "#/components/schemas/ModelConfig" }, "max_iterations": { "type": "integer", "minimum": 1, "maximum": 20 }, "execution_pattern": { "$ref": "#/components/schemas/ExecutionPattern" }, "execution_mode": { "$ref": "#/components/schemas/ExecutionMode" }, "output_schema": { "type": "object" }, "input_parameters_schema": { "$ref": "#/components/schemas/InputParametersSchema" }, "knowledge_source_ids": { "$ref": "#/components/schemas/KnowledgeSourceIds" } } }, "AgentDefinition": { "type": "object", "properties": { "domain": { "$ref": "#/components/schemas/AgentDomain" }, "agent_id": { "$ref": "#/components/schemas/AgentId" }, "org_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "category": { "$ref": "#/components/schemas/SkillCategory" }, "icon": { "type": "string" }, "source": { "$ref": "#/components/schemas/AgentSource" }, "availability": { "type": "array", "items": { "$ref": "#/components/schemas/SkillAvailability" }, "description": "Where this agent/skill is available (flows, copilot, or both)", "example": [ "flows", "copilot" ] }, "allowed_entity_schemas": { "type": "array", "items": { "type": "string" }, "description": "Entity schemas this skill is allowed to work with (e.g., [\"message\"] for email skills)", "example": [ "message" ] }, "system_prompt": { "type": "string" }, "tools": { "type": "array", "items": { "type": "string" } }, "model_config": { "$ref": "#/components/schemas/ModelConfig" }, "max_iterations": { "type": "integer" }, "execution_pattern": { "$ref": "#/components/schemas/ExecutionPattern" }, "execution_mode": { "$ref": "#/components/schemas/ExecutionMode" }, "output_schema": { "type": "object" }, "input_parameters_schema": { "$ref": "#/components/schemas/InputParametersSchema" }, "knowledge_source_ids": { "$ref": "#/components/schemas/KnowledgeSourceIds" }, "version": { "type": "integer" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" }, "created_by": { "type": "string" } } }, "ListAgentsResponse": { "type": "object", "properties": { "agents": { "type": "array", "items": { "$ref": "#/components/schemas/AgentDefinition" } }, "next_cursor": { "type": "string", "nullable": true } } }, "ListExecutionsResponse": { "type": "object", "properties": { "executions": { "type": "array", "items": { "$ref": "#/components/schemas/ExecutionResponse" } }, "next_cursor": { "type": "string", "nullable": true, "description": "Pass as `cursor` for the next page. Null after the last page." } } }, "ApproveExecutionRequest": { "type": "object", "properties": { "reason": { "type": "string", "description": "Optional reason for approval" }, "approved_action_ids": { "type": "array", "items": { "type": "string" }, "description": "For batch approval - list of action IDs to approve. If not provided, all actions are approved." }, "rejected_action_ids": { "type": "array", "items": { "type": "string" }, "description": "For batch approval - list of action IDs to reject. Actions not in approved_action_ids are implicitly rejected." } } }, "RejectExecutionRequest": { "type": "object", "required": [ "reason" ], "properties": { "reason": { "type": "string", "description": "Reason for rejection" } } }, "ExecuteAgentRequest": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "auto", "stream", "async", "sync" ], "default": "auto", "description": "`sync` runs the skill inside the request and answers 200 with the completed execution, or 422/504/500\nwith the failed execution's id in `details.execution_id`. Only for direct, tool-less, automatic skills;\nthe model call is cut off after 27 seconds.\n" }, "input": { "type": "object", "properties": { "message": { "type": "string", "description": "Free-text instruction or query for the agent" }, "entity_id": { "type": "string", "description": "Primary entity ID for context" }, "entity_schema": { "type": "string", "description": "Schema of the primary entity (e.g., \"message\", \"contact\")" }, "workflow_id": { "type": "string" }, "workflow_execution_id": { "type": "string" }, "task_id": { "type": "string" }, "custom_data": { "type": "object", "additionalProperties": true }, "flow_context": { "type": "array", "description": "Array of entities from the flow trigger context (e.g., the message entity when triggered by email receive)", "items": { "type": "object", "properties": { "entity_id": { "type": "string" }, "entity_schema": { "type": "string" } }, "required": [ "entity_id", "entity_schema" ] } }, "attachment": { "type": "object", "description": "The file the agent should look at, referenced by S3 object. Only accepted by skills\nthat declare attachment support (currently direct-mode document skills). The object is\nread by the execution Lambda and passed to the model as an image or document content\nblock; images must be JPEG, PNG, GIF or WebP, documents PDF, DOCX, DOC, XLSX, XLS,\nCSV, TXT, HTML or Markdown. Callers are expected to downscale images and cap document\npages before referencing them.\n", "required": [ "s3ref", "mime_type" ], "properties": { "s3ref": { "type": "object", "required": [ "bucket", "key" ], "properties": { "bucket": { "type": "string" }, "key": { "type": "string" } } }, "mime_type": { "type": "string", "description": "Mime type of the object, decides whether it is sent as an image or a document block." }, "filename": { "type": "string" } } }, "attachments": { "type": "array", "description": "Further files for the agent, in the same shape as `attachment`. Accepted by skills that\ndeclare attachment support, in direct and ReAct mode. Each file is limited like `attachment`;\nall files of one execution together are limited to 20 MB, and `attachment` plus `attachments`\nto 5 files.\n", "items": { "type": "object", "required": [ "s3ref", "mime_type" ], "properties": { "s3ref": { "type": "object", "required": [ "bucket", "key" ], "properties": { "bucket": { "type": "string" }, "key": { "type": "string" } } }, "mime_type": { "type": "string" }, "filename": { "type": "string" } } } } } }, "parameters": { "type": "object", "additionalProperties": true, "description": "Runtime parameters (validated against input_parameters_schema)" }, "execution_mode_override": { "$ref": "#/components/schemas/ExecutionMode" }, "execution_context": { "$ref": "#/components/schemas/ExecutionContext" }, "callback_url": { "type": "string", "format": "uri", "description": "Webhook URL for async completion notification" }, "timeout_ms": { "type": "integer", "maximum": 600000, "description": "Deadline for the execution, counted from its creation. A direct skill still running when\nit passes is cut off and the execution fails with `error: TIMEOUT`; a ReAct agent is cut off\nat its next model call. Without it an execution is bounded only by the service's own limit.\nIgnored by `mode: sync`, which has a fixed cutoff.\n" } } }, "ExecuteAgentStreamRequest": { "allOf": [ { "$ref": "#/components/schemas/ExecuteAgentRequest" }, { "type": "object", "properties": { "agent_override": { "$ref": "#/components/schemas/AgentPreviewOverride" } } } ] }, "ExecutionResponse": { "type": "object", "properties": { "execution_id": { "type": "string", "format": "uuid" }, "agent_id": { "$ref": "#/components/schemas/AgentId" }, "agent_source": { "$ref": "#/components/schemas/AgentSource" }, "agent_name": { "type": "string", "description": "Human-readable agent name (denormalized for display)" }, "execution_context": { "$ref": "#/components/schemas/ExecutionContext" }, "org_id": { "type": "string" }, "status": { "$ref": "#/components/schemas/ExecutionStatus" }, "input": { "type": "object" }, "parameters": { "type": "object" }, "result": { "type": "object", "nullable": true, "description": "Execution result (when status=completed). `GET /v1/executions/{execution_id}` always returns\nthe full result. The list endpoint and the completion event may instead carry\n`{ result_ref, preview }` for a result too large to store inline.\n", "properties": { "response": { "type": "string", "description": "Text response from the agent" }, "structured_output": { "type": "object", "nullable": true, "description": "Parsed structured output (only for direct mode with output_schema)" }, "stop_reason": { "type": "string", "description": "Why the model stopped (`end_turn`, `max_tokens`, ...). Present for skills that run through the native InvokeModel path, so a caller can treat a truncated answer itself." } } }, "error": { "$ref": "#/components/schemas/ExecutionError" }, "pending_action": { "$ref": "#/components/schemas/PendingAction" }, "metrics": { "$ref": "#/components/schemas/ExecutionMetrics" }, "started_at": { "type": "string", "format": "date-time" }, "completed_at": { "type": "string", "format": "date-time", "nullable": true }, "iterations": { "type": "array", "description": "Slim, labels-only step-progress projection of the ReAct iterations (empty for direct mode). Exposes only index, tool, status, and timestamp — raw thought, action input, and observation are intentionally excluded.", "items": { "$ref": "#/components/schemas/ExecutionIterationProjection" } } } }, "ExecutionIterationProjection": { "type": "object", "properties": { "index": { "type": "integer" }, "tool": { "type": "string", "nullable": true, "description": "Tool id the iteration invoked, or null for a non-tool step" }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "timestamp": { "type": "string", "format": "date-time" } } }, "ExecutionFeedback": { "type": "object", "required": [ "rating", "user_id", "submitted_at" ], "properties": { "rating": { "type": "string", "enum": [ "up", "down" ] }, "comment": { "type": "string" }, "user_id": { "type": "string" }, "submitted_at": { "type": "string", "format": "date-time" } } }, "ExecutionFeedbackResponse": { "type": "object", "required": [ "feedback" ], "properties": { "feedback": { "allOf": [ { "$ref": "#/components/schemas/ExecutionFeedback" } ], "nullable": true } } }, "PutExecutionFeedbackRequest": { "type": "object", "required": [ "rating" ], "properties": { "rating": { "type": "string", "enum": [ "up", "down" ] }, "comment": { "type": "string" } } }, "ExecutionTrace": { "type": "object", "properties": { "execution_id": { "type": "string", "format": "uuid" }, "iterations": { "type": "array", "items": { "$ref": "#/components/schemas/ExecutionIteration" } }, "total_iterations": { "type": "integer" } } }, "ExecutionIteration": { "type": "object", "properties": { "iteration_index": { "type": "integer" }, "thought": { "type": "string", "description": "LLM reasoning/thinking" }, "action": { "type": "object", "nullable": true, "properties": { "tool": { "type": "string" }, "input": { "type": "object" } } }, "observation": { "type": "object", "nullable": true, "description": "Tool result" }, "timestamp": { "type": "string", "format": "date-time" }, "tokens_used": { "type": "integer" }, "latency_ms": { "type": "integer" } } }, "PendingAction": { "type": "object", "nullable": true, "description": "Action waiting for approval (when status=waiting_approval)", "properties": { "tool": { "type": "string", "description": "Tool ID that requires approval" }, "input": { "type": "object", "description": "Tool input parameters" }, "description": { "type": "string", "description": "Human-readable description of the action" }, "preview": { "$ref": "#/components/schemas/ToolPreview" }, "approval_note": { "type": "string", "description": "Set when the usual approvers cannot decide this action. With agents-strict-approvals, a run started with internal auth and no user can only be approved or rejected by internal auth (the automation that started it); without its decision the approval expires and the run continues without the action." } } }, "ExecutionError": { "type": "object", "nullable": true, "properties": { "code": { "type": "string", "enum": [ "TIMEOUT", "MAX_ITERATIONS_EXCEEDED", "TOOL_EXECUTION_FAILED", "LLM_ERROR", "INVALID_OUTPUT", "REJECTED", "INTERNAL_ERROR" ] }, "message": { "type": "string" }, "details": { "type": "object" } } }, "ExecutionMetrics": { "type": "object", "properties": { "total_tokens": { "type": "integer" }, "input_tokens": { "type": "integer" }, "output_tokens": { "type": "integer" }, "total_cost_usd": { "type": "number", "format": "float" }, "duration_ms": { "type": "integer" }, "iteration_count": { "type": "integer" } } }, "AgentExecutionEventStatus": { "type": "string", "description": "Lifecycle status carried on an agent execution event.\n\nDeliberately narrower than `ExecutionStatus`, which is the stored status of\nthe execution row: `pending` and `running` both surface as `started`, and\n`cancelled` surfaces as `failed`. Consumers must not assume the two\nvocabularies are interchangeable.\n\n`queued` is non-terminal: the execution is waiting for executor capacity and will\nbe followed by `started`, and it can be published more than once if a throttled\nexecution is put back on the queue. Consumers must not treat it as an outcome.\n", "enum": [ "started", "queued", "completed", "failed", "approval_required" ] }, "AgentExecutionEvent": { "type": "object", "description": "Detail payload of the `agent-execution-status-update` event, published on\nthe AI Agents event bus with source `ai-agents`.\n\n`execution_context` and `input` are present on every status, so a consumer\ncan tell whether an execution is theirs, and what it belonged to, from the\nterminal event alone — without a secondary lookup.\n", "required": [ "executionId", "agentId", "orgId", "execution_status" ], "properties": { "executionId": { "type": "string", "description": "The agent execution this event reports on" }, "agentId": { "$ref": "#/components/schemas/AgentId" }, "orgId": { "type": "string" }, "userId": { "type": "string" }, "execution_status": { "$ref": "#/components/schemas/AgentExecutionEventStatus" }, "execution_context": { "$ref": "#/components/schemas/ExecutionContext" }, "input": { "type": "object", "additionalProperties": true, "description": "The execution input, as supplied by the caller of the execute endpoint" }, "output": { "type": "object", "additionalProperties": true, "description": "Present on `completed` — the execution result. A result too large for the event\n(above ~200 KB) is replaced by `{ result_ref: { bucket, key, bytes }, preview: { response } }`;\nread the full result with `GET /v1/executions/{execution_id}`.\n" }, "error": { "type": "object", "description": "Present on `failed`", "properties": { "message": { "type": "string" }, "code": { "type": "string" }, "stack": { "type": "string" } } }, "duration": { "type": "integer", "description": "Wall-clock duration in milliseconds, present on `completed`" }, "iterations": { "type": "integer" }, "iteration": { "type": "integer" }, "message": { "type": "string", "description": "Present on `approval_required` — what is awaiting approval" }, "toolCalls": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "args": { "type": "object", "additionalProperties": true } } } }, "timestamp": { "type": "string", "format": "date-time" } } }, "ToolPreview": { "type": "object", "description": "Structured preview data for approval UI. Provides a generic format that any tool can populate.", "properties": { "action": { "type": "object", "required": [ "type", "verb" ], "properties": { "type": { "$ref": "#/components/schemas/PreviewActionType" }, "verb": { "type": "string", "description": "Human-readable action verb", "example": "Move Thread" } } }, "source": { "$ref": "#/components/schemas/PreviewEntity" }, "target": { "$ref": "#/components/schemas/PreviewEntity" }, "changes": { "type": "array", "items": { "$ref": "#/components/schemas/PreviewChange" }, "description": "List of changes/modifications being made" }, "metadata": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/PreviewValue" }, "description": "Additional context information" }, "summary": { "type": "string", "description": "AI reasoning for why this action is recommended", "example": "This email discusses solar panel installation and should be handled by the Service team." } } }, "PreviewActionType": { "type": "string", "enum": [ "move", "create", "update", "delete", "apply", "send", "link", "unlink", "batch_approval" ], "description": "Type of action being previewed" }, "PreviewEntity": { "type": "object", "description": "Entity reference for preview display", "properties": { "type": { "type": "string", "description": "Entity type (e.g., \"inbox\", \"email\", \"contact\", \"label\")", "example": "inbox" }, "id": { "type": "string", "description": "Entity ID" }, "name": { "type": "string", "description": "Human-readable name for display", "example": "Support Inbox" }, "schema": { "type": "string", "description": "Entity schema (for epilot entities)" }, "icon": { "type": "string", "description": "Icon hint for UI" }, "url": { "type": "string", "description": "Optional URL to view the entity" } } }, "PreviewChange": { "type": "object", "description": "A single field change in the preview", "properties": { "field": { "type": "string", "description": "Field identifier" }, "label": { "type": "string", "description": "Human-readable field label" }, "from": { "$ref": "#/components/schemas/PreviewValue" }, "to": { "$ref": "#/components/schemas/PreviewValue" } } }, "PreviewValue": { "type": "object", "description": "Typed value for preview display", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "text", "number", "boolean", "list", "entity", "badge" ], "description": "Value type for proper rendering" }, "value": { "description": "The actual value (type depends on \"type\" field)" }, "values": { "type": "array", "items": { "type": "string" }, "description": "Array of values (for list type)" }, "id": { "type": "string", "description": "Entity ID (for entity type)" }, "name": { "type": "string", "description": "Display name (for entity type)" }, "schema": { "type": "string", "description": "Entity schema (for entity type)" }, "color": { "type": "string", "enum": [ "success", "warning", "error", "info" ], "description": "Badge color (for badge type)" } } }, "ToolDefinition": { "type": "object", "properties": { "tool_id": { "type": "string", "example": "entity.search" }, "name": { "type": "string", "example": "Search Entities" }, "description": { "type": "string", "description": "Description for LLM to understand tool purpose" }, "category": { "type": "string", "enum": [ "entity", "message", "taxonomy", "rag", "workflow" ] }, "parameters": { "type": "object", "description": "JSON Schema for tool input" }, "returns": { "type": "object", "description": "JSON Schema for tool output" }, "requires_approval": { "type": "boolean", "default": false, "description": "Whether this tool always requires human approval" }, "enabled": { "type": "boolean", "default": true } } }, "SkillCategory": { "type": "string", "enum": [ "message", "entity", "document", "classification", "custom" ] }, "AgentSource": { "type": "string", "enum": [ "system", "custom" ], "description": "- system: Pre-built by epilot (system skills)\n- custom: Created by organization\n" }, "SkillAvailability": { "type": "string", "enum": [ "flows", "copilot", "portals", "website", "all" ], "description": "Where the skill/agent is available:\n- flows: Available in workflow automations\n- copilot: Available as a sub-agent in copilot\n- portals: Available in end-user self-service portals\n- website: Website chat, explicitly selected; currently supports anonymous execution\n- all: Available on the existing non-website surfaces; website requires explicit selection\n" }, "ExecutionContext": { "type": "string", "enum": [ "flows", "copilot", "api", "sharing" ], "description": "Where the execution was triggered from:\n- flows: Triggered from workflow automation\n- copilot: Triggered from copilot assistant\n- api: Direct API call\n- sharing: Triggered by sharing-api auto-sharing rules\n" }, "ExecutionPattern": { "type": "string", "enum": [ "direct", "react" ], "description": "- direct: Single LLM call, no tools\n- react: Multi-step reasoning with tool use\n" }, "ExecutionMode": { "type": "string", "enum": [ "automatic", "approval", "draft" ], "description": "- automatic: Execute without human intervention\n- approval: Pause for human approval before tool execution\n- draft: Execute but mark output as draft for review\n" }, "ExecutionStatus": { "type": "string", "enum": [ "pending", "queued", "running", "waiting_approval", "completed", "failed", "cancelled" ] }, "ParameterType": { "type": "string", "enum": [ "text", "textarea", "number", "boolean", "select", "entity-schema", "entity-attribute", "entity-id", "taxonomy", "taxonomy-classification", "shared-inbox", "label", "matching-criteria", "journey-task", "journey", "journey-context" ], "description": "Base types:\n- text: Text input field\n- textarea: Multi-line text input field\n- number: Numeric input field\n- boolean: Toggle switch\n- select: Dropdown selection (requires enum array)\n\nCustom types (domain-specific):\n- entity-schema: Entity schema selector (fetches from Entity API)\n- entity-attribute: Entity attribute selector (requires dependsOn)\n- entity-id: Entity picker (search and select entities)\n- taxonomy: Taxonomy selector (fetches from Taxonomy API)\n- taxonomy-classification: Classification selector (requires dependsOn)\n- shared-inbox: Shared inbox selector (fetches from Email Settings API)\n- matching-criteria: Criteria editor for mapping compared fields between two contexts or entities\n- journey-task: A task of the same flow that carries a journey, stored as its task id (flow builder)\n- journey: A journey of the organisation, stored as its journey id (flow builder)\n- journey-context: Values for the context parameters of the journey another parameter names, stored as a list of {key, value}; a value is a literal or an entity variable over the flow's context such as {{ticket.customer}} (flow builder)\n" }, "InputParameterDefinition": { "type": "object", "required": [ "name", "label", "type" ], "properties": { "name": { "type": "string", "description": "Unique identifier for the parameter (used in API)", "example": "target_schema" }, "label": { "type": "string", "description": "Human-readable display label", "example": "Target Schema" }, "type": { "$ref": "#/components/schemas/ParameterType" }, "description": { "type": "string", "description": "Help text for the parameter" }, "default": { "description": "Default value for the parameter" }, "multi": { "type": "boolean", "default": false, "description": "Allow multiple selections (value becomes array)" }, "dependsOn": { "type": "string", "description": "Parent parameter this depends on (for entity-attribute, taxonomy-classification)" }, "visibleWhen": { "type": "object", "additionalProperties": { "type": "array" }, "description": "Conditional visibility rules (show when parent has specific values)" }, "enum": { "type": "array", "items": { "type": "string" }, "description": "Allowed values (required for 'select' type)" }, "minimum": { "type": "number", "description": "Minimum value (for number type)" }, "maximum": { "type": "number", "description": "Maximum value (for number type)" }, "step": { "type": "number", "description": "Step increment (for number type)" }, "minLength": { "type": "integer", "description": "Minimum length (for text type)" }, "maxLength": { "type": "integer", "description": "Maximum length (for text type)" }, "schemaFilter": { "type": "array", "items": { "type": "string" }, "description": "Filter to specific schemas (for entity-schema, entity-id)" }, "attributeTypeFilter": { "type": "array", "items": { "type": "string" }, "description": "Filter to specific attribute types (for entity-attribute)" }, "hidden": { "type": "boolean", "default": false, "description": "Whether to hide the parameter from the UI" } } }, "InputParametersSchema": { "type": "object", "required": [ "type", "parameters" ], "properties": { "type": { "type": "string", "enum": [ "object" ], "description": "Always \"object\"" }, "parameters": { "type": "array", "items": { "$ref": "#/components/schemas/InputParameterDefinition" }, "description": "Array of parameter definitions" }, "required": { "type": "array", "items": { "type": "string" }, "description": "Array of parameter names that are required" } }, "example": { "type": "object", "parameters": [ { "name": "target_schema", "label": "Target Schema", "type": "entity-schema", "description": "Entity type to create" }, { "name": "confidence_threshold", "label": "Confidence Threshold", "type": "number", "minimum": 0, "maximum": 1, "default": 0.8 }, { "name": "categories", "label": "Categories", "type": "select", "enum": [ "invoice", "contract", "letter" ], "multi": true } ], "required": [ "target_schema" ] } }, "ModelConfig": { "type": "object", "properties": { "model_id": { "type": "string", "default": "anthropic.claude-3-5-sonnet-20241022-v2:0", "description": "AWS Bedrock model ID" }, "temperature": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.7 }, "max_tokens": { "type": "integer", "default": 4096, "maximum": 8192 }, "thinking": { "type": "boolean", "default": false, "description": "Enable extended thinking/reasoning for the model" }, "thinking_budget": { "type": "integer", "default": 10000, "minimum": 1000, "maximum": 50000, "description": "Token budget for extended thinking (only used when thinking is enabled)" } } }, "Error": { "type": "object", "properties": { "error": { "type": "string" }, "code": { "type": "string", "description": "Machine-readable error code, where an operation documents one (e.g. `FEATURE_DISABLED`)" }, "message": { "type": "string" }, "details": { "type": "object" } } }, "AgentAuthAccessProfile": { "type": "string", "description": "Access profile of the agent's grant at the Access Token API (its ceiling)", "enum": [ "read", "config:read", "config:write", "data:read", "data:write", "full" ] }, "AgentAuthActivationRequest": { "type": "object", "required": [ "access_profile" ], "properties": { "access_profile": { "$ref": "#/components/schemas/AgentAuthAccessProfile" }, "reason": { "type": "string", "minLength": 10, "maxLength": 200, "description": "Purpose shown in the agent's token names and the admin view; required for any profile but `read`", "example": "Labels inbound emails and updates their tickets" } } }, "AgentAuthStatus": { "type": "object", "required": [ "status" ], "properties": { "status": { "type": "string", "enum": [ "inactive", "active", "expired" ] }, "agent_auth_agent_id": { "type": "string", "description": "The agent's id at the Access Token API" }, "activation_id": { "type": "string" }, "access_profile": { "$ref": "#/components/schemas/AgentAuthAccessProfile" }, "owner_user_id": { "type": "string", "description": "The admin who activated it; the agent acts with their current roles" }, "expires_at": { "type": "string", "format": "date-time", "description": "End of the activation's lifetime (90 days); it is not renewed automatically" }, "expiring_soon": { "type": "boolean", "description": "`active` and expiring within 14 days: an admin should activate the agent again, or its Flows runs fail\nwith `AGENT_IDENTITY_EXPIRED` once it has expired.\n" } } }, "ChatRequest": { "type": "object", "required": [ "agentId" ], "properties": { "agentId": { "type": "string", "description": "Agent ID to chat with" }, "message": { "type": "string", "description": "User message. Required unless `tool_approval` is set." }, "tool_approval": { "$ref": "#/components/schemas/ToolApprovalAnswer" }, "conversationId": { "type": "string", "format": "uuid", "description": "Conversation ID for server-side memory. If provided, loads history from DynamoDB." }, "clientHistory": { "type": "array", "items": { "$ref": "#/components/schemas/ChatMessage" }, "description": "Client-provided message history. A non-empty array overrides\nserver-side memory. Each item is a ChatMessage. Only the latest\n100 messages are used; any other shape is rejected.\n" }, "context": { "type": "object", "properties": { "entityId": { "type": "string" }, "customData": { "type": "object", "additionalProperties": true } } }, "streaming": { "$ref": "#/components/schemas/StreamingOptions" }, "preview_demo": { "type": "boolean", "description": "Agent Builder place-agent preview: when true, portal tools return\nsynthetic demo fixtures instead of calling customer-portal-api,\nand execution mode is forced to draft.\n" }, "agent_override": { "$ref": "#/components/schemas/AgentPreviewOverride" }, "portal_config_override": { "type": "object", "additionalProperties": true, "description": "Agent Builder preview of a portal Customer Chat agent: the unsaved\nplace configuration (same shape as the customer chat config\nupdate). It is validated and compiled like a save and used for\nthis request only; nothing is persisted. Requires preview_demo.\nNot supported for Website Chat agents.\n" } } }, "ToolApprovalAnswer": { "type": "object", "additionalProperties": false, "required": [ "token", "approved" ], "description": "The user's answer to an `approval_required` event (Luna behind the\n`luna-tool-approvals` flag). Requires the asking turn's `conversationId` and `agentId`; `message` may\nbe omitted. On approve the server runs exactly the pending tool call\nstored in the conversation, streams its `tool_call` / `tool_result`\nand continues the turn. Errors: `APPROVAL_INVALID`,\n`APPROVAL_EXPIRED`, `APPROVAL_USED`, `APPROVAL_UNAVAILABLE`.\n", "properties": { "token": { "type": "string", "description": "`approval.token` from the `approval_required` event" }, "approved": { "type": "boolean" }, "reason": { "type": "string", "maxLength": 1000, "description": "Optional reason, passed to the agent on decline" } } }, "ToolApprovalRequest": { "type": "object", "required": [ "id", "tool_id", "tool_call_id", "input", "expires_at", "token" ], "description": "A tool call waiting for the user's approval; the turn has ended.", "properties": { "id": { "type": "string" }, "tool_id": { "type": "string", "example": "entity.update" }, "tool_call_id": { "type": "string", "description": "`callId` of this call's `tool_call` / `tool_result` events" }, "title": { "type": "string", "description": "Human-readable tool name" }, "input": { "type": "object", "additionalProperties": true, "description": "The exact arguments that run on approve" }, "impact": { "type": "string" }, "preview": { "type": "object", "additionalProperties": true }, "expires_at": { "type": "string", "format": "date-time", "description": "10 minutes after the request" }, "token": { "type": "string", "description": "Signed, single-use; send back as `tool_approval.token`" } } }, "AgentPreviewOverride": { "allOf": [ { "$ref": "#/components/schemas/UpdateAgentRequest" } ], "description": "Agent Builder preview: unsaved editor settings applied to the saved\ncustom agent for this request only. Nothing is persisted. Requires\npreview_demo on /v1/chat and forces draft execution mode on\n/v1/agents/{agent_id}/execute/stream. Not supported for system skills\nor Website Chat agents.\n" }, "ChatMessage": { "type": "object", "required": [ "role", "content" ], "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "tool", "system" ] }, "content": { "type": "string" }, "tool_calls": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "input": { "type": "object" }, "output": { "type": "string" } } } } } }, "StreamingOptions": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "updates", "messages" ], "default": "updates", "description": "Stream mode - updates for step-based, messages for token-based" }, "streamTokens": { "type": "boolean", "default": false, "description": "Enable token-level streaming" }, "includeMetadata": { "type": "boolean", "default": false, "description": "Include metadata events" } } }, "StreamEvent": { "type": "object", "description": "Server-Sent Event for streaming responses", "properties": { "type": { "type": "string", "enum": [ "token", "agent_step", "tool_call", "tool_result", "complete", "error", "metadata", "needs_approval", "approval_required" ] }, "content": { "type": "string", "description": "Token content (for token events)" }, "approval": { "$ref": "#/components/schemas/ToolApprovalRequest" }, "index": { "type": "integer", "description": "Token index (for token events)" }, "tool": { "type": "string", "description": "Tool name (for tool events)" }, "input": { "type": "object", "description": "Tool input (for tool_call events)" }, "output": { "type": "string", "description": "Tool output (for tool_result events)" }, "callId": { "type": "string", "description": "Tool call ID" }, "result": { "$ref": "#/components/schemas/ExecutionResult" }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } } }, "conversationId": { "type": "string", "format": "uuid", "description": "Conversation ID (included in complete events)" } } }, "ExecutionResult": { "type": "object", "properties": { "response": { "type": "string" }, "structured_output": { "type": "object" }, "status": { "type": "string", "enum": [ "completed", "failed", "max_iterations", "rejected" ] }, "metrics": { "$ref": "#/components/schemas/ExecutionMetrics" } } }, "ConversationItem": { "type": "object", "properties": { "conversation_id": { "type": "string", "format": "uuid" }, "user_id": { "type": "string" }, "agent_id": { "type": "string" }, "title": { "type": "string" }, "message_count": { "type": "integer" }, "last_message": { "type": "string", "description": "Preview of the last message" }, "last_message_at": { "type": "string", "format": "date-time" }, "context": { "type": "object", "properties": { "entityId": { "type": "string" }, "customData": { "type": "object" } } }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } }, "MessageItem": { "type": "object", "properties": { "conversation_id": { "type": "string", "format": "uuid" }, "role": { "type": "string", "enum": [ "user", "assistant", "tool", "system" ] }, "content": { "type": "string" }, "timestamp": { "type": "string", "format": "date-time" }, "tool_calls": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "input": { "type": "object" }, "output": { "type": "string" } } } }, "token_count": { "type": "integer" }, "trace_id": { "type": "string", "format": "uuid", "description": "Langfuse trace id for the turn (assistant messages only)" }, "feedback": { "$ref": "#/components/schemas/MessageFeedback" } } }, "MessageFeedback": { "type": "object", "required": [ "rating", "user_id", "submitted_at" ], "properties": { "rating": { "type": "string", "enum": [ "up", "down" ] }, "comment": { "type": "string" }, "user_id": { "type": "string" }, "submitted_at": { "type": "string", "format": "date-time" } } }, "SubmitFeedbackRequest": { "type": "object", "required": [ "trace_id", "rating" ], "properties": { "trace_id": { "type": "string", "format": "uuid", "description": "Langfuse trace id of the assistant turn being rated" }, "rating": { "type": "string", "enum": [ "up", "down" ] }, "comment": { "type": "string", "description": "Optional free-text feedback" } } }, "CustomerChatConversation": { "type": "object", "required": [ "conversation_id", "user_id", "message_count", "last_message_at", "created_at", "ticket_ids" ], "properties": { "conversation_id": { "type": "string" }, "user_id": { "type": "string", "description": "Portal user who chatted" }, "contact_id": { "type": "string", "description": "The customer's contact, known once the agent created a ticket" }, "title": { "type": "string" }, "message_count": { "type": "integer" }, "last_message": { "type": "string" }, "last_message_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "ticket_ids": { "type": "array", "description": "Tickets the agent created in this conversation, oldest first", "items": { "type": "string" } } } }, "CustomerChatConversationMessage": { "type": "object", "required": [ "role", "content", "timestamp" ], "properties": { "role": { "type": "string", "enum": [ "user", "assistant" ] }, "content": { "type": "string" }, "timestamp": { "type": "string", "format": "date-time" } } }, "InternalPortalChat": { "description": "A v2 portal chat in v1's conversation shape", "allOf": [ { "$ref": "#/components/schemas/CustomerChatConversation" } ] }, "InternalPortalChatPlace": { "description": "Where a v2 portal chat is in the history's order", "type": "object", "required": [ "conversation_id", "updated_at" ], "properties": { "conversation_id": { "type": "string" }, "updated_at": { "type": "string", "format": "date-time", "description": "When its last message was stored (v1's `updated_at`), to the millisecond" } } }, "InternalPortalChats": { "type": "object", "required": [ "conversations", "has_more" ], "properties": { "conversations": { "type": "array", "items": { "$ref": "#/components/schemas/InternalPortalChatPlace" } }, "has_more": { "type": "boolean" }, "read_to": { "$ref": "#/components/schemas/InternalPortalChatPlace", "description": "Set when the page's bound ended the read before the page was full: the last chat it looked\nat. The chats after it are unread; continue after it.\n" } } }, "InternalPortalChatRows": { "type": "object", "required": [ "conversations" ], "properties": { "conversations": { "type": "array", "items": { "$ref": "#/components/schemas/InternalPortalChat" } } } }, "InternalPortalChatTranscript": { "type": "object", "required": [ "conversation", "messages" ], "properties": { "conversation": { "$ref": "#/components/schemas/InternalPortalChat" }, "messages": { "type": "array", "items": { "allOf": [ { "$ref": "#/components/schemas/CustomerChatConversationMessage" }, { "type": "object", "properties": { "blocked": { "type": "boolean", "description": "The customer's message screening blocked (v1 leaves it out of a transcript)" } } } ] } } } }, "ListCustomerChatConversationsResponse": { "type": "object", "required": [ "conversations" ], "properties": { "conversations": { "type": "array", "items": { "$ref": "#/components/schemas/CustomerChatConversation" } }, "next_cursor": { "type": "string" } } }, "CustomerChatConversationTranscript": { "type": "object", "required": [ "conversation", "messages" ], "properties": { "conversation": { "$ref": "#/components/schemas/CustomerChatConversation" }, "messages": { "type": "array", "items": { "$ref": "#/components/schemas/CustomerChatConversationMessage" } } } }, "ListConversationsResponse": { "type": "object", "properties": { "conversations": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationItem" } }, "next_cursor": { "type": "string", "nullable": true } } }, "ConversationWithMessages": { "type": "object", "properties": { "conversation": { "$ref": "#/components/schemas/ConversationItem" }, "messages": { "type": "array", "items": { "$ref": "#/components/schemas/MessageItem" } } } }, "SessionsError": { "type": "object", "description": "An error of the Sessions API", "required": [ "error" ], "properties": { "error": { "type": "object", "required": [ "message" ], "properties": { "message": { "type": "string" }, "issues": { "type": "array", "description": "`Invalid request`: what doesn't match", "items": { "$ref": "#/components/schemas/ValidationIssue" } }, "requestId": { "type": "string", "description": "The request's id, for support (internal errors)" } } } } }, "ValidationIssue": { "type": "object", "required": [ "code", "path", "message" ], "properties": { "code": { "type": "string" }, "path": { "type": "array", "description": "Where in the request", "items": { "anyOf": [ { "type": "string" }, { "type": "number" } ] } }, "message": { "type": "string" } } }, "RefusalDetails": { "type": "object", "required": [ "code", "message" ], "properties": { "code": { "type": "string", "enum": [ "not_enabled", "quota_exceeded", "refused", "portal_chat_off", "portal_chat_unavailable", "message_too_long", "screening_unavailable", "rate_limited", "usage_limit" ], "description": "`portal_chat_off`: the portal has no chat; `portal_chat_unavailable`: its chat's agent isn't one for\nportals, or can't answer; `message_too_long`: a portal customer's message or its page context is over\nv1's limits (4,000 characters, 8,000 of context); `screening_unavailable`: the customer's message\ncould not be checked here yet; `rate_limited`: a portal customer sends too many messages a minute;\n`usage_limit`: a portal customer, or their organization, reached the day's messages (v1's limits)\n" }, "message": { "type": "string", "description": "For the user" }, "limit": { "type": "string", "description": "`quota_exceeded`: which limit", "enum": [ "concurrent_sessions", "active_vms", "daily_budget" ] }, "retryAfterSeconds": { "type": "integer", "description": "`quota_exceeded`, `rate_limited`, `usage_limit`: seconds until it may work again (also the `retry-after` header)" } } }, "Refusal": { "description": "A refusal the client tells the user about; `error` repeats it, like every other error", "allOf": [ { "$ref": "#/components/schemas/RefusalDetails" }, { "type": "object", "required": [ "error" ], "properties": { "error": { "$ref": "#/components/schemas/RefusalDetails" } } } ] }, "RequestId": { "type": "string", "format": "uuid", "description": "The client's id for the request: sent again on a retry, it is taken once" }, "SessionStatus": { "type": "string", "description": "`starting`: its VM starts or the agent catches up; `failed`: its last turn couldn't run", "enum": [ "idle", "starting", "running", "failed" ] }, "SessionLiveInfo": { "type": "object", "description": "How to subscribe to the session's live messages on AppSync Events", "required": [ "transport", "httpHost", "realtimeUrl", "channel" ], "properties": { "transport": { "type": "string", "enum": [ "appsync" ] }, "httpHost": { "type": "string", "description": "Host of the Event API's HTTP endpoint (the `host` in the subscribe auth header)" }, "realtimeUrl": { "type": "string", "description": "WebSocket URL of the Event API" }, "channel": { "type": "string" } } }, "SessionView": { "type": "object", "required": [ "id", "agentId", "mode", "title", "createdAt", "updatedAt", "status" ], "properties": { "id": { "type": "string", "format": "uuid" }, "agentId": { "type": "string" }, "mode": { "type": "string", "description": "`read`: the user signed in read-only (or anonymized), so the agent only reads in this session", "enum": [ "read", "write" ] }, "title": { "type": "string", "nullable": true }, "origin": { "type": "string", "nullable": true, "description": "Where in the product the session was started, as given on create; null if none was given" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "status": { "$ref": "#/components/schemas/SessionStatus" }, "live": { "$ref": "#/components/schemas/SessionLiveInfo" } } }, "SessionOrigin": { "type": "string", "description": "Where in the product a session is started, e.g. `configuration-hub`", "pattern": "^[a-z0-9][a-z0-9._:-]{0,63}$", "example": "configuration-hub" }, "CreateInternalSessionRequest": { "type": "object", "required": [ "origin", "owner", "unattended", "input" ], "properties": { "agentId": { "type": "string", "minLength": 1, "description": "Default `luna`, the agent Configuration Hub uses" }, "origin": { "$ref": "#/components/schemas/SessionOrigin" }, "owner": { "type": "object", "required": [ "user_id" ], "properties": { "user_id": { "type": "string", "description": "The user in the session's organization who owns the session and may continue it" } } }, "unattended": { "type": "boolean", "enum": [ true ] }, "client_token": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Idempotency key of the caller. A retry with the same key in the same organization gets the session the first request created." }, "input": { "type": "object", "required": [ "text", "context" ], "properties": { "text": { "type": "string", "minLength": 1, "maxLength": 20000 }, "context": { "type": "object", "required": [ "intent" ], "properties": { "intent": { "type": "string", "example": "blueprint-tests.suggest" } }, "additionalProperties": true } } } } }, "CreateInternalExecutionRequest": { "type": "object", "required": [ "execution_id", "agent_id", "input" ], "properties": { "execution_id": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The execution's id (`AgentExecutionsTable`); a retry with the same id gets the same session" }, "agent_id": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The organization's configured agent (`AgentConfigsTable`), available for Flows" }, "input": { "type": "object", "required": [ "text" ], "properties": { "text": { "type": "string", "minLength": 1, "maxLength": 100000, "description": "The run's first message, as v1 builds it from the parameters and the Flows context" }, "context": { "type": "object", "additionalProperties": true } } }, "mode": { "type": "string", "enum": [ "automatic", "approval", "draft" ], "description": "The run's mode (the execution's override, else its agent's). An agent with v1 write tools runs on v2 in `automatic` mode (its writes approved by the run, as v1 runs them) or `approval` mode (a person decides each, through the execution's approve and reject), or `draft` mode (its changes proposed as v1 proposes them, never made); without a mode it is refused." }, "skill": { "type": "object", "description": "A system skill's (`skill:*`) definition as the agents API resolved it (its instructions with their tool reference, its v1 tools, its result schema). Required for `skill:*` agents, refused for any other.", "required": [ "instructions", "tools" ], "properties": { "instructions": { "type": "string", "maxLength": 200000 }, "tools": { "type": "array", "maxItems": 100, "items": { "type": "string" } }, "output_schema": { "type": "object", "additionalProperties": true } } }, "parameters": { "type": "object", "additionalProperties": true, "description": "The run's parameters, as v1's tools read them" }, "flows": { "type": "object", "description": "The flow the run is for, as v1's tools read it (the attribution of their changes)", "properties": { "workflow_id": { "type": "string", "maxLength": 200 }, "workflow_name": { "type": "string", "maxLength": 500 }, "workflow_execution_id": { "type": "string", "maxLength": 200 }, "task_id": { "type": "string", "maxLength": 200 } } } } }, "ExecutionDecisionRequest": { "type": "object", "required": [ "approval_id", "approved", "decided_by" ], "properties": { "approval_id": { "type": "string", "description": "The approval the record's `pending_action.callback_id` names (`v2:`)" }, "approved": { "type": "boolean" }, "reason": { "type": "string", "maxLength": 2000 }, "decided_by": { "type": "string", "description": "The user who decided" } } }, "ExecutionDecision": { "type": "object", "required": [ "approval" ], "properties": { "approval": { "type": "object", "required": [ "id", "status" ], "properties": { "id": { "type": "string" }, "status": { "type": "string" } } } } }, "CreatedInternalExecution": { "type": "object", "required": [ "session_id" ], "properties": { "session_id": { "type": "string", "format": "uuid" } } }, "CreatedInternalSession": { "type": "object", "required": [ "id", "unattended_access" ], "properties": { "id": { "type": "string", "format": "uuid" }, "unattended_access": { "type": "boolean", "description": "`true`: the session has epilot access of its own and is working on the instruction.\n`false`: it has none (an unattended agent can't be registered yet), so it doesn't\nstart: the instruction is stored as the first message, and the session waits for its\nowner, whose first message runs it, with their access and their approval of each change.\n" } } }, "InternalSessionStatus": { "type": "object", "required": [ "id", "state", "needs", "attended", "last_activity_at", "turns" ], "properties": { "id": { "type": "string", "format": "uuid" }, "state": { "type": "string", "enum": [ "working", "needs_owner", "idle", "failed" ], "description": "`working`: a turn is scheduled or running, or an automatic continuation is about to start one.\n`needs_owner`: nothing runs, and the session can't go on without its owner (see `needs`).\n`idle`: the last turn ended and nothing is pending.\n`failed`: the last turn failed, or the automatic continuations reached their cap, and nothing runs.\n" }, "needs": { "type": "string", "nullable": true, "enum": [ "first_message", "approval", "answer", null ], "description": "With `needs_owner` only, else null. `first_message`: the session has no epilot access of\nits own and waits for its owner's first message; `approval`: an approval card is pending;\n`answer`: a question (`ask_user`) is pending.\n" }, "attended": { "type": "boolean", "description": "Whether the owner has sent the session an input (it is theirs from then on)" }, "last_activity_at": { "type": "string", "format": "date-time", "description": "When the session's newest event or input happened" }, "turns": { "type": "integer", "minimum": 0, "description": "How many turns have started in the session" } } }, "SessionResponse": { "type": "object", "required": [ "session" ], "properties": { "session": { "$ref": "#/components/schemas/SessionView" } } }, "SessionList": { "type": "object", "required": [ "sessions" ], "properties": { "sessions": { "type": "array", "items": { "$ref": "#/components/schemas/SessionView" } } } }, "CreatedSession": { "type": "object", "required": [ "session", "events" ], "properties": { "session": { "$ref": "#/components/schemas/SessionView" }, "events": { "type": "array", "items": { "$ref": "#/components/schemas/ClientEvent" } }, "inputEventId": { "$ref": "#/components/schemas/InputEventId" } } }, "SessionEventsPage": { "type": "object", "required": [ "events", "lastSeq", "hasMore", "status" ], "properties": { "events": { "type": "array", "items": { "$ref": "#/components/schemas/ClientEvent" } }, "lastSeq": { "type": "integer", "description": "The `seq` this page ends at; ask again `after` it while `hasMore`" }, "hasMore": { "type": "boolean" }, "status": { "$ref": "#/components/schemas/SessionStatus" } } }, "MessageInput": { "type": "object", "description": "The user's message, its text (trimmed), its files, or both", "properties": { "text": { "type": "string", "maxLength": 20000, "default": "" }, "context": { "type": "object", "description": "Where the user is (page, record); given to the agent, not shown as the user's words", "additionalProperties": true }, "files": { "type": "array", "description": "Uploads (`createSessionUpload`) to attach, by `fileId`", "maxItems": 5, "items": { "type": "string", "format": "uuid" } } } }, "CreatePortalSessionRequest": { "type": "object", "description": "A portal chat; the portal's settings choose its agent.", "properties": { "requestId": { "type": "string", "format": "uuid", "description": "The client's id for this request; a retry with it gets the same chat" }, "input": { "type": "object", "description": "The customer's first message", "required": [ "text" ], "properties": { "text": { "type": "string", "minLength": 1, "maxLength": 20000 }, "context": { "type": "object", "additionalProperties": true, "description": "What the customer is looking at (the portal page), passed to the agent" } } } } }, "PortalChatConfig": { "type": "object", "required": [ "agent" ], "properties": { "agent": { "type": "object", "nullable": true, "description": "How the portal's chat introduces itself; null when the portal has none", "properties": { "name": { "type": "string" }, "greeting": { "type": "string" }, "conversation_starters": { "type": "array", "items": { "type": "string" } }, "language": { "type": "string" }, "formality": { "type": "string" } } } } }, "CreateSessionRequest": { "type": "object", "required": [ "agentId" ], "properties": { "agentId": { "type": "string", "minLength": 1 }, "requestId": { "$ref": "#/components/schemas/RequestId" }, "origin": { "$ref": "#/components/schemas/SessionOrigin" }, "input": { "$ref": "#/components/schemas/MessageInput" }, "prepare": { "type": "boolean", "description": "Get the session ready for a first message the user still types. Needs `requestId`, no `input`." } } }, "RenameSessionRequest": { "type": "object", "required": [ "title" ], "properties": { "title": { "type": "string", "description": "Trimmed", "minLength": 1, "maxLength": 200, "pattern": "\\S" } } }, "ClientInput": { "description": "The user's input to a session", "oneOf": [ { "$ref": "#/components/schemas/UserMessageInput" }, { "$ref": "#/components/schemas/UserApprovalInput" }, { "$ref": "#/components/schemas/UserAnswerInput" }, { "$ref": "#/components/schemas/UserInterruptInput" } ], "discriminator": { "propertyName": "type", "mapping": { "user.message": "#/components/schemas/UserMessageInput", "user.approval": "#/components/schemas/UserApprovalInput", "user.answer": "#/components/schemas/UserAnswerInput", "user.interrupt": "#/components/schemas/UserInterruptInput" } } }, "UserMessageInput": { "description": "A message. It closes open questions and expires pending approvals.", "allOf": [ { "$ref": "#/components/schemas/MessageInput" }, { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "user.message" ] }, "requestId": { "$ref": "#/components/schemas/RequestId" } } } ] }, "UserApprovalInput": { "type": "object", "description": "Approves or rejects what the agent asked to do (`approval.required`)", "required": [ "type", "approvalId", "approved" ], "properties": { "type": { "type": "string", "enum": [ "user.approval" ] }, "approvalId": { "type": "string", "format": "uuid" }, "approved": { "type": "boolean" }, "reason": { "type": "string", "maxLength": 2000 } } }, "UserAnswerInput": { "type": "object", "description": "The user's answers to the agent's questions (`question.asked`), one per question", "required": [ "type", "questionId", "answers" ], "properties": { "type": { "type": "string", "enum": [ "user.answer" ] }, "questionId": { "type": "string", "format": "uuid" }, "answers": { "type": "array", "minItems": 1, "maxItems": 4, "items": { "$ref": "#/components/schemas/Answer" } } } }, "UserInterruptInput": { "type": "object", "description": "Stops the agent's turn", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "user.interrupt" ] }, "requestId": { "$ref": "#/components/schemas/RequestId" } } }, "InputEventId": { "type": "string", "format": "uuid", "description": "The input as stored (a message, also a blocked one or a retry's first attempt; an approval decision; answers): the turn that answers it names it on `turn.started` and `turn.ended` (`inputEventId`), so a client follows this input's turn and no other's." }, "SessionInputAccepted": { "description": "What was accepted: a message or an interrupt, an approval decision, or answers", "oneOf": [ { "type": "object", "required": [ "accepted" ], "properties": { "accepted": { "type": "boolean", "enum": [ true ] }, "blocked": { "type": "boolean", "description": "Portal chats: screening blocked the message. Its turn (the message, v1's fixed reply, its end) is already stored." }, "inputEventId": { "$ref": "#/components/schemas/InputEventId" } } }, { "type": "object", "required": [ "approval" ], "properties": { "approval": { "type": "object", "required": [ "id", "status" ], "properties": { "id": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "pending", "approved", "rejected", "executed", "expired" ] } } }, "inputEventId": { "$ref": "#/components/schemas/InputEventId" } } }, { "type": "object", "required": [ "question" ], "properties": { "inputEventId": { "$ref": "#/components/schemas/InputEventId" }, "question": { "type": "object", "required": [ "id", "status" ], "properties": { "id": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "pending", "answered", "dismissed" ] } } } } } ] }, "UploadRequest": { "type": "object", "required": [ "name", "mediaType", "size" ], "properties": { "name": { "type": "string", "description": "Trimmed, and made safe as a file name", "minLength": 1, "maxLength": 200, "pattern": "\\S" }, "mediaType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf", "text/csv", "text/plain", "text/markdown", "application/json", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ] }, "size": { "type": "integer", "description": "In bytes; the upload URL takes exactly this many", "minimum": 1, "maximum": 10485760 } } }, "SessionUpload": { "type": "object", "required": [ "file", "upload" ], "properties": { "file": { "$ref": "#/components/schemas/FileRef" }, "upload": { "type": "object", "description": "`PUT` the file's bytes to `url` with `headers`, before the link expires", "required": [ "method", "url", "headers" ], "properties": { "method": { "type": "string", "enum": [ "PUT" ] }, "url": { "type": "string" }, "headers": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "FileRef": { "type": "object", "description": "A file in a session", "required": [ "fileId", "name", "mediaType", "size" ], "properties": { "fileId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "mediaType": { "type": "string" }, "size": { "type": "integer", "minimum": 0 } } }, "SessionFileUrl": { "type": "object", "required": [ "url", "expiresAt" ], "properties": { "url": { "type": "string" }, "expiresAt": { "type": "string", "format": "date-time" } } }, "RunScriptRequest": { "type": "object", "required": [ "language", "script", "description" ], "properties": { "language": { "type": "string", "enum": [ "javascript", "python" ] }, "script": { "type": "string", "minLength": 1, "maxLength": 100000 }, "description": { "type": "string", "description": "What the script does, for the user (trimmed)", "minLength": 1, "maxLength": 200, "pattern": "\\S" }, "waitMs": { "type": "integer", "description": "How long to wait for the result, in milliseconds", "minimum": 0, "maximum": 20000 } } }, "ScriptRunView": { "type": "object", "required": [ "runId", "status" ], "properties": { "runId": { "type": "string" }, "status": { "type": "string", "enum": [ "running", "done", "failed" ] }, "output": { "type": "string", "description": "How the run ended: what the script printed, its result, its exit" }, "changes": { "type": "integer", "description": "Changes the script recorded, not applied; `applyScriptRun` applies them", "minimum": 0 } } }, "ApplyScriptRunRequest": { "type": "object", "required": [ "approvalSummary" ], "properties": { "approvalSummary": { "type": "string", "description": "What the user confirmed (trimmed)", "minLength": 1, "maxLength": 300, "pattern": "\\S" } } }, "ScriptApplyResult": { "type": "object", "required": [ "done", "applied", "total" ], "properties": { "done": { "type": "boolean", "description": "False while changes are left; call again" }, "applied": { "type": "integer", "description": "Changes that ran so far" }, "total": { "type": "integer" }, "result": { "type": "object", "description": "When done: what the batch did", "required": [ "content", "isError" ], "properties": { "content": { "type": "array", "items": { "$ref": "#/components/schemas/ContentPart" } }, "isError": { "type": "boolean" } } } } }, "ContentPart": { "oneOf": [ { "$ref": "#/components/schemas/TextContentPart" }, { "$ref": "#/components/schemas/ImageContentPart" }, { "$ref": "#/components/schemas/ThinkingContentPart" }, { "$ref": "#/components/schemas/ToolCallContentPart" } ], "discriminator": { "propertyName": "type", "mapping": { "text": "#/components/schemas/TextContentPart", "image": "#/components/schemas/ImageContentPart", "thinking": "#/components/schemas/ThinkingContentPart", "tool_call": "#/components/schemas/ToolCallContentPart" } } }, "TextContentPart": { "type": "object", "required": [ "type", "text" ], "properties": { "type": { "type": "string", "enum": [ "text" ] }, "text": { "type": "string" } } }, "ImageContentPart": { "type": "object", "required": [ "type", "mimeType" ], "properties": { "type": { "type": "string", "enum": [ "image" ] }, "mimeType": { "type": "string" }, "data": { "type": "string", "description": "Base64 data of a small image" }, "key": { "type": "string" } } }, "ThinkingContentPart": { "type": "object", "required": [ "type", "thinking" ], "properties": { "type": { "type": "string", "enum": [ "thinking" ] }, "thinking": { "type": "string" }, "redacted": { "type": "boolean" } } }, "ToolCallContentPart": { "type": "object", "required": [ "type", "id", "name", "arguments" ], "properties": { "type": { "type": "string", "enum": [ "tool_call" ] }, "id": { "type": "string" }, "name": { "type": "string" }, "arguments": { "type": "object", "additionalProperties": true } } }, "SessionErrorCode": { "type": "string", "description": "Why a turn or an input failed, for the user's copy", "enum": [ "model_unavailable", "tool_timeout", "turn_timeout", "wake_failed", "boot_failed", "workspace_lost", "budget_exceeded", "internal" ] }, "ContextBreakdown": { "type": "object", "description": "What filled the model's context on one call, in tokens", "required": [ "window", "parts" ], "properties": { "window": { "type": "integer", "description": "The model's context window" }, "parts": { "type": "object", "properties": { "instructions": { "type": "integer" }, "user": { "type": "integer" }, "replies": { "type": "integer" }, "thinking": { "type": "integer" }, "toolCalls": { "type": "integer" }, "toolResults": { "type": "integer" }, "files": { "type": "integer" }, "summary": { "type": "integer" } } } } }, "BatchChange": { "type": "object", "description": "A change the agent asks to make, exactly as it will run", "required": [ "operationId", "method", "path", "effect" ], "properties": { "operationId": { "type": "string" }, "service": { "type": "string" }, "method": { "type": "string" }, "path": { "type": "string" }, "effect": { "type": "string", "enum": [ "read", "write", "config", "destructive" ] }, "pathParameters": { "type": "object", "additionalProperties": true }, "queryParameters": { "type": "object", "additionalProperties": true }, "body": { "description": "The request body" }, "title": { "type": "string", "description": "The name of the record it changes" } } }, "ChangeOutcome": { "type": "object", "description": "What happened to one change of an approved batch", "required": [ "change", "status", "operationId" ], "properties": { "change": { "type": "integer", "minimum": 0 }, "status": { "type": "string", "enum": [ "ok", "failed", "skipped" ] }, "operationId": { "type": "string" }, "error": { "type": "string" }, "mayHaveRun": { "type": "boolean", "description": "A failed change whose result was lost; it may have taken effect" }, "record": { "type": "object", "properties": { "_id": { "type": "string" }, "_title": { "type": "string" }, "_schema": { "type": "string" } } } } }, "Question": { "type": "object", "required": [ "header", "question", "options" ], "properties": { "header": { "type": "string", "description": "A short label for the question" }, "question": { "type": "string" }, "multiSelect": { "type": "boolean", "description": "Several options may be picked" }, "options": { "type": "array", "minItems": 2, "maxItems": 4, "items": { "type": "object", "required": [ "label" ], "properties": { "label": { "type": "string" }, "description": { "type": "string" } } } } } }, "Answer": { "type": "object", "description": "One answer per question, in order: the labels picked, and/or the user's own words", "required": [ "selected" ], "properties": { "selected": { "type": "array", "maxItems": 4, "items": { "type": "string", "maxLength": 60 } }, "other": { "type": "string", "maxLength": 1000 } } }, "ClientEvent": { "description": "What a client sees of a session's history. Every event carries the `seq` of the stored event it comes\nfrom, so history, live messages and reconnects can overlap and a client applies each event once.\n", "oneOf": [ { "$ref": "#/components/schemas/ClientEventInput" }, { "$ref": "#/components/schemas/ClientEventInputTaken" }, { "$ref": "#/components/schemas/ClientEventInputCancelled" }, { "$ref": "#/components/schemas/ClientEventInputFailed" }, { "$ref": "#/components/schemas/ClientEventTurnStarted" }, { "$ref": "#/components/schemas/ClientEventModelUsage" }, { "$ref": "#/components/schemas/ClientEventContextCompacted" }, { "$ref": "#/components/schemas/ClientEventTurnEnded" }, { "$ref": "#/components/schemas/ClientEventMessage" }, { "$ref": "#/components/schemas/ClientEventStepStarted" }, { "$ref": "#/components/schemas/ClientEventStepFinished" }, { "$ref": "#/components/schemas/ClientEventSkillLoaded" }, { "$ref": "#/components/schemas/ClientEventApprovalRequired" }, { "$ref": "#/components/schemas/ClientEventApprovalResolved" }, { "$ref": "#/components/schemas/ClientEventApprovalExecuted" }, { "$ref": "#/components/schemas/ClientEventApprovalResult" }, { "$ref": "#/components/schemas/ClientEventQuestionAsked" }, { "$ref": "#/components/schemas/ClientEventFilesCreated" }, { "$ref": "#/components/schemas/ClientEventQuestionAnswered" } ], "discriminator": { "propertyName": "type", "mapping": { "input": "#/components/schemas/ClientEventInput", "input.taken": "#/components/schemas/ClientEventInputTaken", "input.cancelled": "#/components/schemas/ClientEventInputCancelled", "input.failed": "#/components/schemas/ClientEventInputFailed", "turn.started": "#/components/schemas/ClientEventTurnStarted", "model.usage": "#/components/schemas/ClientEventModelUsage", "context.compacted": "#/components/schemas/ClientEventContextCompacted", "turn.ended": "#/components/schemas/ClientEventTurnEnded", "message": "#/components/schemas/ClientEventMessage", "step.started": "#/components/schemas/ClientEventStepStarted", "step.finished": "#/components/schemas/ClientEventStepFinished", "skill.loaded": "#/components/schemas/ClientEventSkillLoaded", "approval.required": "#/components/schemas/ClientEventApprovalRequired", "approval.resolved": "#/components/schemas/ClientEventApprovalResolved", "approval.executed": "#/components/schemas/ClientEventApprovalExecuted", "approval.result": "#/components/schemas/ClientEventApprovalResult", "question.asked": "#/components/schemas/ClientEventQuestionAsked", "files.created": "#/components/schemas/ClientEventFilesCreated", "question.answered": "#/components/schemas/ClientEventQuestionAnswered" } } }, "ClientEventBase": { "type": "object", "required": [ "seq", "eventId", "occurredAt" ], "properties": { "seq": { "type": "integer" }, "eventId": { "type": "string" }, "occurredAt": { "type": "string", "format": "date-time" }, "blocked": { "type": "boolean", "description": "Of a portal customer's message that screening blocked: a turn of its own (the message, its fixed reply, its end), stored at once, that the agent never saw. A client following its own message's turn skips another sender's." }, "inputEventId": { "type": "string", "description": "The input this event is about. On `turn.started` and `turn.ended`: the input the turn answers (as the send answered its id), also when it resumed after a crash or failed; none for turns of older runners. On every event of a blocked turn: its own input's id." } } }, "ClientEventInput": { "description": "The user's message, or their interrupt", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "input" ], "properties": { "type": { "type": "string", "enum": [ "input" ] }, "input": { "oneOf": [ { "type": "object", "required": [ "kind", "text" ], "properties": { "kind": { "type": "string", "enum": [ "message" ] }, "text": { "type": "string" }, "files": { "type": "array", "items": { "$ref": "#/components/schemas/FileRef" } } } }, { "type": "object", "required": [ "kind" ], "properties": { "kind": { "type": "string", "enum": [ "interrupt" ] } } } ] } } } ] }, "ClientEventInputTaken": { "description": "The agent took the user's message `inputEventId`, where it reads it", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "inputEventId" ], "properties": { "type": { "type": "string", "enum": [ "input.taken" ] }, "inputEventId": { "type": "string" } } } ] }, "ClientEventInputCancelled": { "description": "The message will not be answered: the user stopped the turn, or the session was deleted", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "inputEventId", "reason" ], "properties": { "type": { "type": "string", "enum": [ "input.cancelled" ] }, "inputEventId": { "type": "string" }, "reason": { "type": "string", "enum": [ "stopped", "deleted" ] } } } ] }, "ClientEventInputFailed": { "description": "The message failed again and again and was skipped, so the session goes on", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "inputEventId", "errorCode", "error" ], "properties": { "type": { "type": "string", "enum": [ "input.failed" ] }, "inputEventId": { "type": "string" }, "errorCode": { "$ref": "#/components/schemas/SessionErrorCode" }, "error": { "type": "string" } } } ] }, "ClientEventTurnStarted": { "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "turn.started" ] } } } ] }, "ClientEventModelUsage": { "description": "One model call: what it read and wrote, and what filled its context", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "usage" ], "properties": { "type": { "type": "string", "enum": [ "model.usage" ] }, "usage": { "type": "object", "required": [ "input", "output", "cacheRead", "cacheWrite" ], "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" } } }, "context": { "$ref": "#/components/schemas/ContextBreakdown" } } } ] }, "ClientEventContextCompacted": { "description": "Older messages were summarized to make room; the context held `tokensBefore` until then", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "tokensBefore" ], "properties": { "type": { "type": "string", "enum": [ "context.compacted" ] }, "tokensBefore": { "type": "number" } } } ] }, "ClientEventTurnEnded": { "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "reason" ], "properties": { "type": { "type": "string", "enum": [ "turn.ended" ] }, "reason": { "type": "string", "enum": [ "done", "stopped", "failed" ] }, "error": { "type": "string", "description": "Details only; `errorCode` is for the user's copy" }, "errorCode": { "$ref": "#/components/schemas/SessionErrorCode" }, "cutOff": { "type": "boolean", "description": "The answer stopped at the model's output limit; the user can ask it to continue" } } } ] }, "ClientEventMessage": { "description": "The agent's answer", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "text" ], "properties": { "type": { "type": "string", "enum": [ "message" ] }, "text": { "type": "string" }, "reasoning": { "type": "string" }, "reasoningMs": { "type": "number", "description": "How long the model thought before it answered" } } } ] }, "ClientEventStepStarted": { "description": "The agent calls a tool", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "stepId", "tool", "input" ], "properties": { "type": { "type": "string", "enum": [ "step.started" ] }, "stepId": { "type": "string" }, "tool": { "type": "string" }, "input": { "type": "object", "additionalProperties": true } } } ] }, "ClientEventStepFinished": { "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "stepId", "tool", "ok", "output" ], "properties": { "type": { "type": "string", "enum": [ "step.finished" ] }, "stepId": { "type": "string" }, "tool": { "type": "string" }, "ok": { "type": "boolean" }, "output": { "type": "string" }, "marker": { "type": "string", "description": "Why the runtime wrote the result instead of the tool", "enum": [ "interrupted", "may_have_run" ] } } } ] }, "ClientEventSkillLoaded": { "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "skill" ], "properties": { "type": { "type": "string", "enum": [ "skill.loaded" ] }, "skill": { "type": "string" }, "version": { "type": "string" }, "stepId": { "type": "string", "description": "The read that loaded it; a client shows the skill instead of that step" } } } ] }, "ClientEventApprovalRequired": { "description": "The agent asks to make changes: approve or reject with `user.approval`", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "approvalId", "stepId", "tool", "summary" ], "properties": { "type": { "type": "string", "enum": [ "approval.required" ] }, "approvalId": { "type": "string" }, "stepId": { "type": "string" }, "tool": { "type": "string" }, "summary": { "type": "string" }, "changes": { "type": "array", "description": "A batch: every change, exactly as it will run", "items": { "$ref": "#/components/schemas/BatchChange" } }, "executionId": { "type": "string", "description": "The script that recorded the batch" }, "call": { "$ref": "#/components/schemas/BatchChange" }, "card": { "type": "object", "additionalProperties": true, "description": "What the card shows besides the summary (a portal quick action - its tile)" } } } ] }, "ClientEventApprovalResolved": { "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "approvalId", "approved" ], "properties": { "type": { "type": "string", "enum": [ "approval.resolved" ] }, "approvalId": { "type": "string" }, "approved": { "type": "boolean" }, "reason": { "type": "string" } } } ] }, "ClientEventApprovalExecuted": { "description": "An approved batch ran: every change ran, or it stopped at the first failure", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "approvalId", "stepId", "applied", "total", "complete", "changes" ], "properties": { "type": { "type": "string", "enum": [ "approval.executed" ] }, "approvalId": { "type": "string" }, "stepId": { "type": "string" }, "applied": { "type": "integer" }, "total": { "type": "integer" }, "complete": { "type": "boolean" }, "stopped": { "type": "boolean" }, "changes": { "type": "array", "items": { "$ref": "#/components/schemas/ChangeOutcome" } } } } ] }, "ClientEventApprovalResult": { "description": "An approved single call ran: its result, as `step.finished` shows a step's (a client reads its markers there, e.g. a portal's ticket or open directive)", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "approvalId", "stepId", "tool", "ok", "output" ], "properties": { "type": { "type": "string", "enum": [ "approval.result" ] }, "approvalId": { "type": "string" }, "stepId": { "type": "string" }, "tool": { "type": "string" }, "ok": { "type": "boolean" }, "output": { "type": "string" } } } ] }, "ClientEventQuestionAsked": { "description": "The agent asks the user: answer with `user.answer`", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "questionId", "stepId", "questions" ], "properties": { "type": { "type": "string", "enum": [ "question.asked" ] }, "questionId": { "type": "string" }, "stepId": { "type": "string" }, "questions": { "type": "array", "items": { "$ref": "#/components/schemas/Question" } } } } ] }, "ClientEventFilesCreated": { "description": "Files the agent wrote for the user in this turn", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "files" ], "properties": { "type": { "type": "string", "enum": [ "files.created" ] }, "files": { "type": "array", "items": { "$ref": "#/components/schemas/FileRef" } } } } ] }, "ClientEventQuestionAnswered": { "description": "Answered, or `dismissed`: the user wrote a message instead", "allOf": [ { "$ref": "#/components/schemas/ClientEventBase" }, { "type": "object", "required": [ "type", "questionId" ], "properties": { "type": { "type": "string", "enum": [ "question.answered" ] }, "questionId": { "type": "string" }, "answers": { "type": "array", "items": { "$ref": "#/components/schemas/Answer" } }, "dismissed": { "type": "boolean" } } } ] } } } }