Skip to main content
API Reference: qbraid.runtime.native
This page covers how to submit quantum jobs through the QbraidProvider — from single one-off submissions, to batching multiple circuits in a single job, to grouped workflows that span multiple devices and providers. For provider setup and authentication, see QbraidProvider - Usage.

Single Job Submission

Submit a quantum program to any qBraid-supported device and retrieve results:
For async applications, you can use async_result() to await job completion without blocking the event loop:
You can also submit multiple programs at once — each is executed as a separate job:

Group Jobs

Why Group?

When running related quantum experiments — parameter sweeps, algorithm comparisons, cross-device benchmarks — you often end up with many independent jobs that are logically part of the same workflow. Without grouping, these jobs are scattered across your job history with no way to track or retrieve them together. GroupJobSession solves this by grouping any number of jobs under a single group ID. Key benefits:
  • Cross-device, cross-provider: submit jobs to different backends (AWS SV1, IonQ, qBraid simulators) within the same group
  • Unified tracking: all jobs share a group QRN visible in the qBraid dashboard
  • Aggregated results: retrieve all results at once with group.results()
  • Lifecycle management: auto-close with TTL, cancellation, completion callbacks

Context Manager

The simplest way to use group jobs. All jobs submitted inside the with block are automatically tagged with the group ID. The group closes when the block exits.

Manual Open / Close

For interactive workflows like Jupyter notebooks, you can open and close the group manually across multiple cells.

Auto-Close with TTL

Set a time-to-live so the group automatically closes after a duration, even if you forget to call close() or your kernel crashes. Defaults to 1 hour (3600s) if not specified.
The max_ttl parameter accepts values from 1 to 86400 seconds (24 hours). If not specified, the backend defaults to 3600 seconds (1 hour).

Retrieving Results

After closing a group, retrieve all job results at once. group.results() blocks until every job reaches a terminal state (completed, failed, or cancelled).
You can also filter results by outcome:

Completion Callback

Register a callback that fires automatically when all jobs complete. The callback runs at context exit, after the group is closed.

Cancellation

Cancel a group and all its non-terminal jobs:

Batch Jobs

Submit multiple circuits as a single job to a device that supports batched execution. Unlike group jobs, which coordinate independent jobs across devices, batch jobs send all circuits in one request and return a unified result.

Submitting a Batch

Pass a list of programs with as_batch=True to submit them as a single job:
A batch submission returns a single QbraidJob, not a list. All circuits share the same job ID, device, and shot count.
as_batch=True requires a device that supports batch execution. You can check this via the device profile’s batch_job_support flag. Passing as_batch=True to an unsupported device raises a ValueError.

Retrieving Batch Results

Calling job.result() on a batch job returns a BatchResult object:
BatchResult provides two ways to access measurement data: Aggregate access — indexed by circuit position:
Per-circuit access — each circuit’s Result is a full object with its own status and metadata:

BatchResult Properties

Per-Circuit Error Handling

In a batch job, individual circuits can fail while others succeed. Failed circuits carry their own error message, accessible through their per-circuit result:

Batch Jobs vs Group Jobs