You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IonQ's Hosted Hybrid Service exposes Quantum Functions — e.g. Hamiltonian-energy evaluation (ansatz + Hamiltonian + params → energy). It's part of the public API, and ionq-core already ships typed models: QuantumFunctionJobCreationPayload (a create_job body variant) built from HamiltonianEnergyInput, Ansatz, and HamiltonianPauliTerm (under ionq_core.models). It runs on the free simulator, but there's no example and no examples/ directory.
What to build
An examples/ script that builds a Hamiltonian-energy quantum function with the typed models, evaluates the energy via create_job + wait_for_job, and optimizes the parameters to minimize it with a client-side optimizer.
Keep the Hamiltonian, ansatz, and optimizer open-ended (SPSA, COBYLA, scipy.optimize, or hand-rolled) — the point is the end-to-end variational shape, not a specific algorithm. Structure: an energy callback (params → submit → wait_for_job → energy) driven by the optimizer, printing per-iteration energy and the final optimal parameters, against the free simulator.
Definition of done
examples/ script and examples/README.md (setup: pip install ionq-core, export IONQ_API_KEY=...), linked from the top-level README.md.
Builds the quantum function with the typed ionq_core.models payloads, submits via create_job, polls with wait_for_job, and minimizes the energy; module docstring states the chosen Hamiltonian / ansatz / optimizer.
Uses public API (IonQClient, create_job, wait_for_job, the quantum-function models); SPDX header (AGENTS.md).
uv run ruff check, uv run ruff format --check, and uv run ty check examples/ pass. (Needn't run in CI — no API key — but must lint and type-check.)
Notes
httpx-only; apiKey auth, not Bearer. Don't add an optimizer (e.g. scipy) to the core package's runtime deps — keep it example-only. References: Hosted Hybrid guide, the typed models under ionq_core/models/ (quantum_function_job_creation_payload.py, hamiltonian_energy_input.py, ansatz.py, hamiltonian_pauli_term.py), and polling in ionq_core/polling.py.
Background
IonQ's Hosted Hybrid Service exposes Quantum Functions — e.g. Hamiltonian-energy evaluation (ansatz + Hamiltonian + params → energy). It's part of the public API, and
ionq-corealready ships typed models:QuantumFunctionJobCreationPayload(acreate_jobbody variant) built fromHamiltonianEnergyInput,Ansatz, andHamiltonianPauliTerm(underionq_core.models). It runs on the freesimulator, but there's no example and noexamples/directory.What to build
An
examples/script that builds a Hamiltonian-energy quantum function with the typed models, evaluates the energy viacreate_job+wait_for_job, and optimizes the parameters to minimize it with a client-side optimizer.Keep the Hamiltonian, ansatz, and optimizer open-ended (SPSA, COBYLA,
scipy.optimize, or hand-rolled) — the point is the end-to-end variational shape, not a specific algorithm. Structure: an energy callback (params → submit → wait_for_job → energy) driven by the optimizer, printing per-iteration energy and the final optimal parameters, against the freesimulator.Definition of done
examples/script andexamples/README.md(setup:pip install ionq-core,export IONQ_API_KEY=...), linked from the top-levelREADME.md.ionq_core.modelspayloads, submits viacreate_job, polls withwait_for_job, and minimizes the energy; module docstring states the chosen Hamiltonian / ansatz / optimizer.IonQClient,create_job,wait_for_job, the quantum-function models); SPDX header (AGENTS.md).uv run ruff check,uv run ruff format --check, anduv run ty check examples/pass. (Needn't run in CI — no API key — but must lint and type-check.)Notes
httpx-only;apiKeyauth, notBearer. Don't add an optimizer (e.g.scipy) to the core package's runtime deps — keep it example-only. References: Hosted Hybrid guide, the typed models underionq_core/models/(quantum_function_job_creation_payload.py,hamiltonian_energy_input.py,ansatz.py,hamiltonian_pauli_term.py), and polling inionq_core/polling.py.