amazon-braket/amazon-braket-sdk-python
A Python SDK for interacting with quantum devices on Amazon Braket
Amazon Braket Python SDK
The Amazon Braket Python SDK is an open‑source library that lets you write Python code to run quantum‑computing jobs on Amazon Braket. It provides:
- Device abstractions (
AwsDevice,Devices) for both Amazon‑hosted simulators and real quantum processors (e.g., Rigetti, IonQ, etc.). - Circuit building via
braket.circuits.Circuit. - Task submission (
device.run,device.run_batch) and result retrieval. - Hybrid job support (
AwsQuantumJob) for workflows that combine classical and quantum steps. - Local simulators bundled in the SDK for rapid prototyping without AWS resources.
Getting started
# Install the SDK from PyPI
pip install amazon-braket-sdk
You need Python 3.11+, Git, an AWS account with an IAM user/role that has Braket permissions, and the AWS SDK for Python (boto3). Configure your AWS credentials and region before using the SDK.
Simple example – Bell‑pair on the SV1 simulator
from braket.aws import AwsDevice
from braket.circuits import Circuit
from braket.devices import Devices
# Choose the managed state‑vector simulator
device = AwsDevice(Devices.Amazon.SV1)
# Build a 2‑qubit Bell circuit
bell = Circuit().h(0).cnot(0, 1)
# Submit the job (100 shots) and print the measurement histogram
task = device.run(bell, shots=100)
print(task.result().measurement_counts)
The SDK handles job creation, polling, and result parsing for you.
Running many circuits in parallel
circuits = [bell for _ in range(5)]
batch = device.run_batch(circuits, shots=100)
print(batch.results()[0].measurement_counts)
Batch submission speeds up large workloads on simulators.
Hybrid jobs (classical + quantum)
from braket.aws import AwsQuantumJob
job = AwsQuantumJob.create(
device="arn:aws:braket:::device/quantum-simulator/amazon/sv1",
source_module="job.py",
entry_point="job:run_job",
wait_until_complete=True,
)
print(job.result())
The SDK launches a Docker‑based job that can run multiple quantum tasks and ordinary Python code together.
Local simulation
The SDK ships with braket_sv, a fast state‑vector simulator that runs on your laptop. Use it for quick debugging before sending jobs to the cloud.
Documentation & help
- Cheat sheet – one‑page overview of common calls: https://amazon-braket.github.io/amazon-braket-sdk-python/
- Full API reference – https://amazon-braket-sdk-python.readthedocs.io/
- Examples – see the companion
amazon-braket-examplesrepo for Jupyter notebooks. - Support – open issues on GitHub or ask on Quantum Computing Stack Exchange.
License
Apache‑2.0.
In a nutshell: The Amazon Braket Python SDK is a production‑ready toolkit for building, submitting, and managing quantum circuits and hybrid workloads on AWS’s Braket service, with both cloud‑hosted and local simulators available.
Related
- Project
- Project
- Project
- Project
- Project