Skip to content

Schemas

The payload shapes referenced by execution and hardware messages. Python sources of truth: kernel/models/snapshot.py, kernel/models/errors.py, kernel/hardware/base.py. TypeScript mirror: src/types/quantum.ts.

Carried in snapshot.data. Lightweight — produced on every parse, no simulation.

FieldTypeNotes
framework"qiskit" | "cirq" | "cuda-q" | "qsharp"Which adapter produced the snapshot.
qubit_countinteger
classical_bit_countintegerQiskit: the circuit’s classical register size. Cirq and Q#: the number of measurement operations.
depthintegerNumber of layers (see layering below). 0 for an empty circuit.
gatesGate[]In extraction order.
A replay-tested snapshot (parse_bell_qiskit.responses.json)
[
{
"type": "snapshot",
"data": {
"framework": "qiskit",
"qubit_count": 2,
"classical_bit_count": 2,
"depth": 3,
"gates": [
{ "type": "H", "targets": [0], "controls": [], "params": [], "layer": 0 },
{ "type": "CNOT", "targets": [1], "controls": [0], "params": [], "layer": 1 },
{ "type": "Measure", "targets": [0], "controls": [], "params": [], "layer": 2 },
{ "type": "Measure", "targets": [1], "controls": [], "params": [], "layer": 2 }
]
}
}
]
FieldTypeNotes
typestringCanonical gate name (table below).
targetsint[]Target qubit indices.
controlsint[]Control qubit indices — empty for uncontrolled gates. Both SWAP qubits are targets.
paramsfloat[]Rotation angles in radians (e.g. RZ); empty otherwise.
layerintegerColumn in the circuit diagram, 0-based.

Adapters normalize framework-native gate names to this registry:

CanonicalNotes
H, X, Y, ZPauli + Hadamard.
S, Sdg, T, TdgPhase gates and adjoints.
RX, RY, RZOne angle in params.
U1, U2, U3Qiskit only.
CNOT, CZOne qubit in controls, one in targets.
SWAPBoth qubits in targets.
ToffoliTwo qubits in controls, one in targets.
MeasureOne target per measured qubit.
ResetQ# only — mid-circuit |0⟩ preparation.

Uppercase-passthrough rule: a gate that maps to no canonical name passes through as its native name uppercased (controls preserved). Clients should render unknown type values as labeled boxes rather than failing.

  • Qiskit and Q# use a shared greedy algorithm: each gate lands in the earliest layer where all of its qubits are free. depth is the number of occupied layers.
  • Cirq uses the circuit’s native moment indices as layers, and depth is the moment count — Cirq’s own layout is preserved rather than re-packed.

Carried in result.data (execute) and in simulator hardware_result.data.

FieldTypeNotes
state_vector{re, im}[]Final statevector with measurements stripped, length 2^n. May be empty for Q# (below).
probabilities{bitstring: float}Derived from the exact statevector when available; entries with probability ≤ 1e-10 omitted. Q# without a state dump: sampled frequencies instead.
measurements{bitstring: int}Sampled counts over shots runs. Empty when the circuit has no measurements.
bloch_coords{x, y, z}[]Per-qubit Bloch vector from the reduced density matrix. Entangled qubits sit near the origin.
execution_time_msfloatWall-clock simulation time, rounded to 0.1 ms.
shot_countintegerEcho of the requested shots.
metrics{string: float}Protocol v1.1. Accumulated record_metric(name, value) calls the user’s code made during this run. Always present — {} when nothing was recorded. Recording the same name twice overwrites (last write wins).
seed_honoredbooleanProtocol v1.1, optional. Present only when the execute request carried a seed: whether the backend actually honored it. Omitted entirely (not false) when no seed was requested — see execution messages.

Bitstring-key conventions (read this twice)

Section titled “Bitstring-key conventions (read this twice)”

The frontend treats probabilities/measurements keys as opaque labels — and it has to, because the bit order differs per framework:

