haiqu.flow. If you are new to layers and programs, read the overview
first.
Authenticate and start an experiment
Log in and initialize an experiment so your circuits and jobs are tracked.
You’re authenticated and ready to build a program. See the
login reference for API-key options.Build a program
A program is an ordered list of layers. Start with an
InputLayer, end with a DeviceLayer,
and add processing steps in between.The program is validated as you build it — for example, leaving out the
DeviceLayer raises an
error.Run the flow
Pass the program and your circuit(s) to
haiqu.flow.haiqu.flow returns a job handle you can track and collect results from.Read the results
Call Results come back as a nested list ordered by circuits → observables → parameters. With a
single circuit and no observables, that is a one-element list holding the measurement
distribution (bitstrings in Qiskit bit-order).
job.result() to retrieve the output.You’ve built and run your first hybrid program.
Worked examples
Measure observables
Supplyobservables to get expectation values instead of a distribution. A program that takes
observables needs a layer that computes them; the simplest choice is the grouped EstimatorLayer,
which evaluates the observables and applies error mitigation. The order of Pauli terms in a string
follows the Qiskit reversed-order convention (for example, "IZ" measures qubit 0 in the Z basis).
EstimatorLayer(noise_tailoring=True), or EstimatorLayer(mitigation_enabled=False) to turn it off.
For full control, compute the observables by hand instead of using the grouped EstimatorLayer:
split them with ObservableSplitLayer and evaluate them with QWCComputeLayer.
A full pipeline
Compose transpilation, packing, and error mitigation into one program. Each layer applies its step in order before the circuits reach the device:Sweep over parameters
Passparameters to run a parametrized circuit at several values. The extra dimension appears last
in the result ordering:
Estimate cost before running. Pass
dry_run=True to stop just before device execution and
estimate the QPU cost. job.result() is then empty; read job.estimated_qpu_cost instead.haiqu.flow reference for the full signature and every supported
combination of circuits, parameters, and observables, and the
hybrid program reference for all layers and their parameters.