Agents
The agents endpoint connects you to Coda’s unified AI agent, which writes quantum circuits in the framework you request (defaulting to Qiskit), simulates and formally verifies them when useful, explains quantum computing concepts, and assists with quantum computing workflows. Responses are streamed back as server-sent events (SSE).
Example
The response is streamed. Each event contains a type field (for example token, thinking_token, tool_call, tool_result, files, completed, or error) and associated data. The stream always ends with a terminal completed, error, or cancelled event.
Effort budget
The budget field controls how much effort the agent spends on a request: low, medium, or high (default). Lower budgets scale down the model’s thinking effort, max output tokens, step limit, and parallel research-subagent pool, trading some response quality for speed and cost.
Code delivery
The code_mode field controls how the agent delivers final code:
Conversation threads
Pass a thread_id to continue a previous conversation:
The X-Thread-Id response header contains the thread ID for new conversations.
Team billing
Pass team_id to bill an Enterprise team wallet. Wallet selection, 400 / 402 behaviour, and service-account keys are on Teams and team wallets.
Response headers
The SSE response includes:
Store X-Run-Id and X-Thread-Id to look up settled cost after the stream ends.
Post-hoc cost
Internal checkpoint, tracing, and cost-accounting data are not included in terminal SSE payloads. After the run finishes, look up the settled credit charge with the usage API using X-Run-Id or X-Thread-Id.
thread_id is attached best-effort after authorisation. A charge can settle with thread_id null. Do not treat a thread rollup as the complete ledger.
Deprecated fields
The mode and fast request fields are deprecated. They are still accepted for now, but new integrations should omit them.
mode: previously selected between separatebuildandlearnagents. These have been replaced by the unified agent, and all values (agent,build,learn) now route to the same agent. Omit the field.fast: previously requested a faster model for lower latency. The unified agent ignores this flag; usebudgetto trade quality for speed instead.
Related endpoints
POST /agents: chat with the Coda AI agentGET /agents: list available agentsGET /usage/runs/{run_id}: settled cost forX-Run-Id
See the Coda API Reference for full request and response schemas.