Frameworkprobabilities keysmeasurements keys
qiskitStatevector index in binary. Qiskit is little-endian: qubit 0 is the rightmost character. Aer counts, Qiskit convention: classical bit 0 rightmost.
cirqStatevector index in binary with qubits in sorted order. Cirq is big-endian: qubit 0 is the leftmost character. Per-measurement-key arrays concatenated in sorted key-name order; within a key, bits follow the measured qubit order.
qsharpDense-state index in binary; qdk states are big-endian: qubit 0 is the leftmost character (same as Q#‘s own DumpMachine display). Flattened Result values in the order the entry point returns them — return order, not qubit index.

If you correlate keys across frameworks (e.g. a grader comparing a Qiskit and a Q# solution), reverse the Qiskit keys first.

Q# runs are sampled shot-by-shot; the exact state is only recoverable when the program itself calls DumpMachine():

  • Dump present (last DumpMachine of the first shot, qubit count matching): state_vector is the exact dense state, probabilities are exact (replacing sampled frequencies), and Bloch coordinates come from partial traces.
  • No dump: state_vector is [], probabilities are sampled frequencies (count / shots), and Bloch coordinates use measurement marginals — only z is observable from counts, so x = y = 0.

Protocol v1.1. The whole payload of an environment response (see execution messages).

FieldTypeNotes
pythonstringplatform.python_version() on the kernel host.
platformstringplatform.platform() on the kernel host.
packages{string: string}Installed version per framework — keys present only for frameworks actually resolvable via importlib.metadata on the kernel host: qiskit, qiskit_aer, cirq, cudaq, qsharp.

The payload merged into error messages — see errors for the envelope and code table. When a KernelError appears as a plain object (e.g. simulator hardware_result.data.error), all five fields are present, null when unset: code, message, traceback, framework, dependency.

Elements of hardware_backends.backends.

FieldTypeNotes
namestringBackend/target id — pass as backend in hardware_submit.
providerstringOwning provider name.
qubit_countinteger
connectivity[int, int][]Coupled qubit pairs.
queue_lengthintegerProvider-reported queue depth (0 for simulators).
average_error_ratefloatRepresentative gate error rate.
gate_setstring[]Canonical gate names the backend supports.
status"online" | "offline" | "maintenance"
{
"name": "sim_qasm",
"provider": "simulator",
"qubit_count": 32,
"connectivity": [[0, 1], [1, 2]],
"queue_length": 0,
"average_error_rate": 0.0005,
"gate_set": ["H", "X", "Y", "Z", "CNOT", "CZ", "RX", "RY", "RZ", "T", "S", "Toffoli", "SWAP", "Measure"],
"status": "online"
}

(Schema illustration with connectivity truncated — the full, replay-tested backend list is embedded on the hardware messages page.)

Carried by hardware_job_submitted.job, hardware_job_update.job, and hardware_jobs.jobs[].

FieldTypeNotes
idstringKernel-generated UUID — not the provider’s own job id.
providerstring"unknown" only in synthesized stale handles.
backendstring
statusstringVocabulary below.
queue_positioninteger | nullnull before the first poll or when not applicable. Refreshed only by hardware_status for queued/running jobs; providers report -1 when they cannot determine a position (e.g. Azure).
shotsinteger
submitted_atstringISO-8601 UTC timestamp. Empty string in synthesized stale handles.
errorstring | nullHuman-readable failure detail. May be null even for failed simulator jobs — the diagnostic lives in hardware_results instead.
StatusMeaning
queuedAccepted by the provider, waiting.
runningExecuting on the backend.
completeFinished; fetch hardware_results.
failedSubmission/run failed — or the job was cancelled (hardware_cancel sets failed; there is no separate cancelled wire status).
unknownProvider returned an unrecognized state.
staleRehydrated after a kernel restart without a live SDK handle, or the id is no longer tracked. Re-submit to run again.