Amazon Braket Schemas

raw JSON →
1.29.1 verified Fri May 01 auth: no python

An open-source library that contains the schemas for Amazon Braket, AWS's quantum computing service. It provides data models and serialization/deserialization for Braket API payloads. Current version: 1.29.1. Release cadence: irregular, often monthly.

pip install amazon-braket-schemas
error pydantic.error_wrappers.ValidationError: 1 validation error for GateModelQPUDeviceCapabilities braketSchemaHeader -> name unexpected value; permitted: ...
cause The `braketSchemaHeader.name` in the JSON does not match the expected schema name.
fix
Use the correct schema header name. For GateModelQPUDeviceCapabilities, use 'braket.device_schema.gate_model_qpu_device_capabilities'.
error AttributeError: module 'braket.schemas' has no attribute 'GateModelQPUDeviceCapabilities'
cause Attempting to import a schema that does not exist (typo) or using an old version where the schema was not yet added.
fix
Check the available schemas in the documentation. Use from braket.schemas import ... with the correct class name.
error ImportError: cannot import name 'GateModelQPUDeviceCapabilities' from 'braket.schemas.device'
cause Importing from the internal module path instead of the top-level package.
fix
Change import to: from braket.schemas import GateModelQPUDeviceCapabilities
breaking Python 3.10 support was dropped in v1.29.0. The package now requires Python >=3.11.
fix Upgrade Python to 3.11 or later.
breaking Python 3.9 support was dropped in v1.26.0. Python 3.12 and 3.13 are supported.
fix Upgrade Python to 3.11+.
deprecated The `braketSchemaHeader` field's `name` value must match the schema's fully qualified name exactly or parsing may fail.
fix Use the exact `braketSchemaHeader.name` as defined in the schema class (e.g., 'braket.device_schema.gate_model_qpu_device_capabilities').

Parse a device capabilities JSON using the GateModelQPUDeviceCapabilities schema.

import json
from braket.schemas import GateModelQPUDeviceCapabilities

# Load a device capabilities JSON string
json_str = json.dumps({
    "braketSchemaHeader": {"name": "braket.device_schema.gate_model_qpu_device_capabilities", "version": "1"},
    "service": {"name": "default", "arn": "arn:aws:braket:::device/quantum-simulator/amazon/sv1"},
    "action": {"braket.ir.jaqcd.program": {"actionType": "braket.ir.jaqcd.program", "version": ["1"]}},
    "supportedQuantumOperations": ["H", "X", "Y", "Z", "S", "T", "RX", "RY", "RZ", "CNOT", "SWAP", "ISWAP", "CNot", "CCNot", "Unitary"],
    "properties": {},
    "deviceParameters": {}
})
capabilities = GateModelQPUDeviceCapabilities.parse_raw(json_str)
print(capabilities)