Cirq hardware providers and serialization
Use this sub-skill when a task touches Cirq provider packages, hardware-facing samplers, provider serializers, credentials, JSON persistence, or cirq_web visualization. Default to offline inspection and validation; make live service calls only when the user explicitly supplies credentials, project/processor/target details, and permission to contact the service.
Use this when
- Working with
cirq_google.Engine, get_engine_sampler, Google devices such as Sycamore or Willow105, Google target gatesets, serializers, or workflow objects.
- Preparing IonQ circuits with
cirq_ionq.Service, cirq_ionq.Sampler, IonQ serializers, or IonQ target gatesets.
- Using AQT
AQTSampler, AQTSamplerLocalSimulator, workspace/resource/token concepts, or AQT-local validation.
- Using Pasqal
PasqalSampler, PasqalDevice, PasqalVirtualDevice, TwoDQubit, or ThreeDQubit.
- Rendering provider-adjacent visualizations with
cirq_web.Circuit3D, widgets, or offline HTML representations.
- Persisting or exchanging Cirq objects with
cirq.to_json, cirq.read_json, provider JSON resolvers, or custom serialization hooks.
Route elsewhere
- Generic qubits, gates, operations, circuit construction, parameters, diagrams, or JSON basics:
core-circuits-and-ops.
- Local simulator-only studies, noisy simulation, histograms, sweeps, or result analysis:
simulation-study-and-noise.
- Decomposing unsupported gates, routing to a topology, or compiling to target gatesets before provider packaging:
transformers-and-compilation.
- Algorithm design or observable expectation workflows before hardware packaging:
algorithms-and-observables.
Reference map
- Start with Provider API reference for public package boundaries, key signatures, devices, samplers, serializers, target gatesets, and widget objects.
- Use Provider and visualization workflows for offline packaging, credential gates, live-run stop conditions, and
cirq_web usage.
- Use Serialization for
cirq.to_json, cirq.read_json, custom resolvers, provider resolver registration, and distinctions between Cirq JSON and provider API serialization.
- Use Troubleshooting for missing optional packages, absent credentials, project/target errors, unsupported gates, resolver failures, and browser/frontend limitations.
Bundled safe helper
Run the deterministic helper to inspect installed provider packages and perform an optional JSON/widget smoke check without network or credentials:
python scripts/inspect_provider_imports.py --help
python scripts/inspect_provider_imports.py
python scripts/inspect_provider_imports.py --check-widget-html
The helper imports provider packages, reports sanitized public signatures, can round-trip a tiny circuit with Cirq JSON, and never creates live cloud jobs, opens sockets, prints token values, or reads any source checkout.
Operating guardrails
- Treat cloud access as opt-in. Stop before
run, run_sweep, create_job, list_*, get_*, resource discovery, or sampler execution unless the user explicitly authorizes a live service call.
- Separate three phases: circuit construction, offline provider validation/serialization, then credentialed submission. Route construction and compilation to their sub-skills before submission.
- Never store API tokens, project secrets, or credential file contents in Cirq JSON, notebooks, logs, or bundled scripts.
- Prefer provider serializers, device validation, and target gatesets for offline rejection of unsupported gates; use the transformers sub-skill when conversion is needed.
- For
cirq_web, assume a local browser or notebook display is optional. Validate by generating an HTML representation, not by requiring WebGL, Node, npm, or a browser automation stack.
1---2name: hardware-providers-and-serialization3description: "Use Cirq provider packages, provider-safe serialization, and4 browser visualization workflows without accidental live hardware calls."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/hardware-providers-and-serialization8 disco-role: operating9license: Apache 2.010---1112# Cirq hardware providers and serialization1314Use this sub-skill when a task touches Cirq provider packages, hardware-facing samplers, provider serializers, credentials, JSON persistence, or `cirq_web` visualization. Default to offline inspection and validation; make live service calls only when the user explicitly supplies credentials, project/processor/target details, and permission to contact the service.1516## Use this when1718- Working with `cirq_google.Engine`, `get_engine_sampler`, Google devices such as `Sycamore` or `Willow105`, Google target gatesets, serializers, or workflow objects.19- Preparing IonQ circuits with `cirq_ionq.Service`, `cirq_ionq.Sampler`, IonQ serializers, or IonQ target gatesets.20- Using AQT `AQTSampler`, `AQTSamplerLocalSimulator`, workspace/resource/token concepts, or AQT-local validation.21- Using Pasqal `PasqalSampler`, `PasqalDevice`, `PasqalVirtualDevice`, `TwoDQubit`, or `ThreeDQubit`.22- Rendering provider-adjacent visualizations with `cirq_web.Circuit3D`, widgets, or offline HTML representations.23- Persisting or exchanging Cirq objects with `cirq.to_json`, `cirq.read_json`, provider JSON resolvers, or custom serialization hooks.2425## Route elsewhere2627- Generic qubits, gates, operations, circuit construction, parameters, diagrams, or JSON basics: `core-circuits-and-ops`.28- Local simulator-only studies, noisy simulation, histograms, sweeps, or result analysis: `simulation-study-and-noise`.29- Decomposing unsupported gates, routing to a topology, or compiling to target gatesets before provider packaging: `transformers-and-compilation`.30- Algorithm design or observable expectation workflows before hardware packaging: `algorithms-and-observables`.3132## Reference map3334- Start with [Provider API reference](references/provider-api-reference.md) for public package boundaries, key signatures, devices, samplers, serializers, target gatesets, and widget objects.35- Use [Provider and visualization workflows](references/provider-and-visualization-workflows.md) for offline packaging, credential gates, live-run stop conditions, and `cirq_web` usage.36- Use [Serialization](references/serialization.md) for `cirq.to_json`, `cirq.read_json`, custom resolvers, provider resolver registration, and distinctions between Cirq JSON and provider API serialization.37- Use [Troubleshooting](references/troubleshooting.md) for missing optional packages, absent credentials, project/target errors, unsupported gates, resolver failures, and browser/frontend limitations.3839## Bundled safe helper4041Run the deterministic helper to inspect installed provider packages and perform an optional JSON/widget smoke check without network or credentials:4243```bash44python scripts/inspect_provider_imports.py --help45python scripts/inspect_provider_imports.py46python scripts/inspect_provider_imports.py --check-widget-html47```4849The helper imports provider packages, reports sanitized public signatures, can round-trip a tiny circuit with Cirq JSON, and never creates live cloud jobs, opens sockets, prints token values, or reads any source checkout.5051## Operating guardrails5253- Treat cloud access as opt-in. Stop before `run`, `run_sweep`, `create_job`, `list_*`, `get_*`, resource discovery, or sampler execution unless the user explicitly authorizes a live service call.54- Separate three phases: circuit construction, offline provider validation/serialization, then credentialed submission. Route construction and compilation to their sub-skills before submission.55- Never store API tokens, project secrets, or credential file contents in Cirq JSON, notebooks, logs, or bundled scripts.56- Prefer provider serializers, device validation, and target gatesets for offline rejection of unsupported gates; use the transformers sub-skill when conversion is needed.57- For `cirq_web`, assume a local browser or notebook display is optional. Validate by generating an HTML representation, not by requiring WebGL, Node, npm, or a browser automation stack.