Write a quantum program for a task
write_circuitHave the service's own model write an OpenQASM 3 program for a task, the engine checking each attempt against what the task asks exactly as it checks a lesson's answer, and what went wrong going back to the model for another attempt, up to rounds repairs. The task is an exercise in the course's form (wai.quantum.exercise/1): a title and task in words, an optional starter program, and what the program must do, as an intent (an exact distribution, a reference program it must equal or whose state it must prepare) or cases that each have one, with optional constraints (gates allowed, counts, T count, smells), at most 16 cases and 8 intents in one place, its canonical form at most 64 KiB. The answer is a job whose result is the transcript (wai.quantum.write/1): the model by name, licence and the digest of its files, every byte checked, and the arithmetic it ran in, the prompt, each attempt's program and the engine's check, and whether one passed and at what level, signed (verify_quantum_receipt checks it with the job's request). Decoding is greedy, so the same task gives the same transcript in the same arithmetic (architecture, operating system, maths library, matmul kernel). Writes take minutes and run one at a time; a client holds one queued or running write. Call it as a task, or it waits 50 s and answers with status running and an id for get_quantum_job. A service without a model refuses it (J080); quantum_service_info says under write whether this one has one. Each call is a new write unless it gives idempotency_key.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task": "<task>"
},
"name": "write_circuit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | The exercise: {"title", "task", "starter", "intent" or "cases", "constraints", "job"}, as the course's exercises (wai.quantum.exercise/1); title and task may be plain strings. It must give an intent, or cases that each have one (J081). | |
| rounds | No | Repairs after the first attempt, each with the engine's account of the last (J082 outside 0 to 4). | |
| max_new | No | The most tokens one reply may take, its thinking included. | |
| idempotency_key | No | A key of your making that names this run, so that a call sent again is not a second job: the same key with the same arguments answers with the job it names, for as long as the job is kept, rather than running another; the same key with other arguments is refused (J034). Make it unguessable (a UUID). A job the service interrupted is run again under its key. Without a key, every call is a new job. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||