amazon-braket
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAmazon Braket
Amazon Braket
Primitives
核心原语
The vocabulary of a Braket workflow, and which reference to open for each.
| Primitive | What it is | Related References | Open it when the request involves |
|---|---|---|---|
| Device | A simulator or QPU, identified by a region-scoped ARN | devices.md | anything about a device: what exists, discovering or filtering the fleet, availability and status (online, offline, retired), which region a device lives in, ARNs, choosing a device for a workload, qubit count, connectivity or topology, native gates, fidelities, calibration data, queue depth, shot and gate limits, paradigm (gate-model vs analog Hamiltonian simulation), whether a device supports program sets, pulse-level control, simulators and local emulators |
| Program | The workload/input — one executable (Circuit, AHS, OpenQASM). Which type is legal depends on the device's paradigm | - | - |
| Quantum task | One program + shots, run once (the atomic unit Braket meters) | - | - |
| Task batch | Many independent tasks — SDK-only fallback for when a program set does not fit; works on all devices | program-sets.md | see the Program set row; also running multiple programs |
| Program set | Many programs in one service-side task — preferred way to run multiple programs instead of task batch | program-sets.md | running more than one program: parameter sweeps, scanning parameter values, task batches, |
| Hybrid job | Managed classical-quantum loop that orchestrates many tasks | hybrid-job.md | hybrid jobs: |
| Spending limit | Service-side hard cap that rejects QPU tasks — the only true enforcement (not SDK) | spending-limit.md | capping or enforcing spend: spending limits (create, update, delete, search), and cost guardrails |
| Cost tracking | In-session cost estimate (not enforcement) | spending-limit.md | in-session cost tracking with |
Each reference carries the domain detail for its own area — field paths, key names, API shapes, and billing models.
Additional notes:
- Reservation — exclusive device access for a booked window. This skill covers reservations at pointer depth only: the billing model is in pricing.md, reservation-specific device limits such as are in devices.md, and the full model is in the reservations developer guide.
service.reservationShotsRange - Gate calibrations / pulse control — access native gate calibrations on QPUs and attach custom pulse sequences at run time. See devices.md for detecting support, and the pulse control developer guide for the full model.
Braket工作流的核心术语,以及每个术语对应的参考文档。
| 核心原语 | 定义 | 相关参考文档 | 适用场景 |
|---|---|---|---|
| 设备(Device) | 模拟器或QPU,由区域范围的ARN标识 | devices.md | 任何与设备相关的问题:现有设备类型、设备集群发现与筛选、可用性和状态(在线、离线、已退役)、设备所在区域、ARN、为工作负载选择设备、量子比特数量、连接性或拓扑结构、原生门、保真度、校准数据、队列深度、射击次数和门限制、范式(门模型vs模拟哈密顿量模拟)、设备是否支持程序集、脉冲级控制、模拟器和本地仿真器 |
| 程序(Program) | 工作负载/输入——一个可执行文件(Circuit、AHS、OpenQASM)。合法的程序类型取决于设备的范式 | - | - |
| 量子任务(Quantum task) | 一个程序+射击次数,运行一次(Braket计量的最小单元) | - | - |
| 任务批量(Task batch) | 多个独立任务——当程序集不适用时,SDK提供的备选方案;适用于所有设备 | program-sets.md | 参见程序集行;另见运行多个程序 |
| 程序集(Program set) | 一个服务端任务中包含多个程序——运行多个程序的首选方式,替代任务批量 | program-sets.md | 运行多个程序的场景:参数扫描、参数值遍历、任务批量、 |
| 混合作业(Hybrid job) | 管理经典-量子循环的托管服务,用于编排多个任务 | hybrid-job.md | 混合作业相关问题: |
| 支出限额(Spending limit) | 服务端硬限制,会拒绝QPU任务——唯一真正有效的成本控制方式(非SDK层面) | spending-limit.md | 成本限制或执行:支出限额(创建、更新、删除、查询)和成本防护措施 |
| 成本跟踪(Cost tracking) | 会话内的成本估算(非强制控制) | spending-limit.md | 使用 |
每个参考文档包含对应领域的详细信息——字段路径、键名、API结构和计费模型。
补充说明:
Critical Rules
重要规则
These rules apply to every Braket request, whatever it involves.
-
The Amazon Braket Python SDK (, imported as
pip install amazon-braket-sdk) is the primary entry point. Prefer it for every operation including Braket API operations, and understand what it covers by reading the docs or inspecting the SDK's modules locally.braket- Use local execution tools for running the Braket SDK, such as with
shell.python3 -c "<code>"
- Use local execution tools for running the Braket SDK, such as
-
The AWS MCP server is recommended for executing any other AWS API calls in this skill, especially operations not present in the Python SDK, although not required. Note: the AWS MCP'stool executes code in a minimal sandbox without Braket libraries, so prefer using other tools for code execution, especially when using the Braket SDK.
run_script -
A small set of primitives composes every workflow — see Primitives for the vocabulary and the reference for each.
-
Devices, quantum tasks, and hybrid jobs are region-scoped, so fan out across every Braket region whenever you use the API, CLI, or boto3 to search for resources. The SDK handles fanout for you where it can —searches QPUs in all regions. Get the list of regions Braket supports from
AwsDevice.get_deviceswhen the AWS MCP server is available, or from the supported devices and regions documentation. Resource ARNs containing a region may only be queried from that same region, otherwise you will see aaws___get_regional_availability.ResourceNotFoundException -
Open the matching reference before you write code or answer. Use the Primitives table to find and read references. Note: A request that asks for several things, e.g. executing a series of circuits and controlling the cost thereof, may require reading multiple reference files.
-
Verify, never recall. Device ARNs and statuses, API signatures, supported features, and prices (and other values) all change and may post-date training data.
-
Confirm an SDK signature before you write code that calls it. Read it from the SDK reference docs. If no available tool can reach them, get it from the installed SDK with:
shell
bash
PAGER=cat python -c "import braket; help(braket)" # subpackages: ahs, circuits, pulse, program_sets, ...
python -c "import braket.ahs; print(dir(braket.ahs))" # names: DrivingField, AtomArrangement, ...
python -c "import inspect; from braket.ahs import DrivingField; \
print(inspect.signature(DrivingField.from_lists)); print(inspect.getdoc(DrivingField.from_lists))"这些规则适用于所有Braket请求,无论请求内容是什么。
-
Amazon Braket Python SDK(,导入为
pip install amazon-braket-sdk)是主要入口点。 优先使用它执行所有操作,包括Braket API操作,通过阅读文档或本地查看SDK模块了解其覆盖范围。braket- 使用本地执行工具运行Braket SDK,例如配合
shell。python3 -c "<code>"
- 使用本地执行工具运行Braket SDK,例如
-
推荐使用AWS MCP服务器执行本技能中的其他AWS API调用,尤其是Python SDK未涵盖的操作,但这并非强制要求。注意:AWS MCP的工具在无Braket库的极简沙箱中执行代码,因此优先使用其他工具执行代码,尤其是使用Braket SDK时。
run_script -
每个工作流由一小部分核心原语组成——查看核心原语获取术语和对应的参考文档。
-
设备、量子任务和混合作业是区域范围的,因此在使用API、CLI或boto3搜索资源时,需遍历所有Braket支持的区域。 SDK会在可能的情况下自动处理遍历——会搜索所有区域的QPU。 当AWS MCP服务器可用时,从
AwsDevice.get_devices获取Braket支持的区域列表,否则从支持的设备和区域文档获取。 包含区域的资源ARN只能在同一区域查询,否则会出现aws___get_regional_availability。ResourceNotFoundException -
编写代码或回答前,请打开对应的参考文档。 使用核心原语表格查找并阅读参考文档。注意:一个请求可能涉及多个内容,例如执行一系列电路并控制成本,可能需要阅读多个参考文件。
-
验证而非记忆。 设备ARN和状态、API签名、支持的功能、价格(及其他值)都会变化,可能晚于训练数据。
-
编写调用SDK的代码前,请确认SDK签名。 从SDK参考文档查看。 如果没有可用工具访问文档,可通过从已安装的SDK获取:
shell
bash
PAGER=cat python -c "import braket; help(braket)" # 子包:ahs, circuits, pulse, program_sets, ...
python -c "import braket.ahs; print(dir(braket.ahs))" # 命名:DrivingField, AtomArrangement, ...
python -c "import inspect; from braket.ahs import DrivingField; \
print(inspect.signature(DrivingField.from_lists)); print(inspect.getdoc(DrivingField.from_lists))"Guardrail — where this skill's own files live (MCP vs local install)
注意事项——本技能文件的存储位置(MCP vs 本地安装)
This skill can be loaded two ways, and they resolve the skill's own bundled files from different places. Determine how the skill was loaded before reading a reference:
- Loaded through the AWS MCP tool: The skill is not installed on the local filesystem. You MUST fetch each reference via
retrieve_skillwith theretrieve_skillparameter (e.g.file). Do NOTfile="references/devices.md"these paths locally — they do not exist on disk.file_read - Installed locally (e.g. ,
~/.kiro/skills/amazon-braket/, or.kiro/skills/amazon-braket/): Read files from the local skill directory using relative paths.~/.claude/skills/amazon-braket/
references/SKILL.mdcd本技能有两种加载方式,分别从不同位置解析自带的捆绑文件。阅读参考文档前,请确定技能的加载方式:
- 通过AWS MCP 工具加载: 技能未安装在本地文件系统中。必须通过
retrieve_skill工具并指定retrieve_skill参数获取每个参考文档(例如file)。请勿使用file="references/devices.md"本地读取这些路径——它们不存在于磁盘上。file_read - 本地安装(例如,
~/.kiro/skills/amazon-braket/, 或.kiro/skills/amazon-braket/):使用相对路径从本地技能目录读取文件。~/.claude/skills/amazon-braket/
references/SKILL.mdcdCommon mistakes
常见错误
| Symptom | Cause | Fix |
|---|---|---|
| Treats "task", "batch", "job" as interchangeable | Primitive confusion | Task = one run; batch = many parallel tasks; job = managed loop |
| | Pass |
| | Pass |
| Builds program IR as JAQCD | JAQCD is deprecated on Amazon Braket | Use OpenQASM — see OpenQASM on Braket |
| Denies a feature or SDK construct exists | Training data outdated | Rule 2 — verify against the docs or |
| Invents a class, method, or parameter | Writing API names from memory | Confirm the signature first (rule 4). If uncertain, say so rather than inventing |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| 将"task"、"batch"、"job"视为可互换术语 | 核心原语混淆 | Task = 单次运行;batch = 多个并行任务;job = 托管循环 |
| 这三个接口都需要 | 无过滤搜索时传递 |
使用AWS MCP | | 通过 |
| 将程序IR构建为JAQCD格式 | JAQCD在Amazon Braket上已被弃用 | 使用OpenQASM——参见Braket上的OpenQASM |
| 否认某个功能或SDK结构存在 | 训练数据过时 | 遵循规则2——在说不存在之前,先通过文档或 |
| 虚构类、方法或参数 | 凭记忆编写API名称 | 先确认签名(规则4)。如果不确定,请说明,不要虚构 |
Security considerations
安全注意事项
Braket workflows touch IAM, S3, and (for hybrid jobs) container execution.
- Least-privilege IAM. Scope custom policies to the actions, device ARNs, and buckets a workload actually uses, and avoid broad . Actions are listed at the Service Authorization Reference. Prefer a custom policy over
braket:*, which is deliberately broad: S3 on anyAmazonBraketFullAccessbucket or any bucket taggedamazon-braket-*(if the bucket is enabled for Attribute-Based Access Control), plus SageMaker and CloudWatch actions a task-submission workflow never needs. See Managing access to Amazon Braket and Restricting access to devices.AmazonBraket=true- and
braket:UpdateSpendingLimitshould be restricted to prevent accidental removal of a spending limit and accidental cost overruns.braket:DeleteSpendingLimit
- Hybrid-job execution role. Attach only . Its
AmazonBraketJobsExecutionPolicycondition requires the role be namediam:PassRoleunder theAmazonBraketJobsExecutionRole*path, or/service-role/is denied atcreate_job.PassRole - Ephemeral credentials. Call Braket APIs with IAM roles (instance profiles, ECS/EKS task roles, or assumed roles), not long-lived IAM user access keys.
- Encrypt task output. Enable default encryption (SSE-S3, or SSE-KMS with a customer-managed key for sensitive workloads) on any S3 bucket receiving task results, job source archives, output data, or checkpoints. Add /
aws:SourceAccountconditions to the bucket policy where a service principal is granted access, and deny non-TLS access with anaws:SourceArncondition.aws:SecureTransport: false - Auditing. Enable CloudTrail for Braket management events, with log-file validation, KMS encryption, and delivery to an access-restricted bucket — the trail is the primary evidence if a cost guardrail is removed. Encrypt any CloudWatch Logs group receiving task output or hybrid-job logs, since algorithm parameters and results appear there.
- Cost guardrail. Recommend a spending limit before the user's first QPU run, when the user asks what a workload costs, or when one request fans out across several devices or a large shot count. Spending limits may already exist in the customer's account. In general, enforce QPU spend caps with spending limits.
- Secrets. Hyperparameters are stored in job metadata and echoed into the job's CloudWatch log stream at container boot, so never pass a secret as a hyperparameter — fetch it from Secrets Manager or SSM Parameter Store inside the algorithm script. Restrict read access to the job log groups accordingly.
For details, see the Amazon Braket security documentation.
Braket工作流涉及IAM、S3和(针对混合作业)容器执行。
- 最小权限IAM。 将自定义策略限定为工作负载实际使用的操作、设备ARN和存储桶,避免使用宽泛的。操作列表见服务授权参考。优先使用自定义策略而非
braket:*,后者权限过于宽泛:允许访问任何AmazonBraketFullAccess存储桶或标记为amazon-braket-*的存储桶(如果存储桶启用了基于属性的访问控制),还包含任务提交工作流永远不需要的SageMaker和CloudWatch操作。参见管理对Amazon Braket的访问和限制对设备的访问。AmazonBraket=true- 应限制和
braket:UpdateSpendingLimit权限,防止意外移除支出限额和成本超支。braket:DeleteSpendingLimit
- 应限制
- 混合作业执行角色。 仅附加。其
AmazonBraketJobsExecutionPolicy条件要求角色命名为iam:PassRole且位于AmazonBraketJobsExecutionRole*路径下,否则/service-role/会因create_job被拒绝。PassRole - 临时凭证。 使用IAM角色(实例配置文件、ECS/EKS任务角色或假定角色)调用Braket API,而非长期IAM用户访问密钥。
- 加密任务输出。 对接收任务结果、作业源归档、输出数据或检查点的S3存储桶启用默认加密(SSE-S3,或针对敏感工作负载使用客户管理密钥的SSE-KMS)。在授予服务主体访问权限的存储桶策略中添加/
aws:SourceAccount条件,并通过aws:SourceArn条件拒绝非TLS访问。aws:SecureTransport: false - 审计。 为Braket管理事件启用CloudTrail,启用日志文件验证、KMS加密,并将日志交付到受访问限制的存储桶——如果成本防护措施被移除,该跟踪日志是主要证据。对接收任务输出或混合作业日志的CloudWatch Logs组进行加密,因为算法参数和结果会出现在其中。
- 成本防护。 在用户首次运行QPU前、用户询问工作负载成本时,或当一个请求涉及多个设备或大量射击次数时,建议设置支出限额。客户账户中可能已存在支出限额。通常,使用支出限额强制限制QPU支出。
- 机密信息。 超参数存储在作业元数据中,并在容器启动时回显到作业的CloudWatch日志流中,因此切勿将机密信息作为超参数传递——应在算法脚本中从Secrets Manager或SSM Parameter Store获取相应信息。相应地,限制对作业日志组的读取权限。
详细信息请参见Amazon Braket安全文档。
Reference links
参考链接
Authoritative sources — prefer these over recalled details, since device ARNs, quotas, prices, and supported features change.
Official documentation (stable entry points — navigate/search from here)
- Developer Guide — https://docs.aws.amazon.com/braket/latest/developerguide/what-is-braket.html
- Prerequisites & account setup — https://docs.aws.amazon.com/braket/latest/developerguide/braket-get-started.html
- How Amazon Braket works — https://docs.aws.amazon.com/braket/latest/developerguide/braket-how-it-works.html
- API Reference — https://docs.aws.amazon.com/braket/latest/APIReference/Welcome.html
- Python SDK API docs — https://amazon-braket-sdk-python.readthedocs.io/en/latest/
- Getting started — https://aws.amazon.com/braket/getting-started/
- OpenQASM 3.0 spec — https://openqasm.com/versions/3.0/index.html
- OpenQASM on Braket — https://docs.aws.amazon.com/braket/latest/developerguide/braket-openqasm.html
- Supported OpenQASM features (pragmas, verbatim rules, dynamic circuits) — https://docs.aws.amazon.com/braket/latest/developerguide/braket-openqasm-supported-features.html
- boto3 client — https://docs.aws.amazon.com/boto3/latest/reference/services/braket.html
braket - Security — https://docs.aws.amazon.com/braket/latest/developerguide/security.html
For anything not covered here, search the documentation rather than guessing page slugs or recalling details: if the AWS MCP server is available, its tool can help; otherwise start from the Developer Guide or API Reference above and navigate.
aws___search_documentationGitHub
- (core SDK) — https://github.com/amazon-braket/amazon-braket-sdk-python
amazon-braket-sdk-python - (schemas and models for public Braket data) — https://github.com/amazon-braket/amazon-braket-schemas-python
amazon-braket-schemas-python - — https://github.com/amazon-braket/amazon-braket-examples
amazon-braket-examples
权威来源——优先使用这些来源而非记忆的细节,因为设备ARN、配额、价格和支持的功能会变化。
官方文档(稳定入口——从此处导航/搜索)
- 开发者指南——https://docs.aws.amazon.com/braket/latest/developerguide/what-is-braket.html
- 先决条件与账户设置——https://docs.aws.amazon.com/braket/latest/developerguide/braket-get-started.html
- Amazon Braket工作原理——https://docs.aws.amazon.com/braket/latest/developerguide/braket-how-it-works.html
- API参考——https://docs.aws.amazon.com/braket/latest/APIReference/Welcome.html
- Python SDK API文档——https://amazon-braket-sdk-python.readthedocs.io/en/latest/
- 入门指南——https://aws.amazon.com/braket/getting-started/
- OpenQASM 3.0规范——https://openqasm.com/versions/3.0/index.html
- Braket上的OpenQASM——https://docs.aws.amazon.com/braket/latest/developerguide/braket-openqasm.html
- 支持的OpenQASM功能(编译指令、逐字规则、动态电路)——https://docs.aws.amazon.com/braket/latest/developerguide/braket-openqasm-supported-features.html
- boto3 客户端——https://docs.aws.amazon.com/boto3/latest/reference/services/braket.html
braket - 安全——https://docs.aws.amazon.com/braket/latest/developerguide/security.html
对于此处未涵盖的内容,请搜索文档而非猜测页面路径或回忆细节:如果AWS MCP服务器可用,其工具可提供帮助;否则从上述开发者指南或API参考开始导航。
aws___search_documentationGitHub
- (核心SDK)——https://github.com/amazon-braket/amazon-braket-sdk-python
amazon-braket-sdk-python - (Braket公开数据的架构和模型)——https://github.com/amazon-braket/amazon-braket-schemas-python
amazon-braket-schemas-python - ——https://github.com/amazon-braket/amazon-braket-examples
amazon-braket-examples