openapi: 3.0.3 info: title: AgentZero Gateway API description: | RESTful API for the AgentZero AI agent runtime. ## Overview AgentZero provides a multi-agent orchestration platform with support for: - Agent configuration and management - Session-based conversations with context preservation - Real-time event streaming via SSE - MCP (Model Context Protocol) server integration - Webhook integrations for external platforms ## Authentication Currently, the API does not require authentication. This will be added in a future release. ## Base URLs - HTTP API: `http://localhost:18791` - WebSocket: `ws://localhost:18791/ws` version: 0.1.0 contact: name: AgentZero license: name: MIT servers: - url: http://localhost:18791 description: Local development server tags: - name: Health description: Health check and status endpoints - name: Gateway description: Session submission and control for agent execution - name: Agents description: Agent configuration CRUD operations - name: Sessions description: Session and execution state management - name: Conversations description: Conversation and message history - name: Skills description: Skill configuration CRUD operations - name: Providers description: LLM provider configuration - name: MCP Servers description: Model Context Protocol server management - name: Connectors description: External connector/bridge management for bidirectional messaging - name: Cron description: Scheduled job management for automated agent triggers - name: Tools description: Available tools and settings - name: Events description: Server-Sent Events for real-time updates - name: Webhooks description: Webhook endpoints for external integrations - name: Cleanup description: Bounded admin operations that clear vault-owned ephemeral storage paths: # ============================================================================ # Health Endpoints # ============================================================================ /api/health: get: tags: [Health] summary: Health check description: Basic health check endpoint operationId: healthCheck responses: '200': description: Server is healthy content: application/json: schema: $ref: '#/components/schemas/HealthResponse' /api/status: get: tags: [Health] summary: Detailed status description: Detailed server status including agent count operationId: getStatus responses: '200': description: Server status content: application/json: schema: $ref: '#/components/schemas/StatusResponse' # ============================================================================ # Cleanup Endpoints # ============================================================================ /api/cleanup/vault-temp: post: tags: [Cleanup] summary: Clean the vault temp directory description: | Wipes `/temp/`, either entirely or just files older than N hours. Recurses into subdirectories and removes them once their contents are gone. Symlinks are deleted as links and never followed. Path is hardcoded to `VaultPaths::temp_dir()` — no caller-supplied paths. operationId: cleanupVaultTemp requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/CleanupTempRequest' examples: wipeAll: summary: Wipe everything in /temp value: {} olderThan24h: summary: Delete files older than 24 hours value: olderThanHours: 24 responses: '200': description: Cleanup completed (errors during the walk are counted, not raised) content: application/json: schema: $ref: '#/components/schemas/CleanupTempResponse' # ============================================================================ # Gateway Bus Endpoints (Session Control) # ============================================================================ /api/gateway/submit: post: tags: [Gateway] summary: Submit a session description: | Submit a new session or continue an existing one. This is the main entry point for executing agent requests. operationId: submitSession requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SessionRequest' responses: '200': description: Session submitted successfully content: application/json: schema: $ref: '#/components/schemas/SessionHandle' '400': description: Invalid request (agent or provider error) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/gateway/status/{session_id}: get: tags: [Gateway] summary: Get session status description: Get the current status of a session operationId: getSessionStatus parameters: - name: session_id in: path required: true schema: type: string description: Session ID (e.g., sess-abc123) responses: '200': description: Session status content: application/json: schema: $ref: '#/components/schemas/SessionStatusResponse' '404': description: Session not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/gateway/cancel/{session_id}: post: tags: [Gateway] summary: Cancel a session description: Cancel a running session operationId: cancelSession parameters: - name: session_id in: path required: true schema: type: string responses: '204': description: Session cancelled '404': description: Session not found '409': description: Invalid state (session not running) /api/gateway/pause/{session_id}: post: tags: [Gateway] summary: Pause a session description: Pause a running session operationId: pauseSession parameters: - name: session_id in: path required: true schema: type: string responses: '204': description: Session paused '404': description: Session not found '409': description: Invalid state (session not running) /api/gateway/resume/{session_id}: post: tags: [Gateway] summary: Resume a session description: Resume a paused session operationId: resumeSession parameters: - name: session_id in: path required: true schema: type: string responses: '204': description: Session resumed '404': description: Session not found '409': description: Invalid state (session not paused) # ============================================================================ # Agent Endpoints # ============================================================================ /api/agents: get: tags: [Agents] summary: List all agents description: Get a list of all configured agents operationId: listAgents responses: '200': description: List of agents content: application/json: schema: type: array items: $ref: '#/components/schemas/Agent' post: tags: [Agents] summary: Create an agent description: Create a new agent configuration operationId: createAgent requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateAgentRequest' responses: '200': description: Agent created content: application/json: schema: $ref: '#/components/schemas/Agent' '500': description: Creation failed /api/agents/{id}: get: tags: [Agents] summary: Get an agent description: Get an agent by ID operationId: getAgent parameters: - name: id in: path required: true schema: type: string responses: '200': description: Agent details content: application/json: schema: $ref: '#/components/schemas/Agent' '404': description: Agent not found put: tags: [Agents] summary: Update an agent description: Update an existing agent configuration operationId: updateAgent parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateAgentRequest' responses: '200': description: Agent updated content: application/json: schema: $ref: '#/components/schemas/Agent' '404': description: Agent not found delete: tags: [Agents] summary: Delete an agent description: Delete an agent configuration operationId: deleteAgent parameters: - name: id in: path required: true schema: type: string responses: '204': description: Agent deleted '404': description: Agent not found # ============================================================================ # Session/Execution State Endpoints # ============================================================================ /api/executions/sessions: get: tags: [Sessions] summary: List sessions description: List all sessions with their executions operationId: listSessions parameters: - name: status in: query schema: type: string enum: [queued, running, paused, completed, crashed] - name: source in: query schema: type: string enum: [web, cli, api, cron, connector] responses: '200': description: List of sessions content: application/json: schema: type: array items: $ref: '#/components/schemas/SessionWithExecutions' /api/executions/sessions/{id}: get: tags: [Sessions] summary: Get a session description: Get session details by ID operationId: getSessionById parameters: - name: id in: path required: true schema: type: string responses: '200': description: Session details content: application/json: schema: $ref: '#/components/schemas/SessionWithExecutions' '404': description: Session not found /api/executions/sessions/{id}/end: post: tags: [Sessions] summary: End a session description: Mark a session as completed operationId: endSession parameters: - name: id in: path required: true schema: type: string responses: '200': description: Session ended '404': description: Session not found /api/executions/sessions/{id}/messages: get: tags: [Sessions] summary: Get session messages description: Get all messages for a session operationId: getSessionMessages parameters: - name: id in: path required: true schema: type: string - name: scope in: query schema: type: string enum: [all, root] default: all description: Filter messages by scope (all or root executions only) responses: '200': description: List of messages content: application/json: schema: type: array items: $ref: '#/components/schemas/Message' /api/executions/stats: get: tags: [Sessions] summary: Get dashboard stats description: Get aggregated statistics for the dashboard operationId: getDashboardStats responses: '200': description: Dashboard statistics content: application/json: schema: $ref: '#/components/schemas/DashboardStats' # ============================================================================ # Skill Endpoints # ============================================================================ /api/skills: get: tags: [Skills] summary: List all skills operationId: listSkills responses: '200': description: List of skills content: application/json: schema: type: array items: $ref: '#/components/schemas/Skill' post: tags: [Skills] summary: Create a skill operationId: createSkill requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSkillRequest' responses: '200': description: Skill created content: application/json: schema: $ref: '#/components/schemas/Skill' /api/skills/{id}: get: tags: [Skills] summary: Get a skill operationId: getSkill parameters: - name: id in: path required: true schema: type: string responses: '200': description: Skill details content: application/json: schema: $ref: '#/components/schemas/Skill' '404': description: Skill not found put: tags: [Skills] summary: Update a skill operationId: updateSkill parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateSkillRequest' responses: '200': description: Skill updated '404': description: Skill not found delete: tags: [Skills] summary: Delete a skill operationId: deleteSkill parameters: - name: id in: path required: true schema: type: string responses: '204': description: Skill deleted '404': description: Skill not found # ============================================================================ # Provider Endpoints # ============================================================================ /api/providers: get: tags: [Providers] summary: List all providers operationId: listProviders responses: '200': description: List of providers content: application/json: schema: type: array items: $ref: '#/components/schemas/Provider' post: tags: [Providers] summary: Create a provider operationId: createProvider requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateProviderRequest' responses: '201': description: Provider created content: application/json: schema: $ref: '#/components/schemas/Provider' /api/providers/{id}: get: tags: [Providers] summary: Get a provider operationId: getProvider parameters: - name: id in: path required: true schema: type: string responses: '200': description: Provider details content: application/json: schema: $ref: '#/components/schemas/Provider' '404': description: Provider not found put: tags: [Providers] summary: Update a provider operationId: updateProvider parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateProviderRequest' responses: '200': description: Provider updated content: application/json: schema: $ref: '#/components/schemas/Provider' '404': description: Provider not found delete: tags: [Providers] summary: Delete a provider operationId: deleteProvider parameters: - name: id in: path required: true schema: type: string responses: '204': description: Provider deleted '404': description: Provider not found /api/providers/{id}/test: post: tags: [Providers] summary: Test a provider description: Test connection to a configured provider operationId: testProvider parameters: - name: id in: path required: true schema: type: string responses: '200': description: Test result content: application/json: schema: $ref: '#/components/schemas/ProviderTestResult' /api/providers/{id}/default: post: tags: [Providers] summary: Set default provider description: Set a provider as the default operationId: setDefaultProvider parameters: - name: id in: path required: true schema: type: string responses: '200': description: Provider set as default content: application/json: schema: $ref: '#/components/schemas/Provider' '404': description: Provider not found # ============================================================================ # MCP Server Endpoints # ============================================================================ /api/mcps: get: tags: [MCP Servers] summary: List MCP servers operationId: listMcpServers responses: '200': description: List of MCP servers content: application/json: schema: type: array items: $ref: '#/components/schemas/McpServer' post: tags: [MCP Servers] summary: Create MCP server operationId: createMcpServer requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateMcpRequest' responses: '200': description: MCP server created content: application/json: schema: $ref: '#/components/schemas/McpServer' /api/mcps/{id}: get: tags: [MCP Servers] summary: Get MCP server operationId: getMcpServer parameters: - name: id in: path required: true schema: type: string responses: '200': description: MCP server details content: application/json: schema: $ref: '#/components/schemas/McpServer' '404': description: MCP server not found put: tags: [MCP Servers] summary: Update MCP server operationId: updateMcpServer parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateMcpRequest' responses: '200': description: MCP server updated '404': description: MCP server not found delete: tags: [MCP Servers] summary: Delete MCP server operationId: deleteMcpServer parameters: - name: id in: path required: true schema: type: string responses: '204': description: MCP server deleted '404': description: MCP server not found /api/mcps/{id}/test: post: tags: [MCP Servers] summary: Test MCP server description: Test connection to an MCP server operationId: testMcpServer parameters: - name: id in: path required: true schema: type: string responses: '200': description: Test result with available tools content: application/json: schema: $ref: '#/components/schemas/McpTestResult' /api/mcps/{id}/oauth/status: get: tags: [MCP Servers] summary: Get MCP OAuth status description: Returns non-secret OAuth connection status for an MCP server. operationId: getMcpOAuthStatus parameters: - name: id in: path required: true schema: type: string responses: '200': description: OAuth status content: application/json: schema: $ref: '#/components/schemas/McpOAuthStatusResponse' '404': description: MCP server not found /api/mcps/{id}/oauth/start: post: tags: [MCP Servers] summary: Start MCP OAuth authorization description: Creates a PKCE OAuth authorization request for a protected remote MCP server. operationId: startMcpOAuth parameters: - name: id in: path required: true schema: type: string requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/McpOAuthStartRequest' responses: '200': description: OAuth authorization URL content: application/json: schema: $ref: '#/components/schemas/McpOAuthStartResponse' '400': description: OAuth flow could not be started '403': description: Non-local browser origin rejected /api/mcps/{id}/oauth/disconnect: post: tags: [MCP Servers] summary: Disconnect MCP OAuth description: Removes stored OAuth token and pending state for an MCP server. operationId: disconnectMcpOAuth parameters: - name: id in: path required: true schema: type: string responses: '200': description: OAuth status after disconnect content: application/json: schema: $ref: '#/components/schemas/McpOAuthStatusResponse' '403': description: Non-local browser origin rejected /api/mcps/oauth/callback: get: tags: [MCP Servers] summary: MCP OAuth callback description: Local OAuth redirect target used to finish an MCP authorization flow. operationId: completeMcpOAuth parameters: - name: state in: query required: false schema: type: string - name: code in: query required: false schema: type: string - name: error in: query required: false schema: type: string responses: '200': description: OAuth authorization completed content: text/html: schema: type: string '400': description: OAuth authorization failed content: text/html: schema: type: string # ============================================================================ # Connector Endpoints # ============================================================================ /api/connectors: get: tags: [Connectors] summary: List all connectors description: Get a list of all registered external connectors operationId: listConnectors responses: '200': description: List of connectors content: application/json: schema: type: array items: $ref: '#/components/schemas/ConnectorConfig' post: tags: [Connectors] summary: Create a connector description: Register a new external connector operationId: createConnector requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateConnectorRequest' responses: '201': description: Connector created content: application/json: schema: $ref: '#/components/schemas/ConnectorConfig' '400': description: Invalid connector ID '409': description: Connector already exists /api/connectors/{id}: get: tags: [Connectors] summary: Get connector description: Get a connector by ID operationId: getConnector parameters: - name: id in: path required: true schema: type: string responses: '200': description: Connector details content: application/json: schema: $ref: '#/components/schemas/ConnectorConfig' '404': description: Connector not found put: tags: [Connectors] summary: Update connector description: Update an existing connector's configuration operationId: updateConnector parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateConnectorRequest' responses: '200': description: Connector updated content: application/json: schema: $ref: '#/components/schemas/ConnectorConfig' '404': description: Connector not found delete: tags: [Connectors] summary: Delete connector description: Remove a registered connector operationId: deleteConnector parameters: - name: id in: path required: true schema: type: string responses: '204': description: Connector deleted '404': description: Connector not found /api/connectors/{id}/metadata: get: tags: [Connectors] summary: Get connector metadata description: Get connector capabilities and additional metadata operationId: getConnectorMetadata parameters: - name: id in: path required: true schema: type: string responses: '200': description: Connector metadata including capabilities content: application/json: schema: $ref: '#/components/schemas/ConnectorMetadata' '404': description: Connector not found /api/connectors/{id}/inbound: post: tags: [Connectors] summary: Send inbound message description: Submit an inbound message to a connector for agent processing operationId: sendInboundMessage parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/InboundPayload' responses: '200': description: Message submitted content: application/json: schema: $ref: '#/components/schemas/InboundResult' '404': description: Connector not found '400': description: Inbound disabled or invalid request /api/connectors/{id}/inbound-log: get: tags: [Connectors] summary: Get inbound message log description: Get recent inbound messages received by this connector operationId: getConnectorInboundLog parameters: - name: id in: path required: true schema: type: string - name: limit in: query schema: type: integer default: 50 description: Maximum number of entries to return responses: '200': description: Inbound log entries (newest first) content: application/json: schema: type: array items: $ref: '#/components/schemas/InboundLogEntry' /api/connectors/{id}/test: post: tags: [Connectors] summary: Test connector description: Test connectivity to a connector's transport endpoint operationId: testConnector parameters: - name: id in: path required: true schema: type: string responses: '200': description: Test successful content: application/json: schema: $ref: '#/components/schemas/ConnectorTestResult' '404': description: Connector not found '503': description: Test failed (connectivity issue) content: application/json: schema: $ref: '#/components/schemas/ConnectorTestResult' /api/connectors/{id}/enable: post: tags: [Connectors] summary: Enable connector description: Enable a disabled connector operationId: enableConnector parameters: - name: id in: path required: true schema: type: string responses: '200': description: Connector enabled content: application/json: schema: $ref: '#/components/schemas/ConnectorConfig' '404': description: Connector not found /api/connectors/{id}/disable: post: tags: [Connectors] summary: Disable connector description: Disable a connector without deleting it operationId: disableConnector parameters: - name: id in: path required: true schema: type: string responses: '200': description: Connector disabled content: application/json: schema: $ref: '#/components/schemas/ConnectorConfig' '404': description: Connector not found # ============================================================================ # Cron Job Endpoints # ============================================================================ /api/cron: get: tags: [Cron] summary: List all cron jobs description: Get a list of all scheduled cron jobs operationId: listCronJobs responses: '200': description: List of cron jobs content: application/json: schema: type: array items: $ref: '#/components/schemas/CronJobConfig' '503': description: Cron scheduler not available post: tags: [Cron] summary: Create a cron job description: Schedule a new cron job for automated agent triggers operationId: createCronJob requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateCronJobRequest' responses: '201': description: Cron job created content: application/json: schema: $ref: '#/components/schemas/CronJobConfig' '400': description: Invalid ID or schedule '409': description: Cron job already exists '503': description: Cron scheduler not available /api/cron/{id}: get: tags: [Cron] summary: Get cron job description: Get a cron job by ID operationId: getCronJob parameters: - name: id in: path required: true schema: type: string responses: '200': description: Cron job details content: application/json: schema: $ref: '#/components/schemas/CronJobConfig' '404': description: Cron job not found '503': description: Cron scheduler not available put: tags: [Cron] summary: Update cron job description: Update an existing cron job's configuration operationId: updateCronJob parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateCronJobRequest' responses: '200': description: Cron job updated content: application/json: schema: $ref: '#/components/schemas/CronJobConfig' '400': description: Invalid schedule '404': description: Cron job not found '503': description: Cron scheduler not available delete: tags: [Cron] summary: Delete cron job description: Remove a scheduled cron job operationId: deleteCronJob parameters: - name: id in: path required: true schema: type: string responses: '204': description: Cron job deleted '404': description: Cron job not found '503': description: Cron scheduler not available /api/cron/{id}/trigger: post: tags: [Cron] summary: Manually trigger cron job description: Manually trigger a cron job outside of its schedule operationId: triggerCronJob parameters: - name: id in: path required: true schema: type: string responses: '200': description: Job triggered successfully content: application/json: schema: $ref: '#/components/schemas/TriggerResult' '404': description: Cron job not found '500': description: Job trigger failed content: application/json: schema: $ref: '#/components/schemas/TriggerResult' '503': description: Cron scheduler not available /api/cron/{id}/enable: post: tags: [Cron] summary: Enable cron job description: Enable a disabled cron job operationId: enableCronJob parameters: - name: id in: path required: true schema: type: string responses: '200': description: Cron job enabled content: application/json: schema: $ref: '#/components/schemas/CronJobConfig' '404': description: Cron job not found '503': description: Cron scheduler not available /api/cron/{id}/disable: post: tags: [Cron] summary: Disable cron job description: Disable a cron job without deleting it operationId: disableCronJob parameters: - name: id in: path required: true schema: type: string responses: '200': description: Cron job disabled content: application/json: schema: $ref: '#/components/schemas/CronJobConfig' '404': description: Cron job not found '503': description: Cron scheduler not available # ============================================================================ # Tool Endpoints # ============================================================================ /api/tools: get: tags: [Tools] summary: List available tools operationId: listTools responses: '200': description: List of tools content: application/json: schema: type: array items: $ref: '#/components/schemas/Tool' /api/settings/tools: get: tags: [Tools] summary: Get tool settings operationId: getToolSettings responses: '200': description: Tool settings content: application/json: schema: $ref: '#/components/schemas/ToolSettings' put: tags: [Tools] summary: Update tool settings operationId: updateToolSettings requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ToolSettings' responses: '200': description: Settings updated /api/settings/logs: get: tags: [Tools] summary: Get log settings description: | Returns the current logging configuration including file logging, rotation, and retention settings. Note: Changes to log settings require a daemon restart to take effect. operationId: getLogSettings responses: '200': description: Log settings content: application/json: schema: $ref: '#/components/schemas/LogSettingsResponse' put: tags: [Tools] summary: Update log settings description: | Updates the logging configuration. Note: Changes require a daemon restart to take effect. operationId: updateLogSettings requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/LogSettingsRequest' responses: '200': description: Settings updated content: application/json: schema: $ref: '#/components/schemas/LogSettingsResponse' '400': description: Invalid settings (e.g., invalid log level or rotation) # ============================================================================ # Event Streaming (SSE) # ============================================================================ /api/events: get: tags: [Events] summary: Stream all events description: Server-Sent Events stream for all gateway events (for debugging) operationId: streamAllEvents responses: '200': description: SSE event stream content: text/event-stream: schema: $ref: '#/components/schemas/GatewayEvent' /api/events/{conversation_id}: get: tags: [Events] summary: Stream conversation events description: Server-Sent Events stream for a specific conversation operationId: streamConversationEvents parameters: - name: conversation_id in: path required: true schema: type: string responses: '200': description: SSE event stream content: text/event-stream: schema: $ref: '#/components/schemas/GatewayEvent' # ============================================================================ # Webhook Endpoints # ============================================================================ /api/webhooks/{hook_type}/{hook_id}: post: tags: [Webhooks] summary: Handle webhook description: Generic webhook handler for external integrations operationId: handleWebhook parameters: - name: hook_type in: path required: true schema: type: string - name: hook_id in: path required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/WebhookPayload' responses: '200': description: Webhook processed content: application/json: schema: $ref: '#/components/schemas/WebhookResponse' components: schemas: # ============================================================================ # Health Schemas # ============================================================================ HealthResponse: type: object properties: status: type: string example: ok version: type: string example: 0.1.0 buildDate: type: string example: "2026-06-14" buildTimestamp: type: string example: "2026-06-14T15:30:00Z" StatusResponse: type: object properties: status: type: string version: type: string buildDate: type: string buildTimestamp: type: string agentCount: type: integer # ============================================================================ # Gateway Schemas # ============================================================================ SessionRequest: type: object required: - agent_id - message properties: agent_id: type: string description: ID of the agent to use example: root message: type: string description: User message to process example: Hello, how can you help me? source: type: string enum: [web, cli, api, cron, connector] default: web description: Source of the request session_id: type: string nullable: true description: Existing session ID to continue priority: type: integer nullable: true description: Request priority (higher = more urgent) external_ref: type: string nullable: true description: External reference for tracking metadata: type: object additionalProperties: true description: Custom metadata respond_to: type: array items: type: string nullable: true description: Connector IDs to send response to at end of execution connector_id: type: string nullable: true description: Connector ID that triggered this session thread_id: type: string nullable: true description: Thread ID for conversation threading with connectors SessionHandle: type: object properties: session_id: type: string example: sess-abc123 execution_id: type: string example: exec-def456 conversation_id: type: string example: web-ghi789 SessionStatusResponse: type: object properties: session_id: type: string status: type: string enum: [queued, running, paused, completed, crashed] /api/traces/query: post: tags: [Sessions] summary: Query compressed session traces description: | Runs a fixed trace analytics preset over server-owned `traces/*.jsonl.gz` files. Clients choose a preset and typed params; raw SQL is never accepted. operationId: queryTraces requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TraceQueryRequest' example: preset: sessions_with_failed_tool params: tool: read_file responses: '200': description: Trace query results content: application/json: schema: $ref: '#/components/schemas/TraceQueryResponse' '400': description: Unknown preset or invalid params content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Trace query failed content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' ErrorResponse: type: object properties: error: type: string code: type: string enum: [SESSION_NOT_FOUND, EXECUTION_NOT_FOUND, AGENT_ERROR, PROVIDER_ERROR, INVALID_STATE, INTERNAL_ERROR] TraceQueryRequest: type: object required: - preset properties: preset: type: string enum: [sessions_with_failed_tool] params: type: object additionalProperties: true properties: tool: type: string TraceQueryResponse: type: object required: - rows properties: rows: type: array items: type: object required: - session_id properties: session_id: type: string # ============================================================================ # Agent Schemas # ============================================================================ Agent: type: object properties: id: type: string name: type: string displayName: type: string description: type: string providerId: type: string model: type: string temperature: type: number format: float maxInputTokens: type: integer default: 200000 maxOutputTokens: type: integer default: 32000 maxTokens: type: integer description: Legacy alias for maxOutputTokens. thinkingEnabled: type: boolean voiceRecordingEnabled: type: boolean instructions: type: string mcps: type: array items: type: string skills: type: array items: type: string middleware: type: string nullable: true createdAt: type: string format: date-time CreateAgentRequest: type: object required: - name - providerId - model properties: name: type: string displayName: type: string description: type: string providerId: type: string model: type: string temperature: type: number default: 0.7 maxInputTokens: type: integer default: 200000 maxOutputTokens: type: integer default: 32000 maxTokens: type: integer default: 32000 description: Legacy alias for maxOutputTokens. instructions: type: string mcps: type: array items: type: string skills: type: array items: type: string UpdateAgentRequest: type: object properties: name: type: string displayName: type: string description: type: string providerId: type: string model: type: string temperature: type: number maxInputTokens: type: integer maxOutputTokens: type: integer maxTokens: type: integer description: Legacy alias for maxOutputTokens. thinkingEnabled: type: boolean voiceRecordingEnabled: type: boolean instructions: type: string mcps: type: array items: type: string skills: type: array items: type: string middleware: type: string # ============================================================================ # Session Schemas # ============================================================================ SessionWithExecutions: type: object properties: id: type: string status: type: string enum: [queued, running, paused, completed, crashed] source: type: string enum: [web, cli, api, cron, connector] created_at: type: string format: date-time updated_at: type: string format: date-time executions: type: array items: $ref: '#/components/schemas/Execution' Execution: type: object properties: id: type: string session_id: type: string agent_id: type: string status: type: string enum: [queued, running, paused, completed, crashed, cancelled] delegation_type: type: string enum: [root, sequential, parallel] parent_execution_id: type: string nullable: true tokens_in: type: integer tokens_out: type: integer created_at: type: string format: date-time completed_at: type: string format: date-time nullable: true Message: type: object properties: id: type: string execution_id: type: string role: type: string enum: [user, assistant, system, tool] content: type: string created_at: type: string format: date-time DashboardStats: type: object properties: sessions_total: type: integer sessions_running: type: integer sessions_paused: type: integer sessions_completed: type: integer sessions_crashed: type: integer executions_total: type: integer tokens_total: type: integer # ============================================================================ # Skill Schemas # ============================================================================ Skill: type: object properties: id: type: string name: type: string description: type: string category: type: string instructions: type: string created_at: type: string format: date-time CreateSkillRequest: type: object required: - name - instructions properties: name: type: string description: type: string category: type: string instructions: type: string UpdateSkillRequest: type: object properties: name: type: string description: type: string category: type: string instructions: type: string # ============================================================================ # Provider Schemas # ============================================================================ Provider: type: object required: [name, description, baseUrl, models, isDefault, hasApiKey] properties: id: type: string name: type: string description: type: string baseUrl: type: string models: type: array items: type: string embeddingModels: type: array items: type: string embeddingDimensions: type: integer verified: type: boolean isDefault: type: boolean hasApiKey: type: boolean description: Whether a credential is configured. The credential itself is never returned. createdAt: type: string format: date-time maxConcurrentRequests: type: integer contextWindow: type: integer defaultModel: type: string rateLimits: type: object modelConfigs: type: object additionalProperties: true CreateProviderRequest: type: object required: [name, description, apiKey, baseUrl, models] properties: id: type: string name: type: string description: type: string apiKey: type: string baseUrl: type: string models: type: array items: type: string embeddingModels: type: array items: type: string defaultModel: type: string rateLimits: type: object modelConfigs: type: object additionalProperties: true isDefault: type: boolean default: false UpdateProviderRequest: type: object description: Full provider replacement. Omit apiKey or send blank to retain the stored credential. required: [name, description, baseUrl, models] properties: id: type: string name: type: string description: type: string apiKey: type: string baseUrl: type: string models: type: array items: type: string embeddingModels: type: array items: type: string defaultModel: type: string rateLimits: type: object modelConfigs: type: object additionalProperties: true isDefault: type: boolean ProviderTestResult: type: object properties: success: type: boolean message: type: string models: type: array items: type: string # ============================================================================ # MCP Server Schemas # ============================================================================ McpServer: type: object properties: id: type: string name: type: string server_type: type: string enum: [stdio, http, sse, streamable-http] config: type: object enabled: type: boolean auth: $ref: '#/components/schemas/McpAuthConfig' authStatus: type: string enum: [not_configured, not_connected, connected, reauth_required] created_at: type: string format: date-time CreateMcpRequest: type: object required: - name - server_type properties: name: type: string server_type: type: string enum: [stdio, http, sse, streamable-http] command: type: string description: For stdio type args: type: array items: type: string url: type: string description: For http/sse types env: type: object additionalProperties: type: string headers: type: object additionalProperties: type: string description: Static headers. OAuth MCP servers must not persist Authorization here. auth: $ref: '#/components/schemas/McpAuthConfig' McpAuthConfig: type: object required: - type properties: type: type: string enum: [oauth2] clientId: type: string description: Optional public OAuth client identifier. scopes: type: array items: type: string description: Optional OAuth scopes requested during authorization. McpOAuthStatusResponse: type: object required: - status properties: status: type: string enum: [not_configured, not_connected, connected, reauth_required] McpOAuthStartRequest: type: object properties: redirectUri: type: string description: Optional local callback URL. If present, it must target /api/mcps/oauth/callback on localhost. McpOAuthStartResponse: type: object required: - authUrl - state properties: authUrl: type: string state: type: string McpTestResult: type: object properties: success: type: boolean message: type: string tools: type: array items: type: string # ============================================================================ # Connector Schemas # ============================================================================ ConnectorConfig: type: object properties: id: type: string description: Unique connector identifier example: gmail-bridge name: type: string description: Human-readable name example: Gmail Bridge transport: $ref: '#/components/schemas/ConnectorTransport' metadata: $ref: '#/components/schemas/ConnectorMetadata' enabled: type: boolean description: Whether the connector is enabled default: true outbound_enabled: type: boolean description: Whether outbound dispatch is enabled default: true inbound_enabled: type: boolean description: Whether inbound message reception is enabled default: true created_at: type: string format: date-time nullable: true updated_at: type: string format: date-time nullable: true ConnectorTransport: type: object description: Transport configuration for connector communication required: - type discriminator: propertyName: type oneOf: - $ref: '#/components/schemas/HttpTransport' - $ref: '#/components/schemas/CliTransport' - $ref: '#/components/schemas/GrpcTransport' - $ref: '#/components/schemas/WebSocketTransport' - $ref: '#/components/schemas/IpcTransport' HttpTransport: type: object properties: type: type: string enum: [http] callback_url: type: string format: uri description: URL to POST responses to example: http://localhost:9001/callback method: type: string enum: [POST, PUT] default: POST headers: type: object additionalProperties: type: string description: Custom headers to include timeout_ms: type: integer description: Request timeout in milliseconds nullable: true CliTransport: type: object properties: type: type: string enum: [cli] command: type: string description: Command to execute example: /usr/bin/notify-send args: type: array items: type: string description: Command arguments env: type: object additionalProperties: type: string description: Environment variables GrpcTransport: type: object properties: type: type: string enum: [grpc] endpoint: type: string description: gRPC endpoint service: type: string description: Service name method: type: string description: Method name WebSocketTransport: type: object properties: type: type: string enum: [websocket] url: type: string format: uri description: WebSocket URL IpcTransport: type: object properties: type: type: string enum: [ipc] socket_path: type: string description: Unix socket path ConnectorMetadata: type: object properties: capabilities: type: array items: $ref: '#/components/schemas/ConnectorCapability' description: Available actions/capabilities resources: type: array items: $ref: '#/components/schemas/ConnectorResource' description: Queryable data endpoints for agents response_schemas: type: array items: $ref: '#/components/schemas/ConnectorResponseSchema' description: Named outbound payload schemas context: type: string nullable: true description: Free-form text injected into agent prompts additionalProperties: true description: Additional connector-specific data ConnectorCapability: type: object properties: name: type: string description: Capability name example: send_email schema: type: object description: JSON schema for payload description: type: string nullable: true description: Human-readable description ConnectorResource: type: object required: - name - uri - method properties: name: type: string description: Resource name example: contacts uri: type: string description: URI or URI template example: https://api.example.com/contacts/{id} description: type: string nullable: true description: What this resource provides method: type: string description: HTTP method (GET or POST) default: GET example: GET headers: type: object additionalProperties: type: string description: Custom headers for the resource request response_schema: type: object nullable: true description: JSON Schema for the response ConnectorResponseSchema: type: object required: - name - schema properties: name: type: string description: Schema name example: send_message schema: type: object description: JSON Schema object description: type: string nullable: true description: What this schema defines InboundLogEntry: type: object properties: connector_id: type: string description: ID of the connector that received the message message: type: string description: The inbound message content sender: $ref: '#/components/schemas/InboundSender' thread_id: type: string nullable: true description: Thread ID for conversation threading session_id: type: string description: Session ID created for this inbound message received_at: type: string format: date-time description: When the message was received InboundSender: type: object properties: id: type: string description: Sender identifier name: type: string nullable: true description: Sender display name InboundPayload: type: object required: - message properties: message: type: string description: The inbound message content thread_id: type: string nullable: true description: Thread ID for conversation threading sender: $ref: '#/components/schemas/InboundSender' agent_id: type: string nullable: true description: Override agent ID (defaults to connector config) respond_to: type: array items: type: string nullable: true description: Connector IDs to send response to metadata: type: object additionalProperties: true nullable: true description: Custom metadata InboundResult: type: object properties: session_id: type: string description: Session ID created for this inbound message execution_id: type: string description: Execution ID for tracking message: type: string description: Status message CreateConnectorRequest: type: object required: - id - name - transport properties: id: type: string description: Unique connector identifier (alphanumeric, -, _) name: type: string description: Human-readable name transport: $ref: '#/components/schemas/ConnectorTransport' metadata: $ref: '#/components/schemas/ConnectorMetadata' enabled: type: boolean default: true outbound_enabled: type: boolean default: true inbound_enabled: type: boolean default: true UpdateConnectorRequest: type: object properties: name: type: string nullable: true transport: $ref: '#/components/schemas/ConnectorTransport' metadata: $ref: '#/components/schemas/ConnectorMetadata' enabled: type: boolean nullable: true outbound_enabled: type: boolean nullable: true inbound_enabled: type: boolean nullable: true ConnectorTestResult: type: object properties: success: type: boolean description: Whether the connectivity test succeeded message: type: string description: Test result message latency_ms: type: integer nullable: true description: Response latency in milliseconds (if successful) # ============================================================================ # Cron Job Schemas # ============================================================================ CronJobConfig: type: object properties: id: type: string description: Unique job identifier example: daily-report name: type: string description: Human-readable name example: Daily Report Generator schedule: type: string description: Cron schedule expression (6 fields - sec min hour day month weekday) example: "0 0 9 * * *" agent_id: type: string description: Agent ID to execute example: report-agent message: type: string description: Message to send to the agent example: Generate the daily sales report respond_to: type: array items: type: string description: Connector IDs to send the response to enabled: type: boolean description: Whether the job is enabled default: true timezone: type: string nullable: true description: Timezone for schedule interpretation example: America/New_York metadata: type: object additionalProperties: true nullable: true description: Optional metadata last_run: type: string format: date-time nullable: true description: Last execution timestamp next_run: type: string format: date-time nullable: true description: Next scheduled execution timestamp created_at: type: string format: date-time nullable: true updated_at: type: string format: date-time nullable: true CreateCronJobRequest: type: object required: - id - name - schedule - agent_id - message properties: id: type: string description: Unique job identifier (alphanumeric, -, _) name: type: string description: Human-readable name schedule: type: string description: Cron schedule expression (6 fields - sec min hour day month weekday) agent_id: type: string description: Agent ID to execute message: type: string description: Message to send to the agent respond_to: type: array items: type: string description: Connector IDs to send the response to enabled: type: boolean default: true timezone: type: string nullable: true metadata: type: object additionalProperties: true nullable: true UpdateCronJobRequest: type: object properties: name: type: string nullable: true schedule: type: string nullable: true agent_id: type: string nullable: true message: type: string nullable: true respond_to: type: array items: type: string nullable: true enabled: type: boolean nullable: true timezone: type: string nullable: true metadata: type: object additionalProperties: true nullable: true TriggerResult: type: object properties: success: type: boolean description: Whether the trigger was successful session_id: type: string nullable: true description: Session ID if successful execution_id: type: string nullable: true description: Execution ID if successful message: type: string description: Result message # ============================================================================ # Tool Schemas # ============================================================================ Tool: type: object properties: name: type: string description: type: string parameters: type: object risk_level: type: string enum: [low, medium, high] ToolSettings: type: object properties: fileTools: type: boolean offloadLargeResults: type: boolean offloadThresholdTokens: type: integer LogSettingsRequest: type: object description: | Request body for updating log settings. All fields are optional - only provided fields will be updated. properties: enabled: type: boolean description: Enable file logging default: false directory: type: string description: | Custom log directory path. If not specified, defaults to {data_dir}/logs example: /var/log/agentzero level: type: string description: Log level threshold enum: [trace, debug, info, warn, error] default: info rotation: type: string description: Log file rotation strategy enum: [daily, hourly, minutely, never] default: daily maxFiles: type: integer description: | Maximum number of rotated log files to keep. Set to 0 for unlimited retention. default: 7 minimum: 0 suppressStdout: type: boolean description: Suppress stdout output (only log to file) default: false LogSettingsResponse: type: object description: Response containing current log settings properties: enabled: type: boolean directory: type: string nullable: true level: type: string enum: [trace, debug, info, warn, error] rotation: type: string enum: [daily, hourly, minutely, never] maxFiles: type: integer suppressStdout: type: boolean restartRequired: type: boolean description: Always true - log changes require daemon restart # ============================================================================ # Event Schemas # ============================================================================ GatewayEvent: type: object description: | Server-Sent Event types: - token: Streaming token - thinking: Agent thinking content - tool_call: Tool invocation - tool_result: Tool result - agent_started: Agent began processing - agent_completed: Agent finished - delegation_started: Subagent spawned - delegation_completed: Subagent finished - error: Error occurred properties: type: type: string data: type: object # ============================================================================ # Webhook Schemas # ============================================================================ WebhookPayload: type: object properties: source_id: type: string channel_id: type: string message: type: string agent_id: type: string metadata: type: object WebhookResponse: type: object properties: status: type: string conversation_id: type: string error: type: string nullable: true CleanupTempRequest: type: object description: | Request body for `POST /api/cleanup/vault-temp`. All fields are optional. Empty body / no body wipes everything. properties: olderThanHours: type: integer format: int64 minimum: 0 nullable: true description: | When set, only files whose mtime is older than this many hours are deleted. When `null` or omitted, everything is wiped. Files with unreadable mtime are skipped (safer default) when a threshold is set. CleanupTempResponse: type: object required: [deletedFiles, totalBytes, removedDirectories, errors] properties: deletedFiles: type: integer format: int64 minimum: 0 description: Number of files (and symlinks) that were deleted. totalBytes: type: integer format: int64 minimum: 0 description: Sum of `len()` for the deleted regular files. removedDirectories: type: integer format: int64 minimum: 0 description: Number of subdirectories removed after their contents were gone. errors: type: integer format: int64 minimum: 0 description: | Count of I/O errors encountered during the walk. Errors are counted, never raised — a single glitch doesn't truncate the sweep.