Use Experiments with Runtime sessions


You want to run experiments in a Runtime session so that jobs can run in close temporal proximity.



This guide requires qiskit-ibm-runtime version 0.15 and up, which can be installed with python -m pip install qiskit-ibm-runtime. For how to migrate from the older qiskit-ibm-provider to qiskit-ibm-runtime, consult the migration guide.

Use the IBMBackend object in Qiskit Runtime API Docs Preview, which supports sessions.

In this example, we will set the max_circuits property to an artificially low value so that the experiment will be split into multiple jobs that run sequentially in a single session. When running real experiments with a large number of circuits that can’t fit in a single job, it may be helpful to follow this usage pattern:

from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_experiments.library.tomography import ProcessTomography
from qiskit import QuantumCircuit

service = QiskitRuntimeService(channel="ibm_quantum")
backend = service.backend("ibm_osaka")
qc = QuantumCircuit(1)

exp = ProcessTomography(qc)
# Artificially lower circuits per job, adjust value for your own application
exp_data =
# This will prevent further jobs from being submitted without terminating current jobs

Note that runtime primitives are not currently supported natively in Qiskit Experiments, so the path is required to run experiments.