Agents API
Agent execution routes for async and streaming use cases.
Async Agent Execution
POST /api/v1/agents/execute
Creates an async job for supported non-chat agents. The HTTP request has a 60-second duration limit for validating and enqueueing the job; the Workflow-backed job continues asynchronously after the 202 response. Monitor it through the returned polling or stream URL.
Supported async agent IDs:
| Agent ID | Job Type | Extra Requirement |
|---|---|---|
procedures-discovery-agent | discovery | Optional metadata.discoveryMode: "pda-only" for the PDA-only workflow; requires the deployment flag USE_WORKFLOW_PDA_DISCOVERY=true |
Legacy requirements, compliance, deficiency-location, report-generation, and remediation agent
IDs are retired. Requests return HTTP 410; historical jobs remain readable through the Jobs API.
New packet reviews use reviewed deterministic requirements rather than starting those agents.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Supported async agent identifier |
utility | string | Yes | Utility name (1-500 chars) |
state | string | No | Two-letter state code |
userQuery | string | Yes | Query text (1-10,000 chars) |
source | string | No | Request origin. One of: console, playground, api, cli, mcp, script, test, dev |
metadata | object | No | Key-value metadata for the discovery job. If supplied and non-null, metadata.submissionId must be a valid UUID |
webhookUrl | string | No | URL for async completion webhook |
Example
{
"agentId": "procedures-discovery-agent",
"utility": "duke-energy",
"state": "NC",
"userQuery": "refresh current interconnection procedure documents",
"source": "api",
"metadata": {
"discoveryMode": "pda-only"
},
"webhookUrl": "https://partner.example/hooks/gridwonk"
}Returns 202 with jobId, pollUrl, and streamUrl.
Streaming Chat Agent
POST /api/v1/agents/chat
Set includeSources: true on the body to receive source events carrying the answer's citations.
It defaults to false, so an existing integration's stream is unchanged — see
Chat Streaming API.
SSE streaming chatbot endpoint for interactive assistant workflows. Routes through executeChatbot() for the full orchestration pipeline (classification, canonical FAQ, requirements preflight, routing). The streaming HTTP request has a 300-second duration limit.
Chat requirement lookup follows the same current-procedure behavior as the API, SDK, CLI, and MCP tools. In shadow mode (ENFORCE_CURRENT_PROCEDURE_REQUIREMENTS=false), existing displayable requirements may still be returned and logged with diagnostics. In enforcement mode (true), customer-facing chat and compliance paths only use validated requirements linked to current usable procedure documents. Deprecated, pending-review, missing-source, and hash-mismatched requirements remain review data, not customer-usable agent truth.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | User message (1-10,000 chars) |
utility | string | Conditional | Utility name (1-500 chars). Required unless sessionId, workContextId, or submissionId is provided |
state | string | No | Two-letter state code |
sessionId | string | No | UUID for conversation continuity |
workContextId | string | No | UUID for shared cross-surface work context |
submissionId | string | No | UUID for submission-scoped assistant context |
source | string | No | Request origin. Same enum as execute endpoint |
environment | string | No | Telemetry environment (production, preview, development, test). Trusted only outside production |
includeSources | boolean | No | Emit citation-bearing source events; defaults to false |
metadata | object | No | Arbitrary key-value metadata |
queueProjectId is not an accepted chat-context field. Supply utility, sessionId,
workContextId, or submissionId instead; requests without one of those values return
INVALID_INPUT.
Example
{
"message": "What site control items are required?",
"utility": "duke-energy",
"state": "NC",
"source": "cli"
}Response Type
text/event-stream — Server-Sent Events with streaming chat tokens. The final complete event includes route diagnostics under chatbot when available.
Notes
agents/executerejects unsupported agent IDs with a400error.procedures-discovery-agentmaps to an async discovery job. It is not the same raw Agent SDK execution path as/api/agents/execute.- Workflows requiring document access validate document ownership against API key org scope.
/agents/chattrusts synthetic telemetry labels only in local and preview runtimes. Production derives environment/source labels server-side, and test API keys are persisted as test traffic.- Both endpoints use
withApiKeyAuth— an organization API key or OAuth bearer JWT is required.
Lightweight hosted assistance
POST /api/v1/assist needs the API and CLI assistant on for your organization, and returns 403
when it's off. Hosted MCP assist needs the MCP assistant. The endpoint provides one-shot text or
optional streaming separately from
the orchestrated chat agent. Hosted MCP assist uses the same generation service
with a string prompt and optional string context; it adds no caller model or
streaming control. The deployment switch, registry model resolution, organization
admission and request cancellation still apply. When the default model must be
resolved, a missing registry assignment fails before generation without a
hardcoded fallback. See API Overview.