Agents

Use natural language to write quantum algorithms and learn quantum computing.

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

1from conductorquantum import ConductorQuantum
2
3client = ConductorQuantum(token="<your-api-key>")
4for event in client.coda.agents.run(
5 messages=[{"role": "user", "content": "Create a 3-qubit GHZ state circuit in Qiskit"}],
6):
7 print(event)

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.

1for event in client.coda.agents.run(
2 messages=[{"role": "user", "content": "Explain the quantum Fourier transform"}],
3 budget="low",
4):
5 print(event)

Code delivery

The code_mode field controls how the agent delivers final code:

code_modeBehaviour
inline (default)Final code is streamed in token events as a fenced markdown code block with the canonical framework language tag, followed by the completed event.
fileThe agent writes code to a virtual filesystem instead. Written files are streamed back in a files event just before the terminal completed event. Its data.files maps each file path to its contents.

Conversation threads

Pass a thread_id to continue a previous conversation:

1{
2 "messages": [
3 {"role": "user", "content": "Now add a measurement to all qubits"}
4 ],
5 "thread_id": "<thread-id-from-previous-response>"
6}

The X-Thread-Id response header contains the thread ID for new conversations.

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 separate build and learn agents. 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; use budget to trade quality for speed instead.
  • POST /agents: chat with the Coda AI agent
  • GET /agents: list available agents

See the Coda API Reference for full request and response schemas.