Execution Plan

An ExecutionPlan is the declarative, JSON-safe description of what to run, where and how. Plans are plain data — they never execute anything.

Exactly one of these describes the work:

  • circuit — a QuantumCircuit,

  • ir — an IRCircuit,

  • compiled — a CompilationResult to reuse instead of recompiling.

Where & how:

  • target — a Target the work is compiled for.

  • backend — a Backend, or the name of a registered backend (resolved through the runtime’s BackendRegistry).

  • shots — number of measurement shots (default 1024).

  • parameter_bindings — mapping of parameter name (or Parameter) to value, bound before execution.

  • initial_state — optional starting StateVector.

  • seed — RNG seed for reproducible execution.

  • optimization_level — compiler level (0-2).

  • options / metadata — free-form runtime options and user metadata.

Building plans

from microquantum import ExecutionPlan, Parameter, QuantumCircuit, StatevectorBackend

theta = Parameter("theta")
qc = QuantumCircuit(1).ry(theta, 0)

plan = ExecutionPlan.from_circuit(
    qc,
    name="ry-diag",
    backend=StatevectorBackend(),
    shots=4096,
    parameter_bindings={"theta": 0.5},
    seed=7,
    optimization_level=1,
)
print(plan.validate())            # []  (bound, valid)

data = plan.to_dict()             # JSON-safe
restored = ExecutionPlan(**data)

Binding

The plan carries the bindings; the runtime binds before dispatch. A bound plan’s work is concrete: plan.bound() returns the resolved circuit.