Quickstart
This guide takes you from nothing to a circuit run on the Amazon Braket SV1 simulator through the router, with eigenkit or with plain HTTP.
1. Install eigenkit with the router client
Code
The router extra of eigenkit installs the router client. New router features ship in the client,
so upgrade it by name:
Code
You need nothing extra for HTTP: every call below is a curl command.
2. Create an API key
- Sign in to the router web app at https://router.eigenorbit.com and accept the router terms.
- Add funds on the Balance page. SV1 is an Amazon Braket device, so its jobs are paid from your balance.
- Create an API key on the Keys page. The key is shown once: copy it then.
A job on SV1 holds 90000 micro-USD of your balance while it runs. Amounts are integers in
micro-USD, so that is 90000 / 1000000 = $0.09. A short job is then charged 4500 ($0.0045) and the
rest of the hold comes back. See Balance, holds and charges.
3. Put the key in an environment variable
Code
eigenkit reads the key from EIGENORBIT_ROUTER_API_KEY when RouterConfig(api_key=...) is not
set. The curl commands below read it from the same variable.
4. Run a circuit on braket/sv1
With eigenkit, building the circuit asks the router for an estimate and shows one CostWarning with
the price of a job. The call circuit(weights, inputs) then sends one job and blocks until it
finishes.
Over HTTP, the body is a one-qubit circuit RY(w0) measured with Z0, with shots 0 for an exact
result. eigenkit produces circuit_spec and observables in this form; their format is not
specified for hand-written requests. The router answers 202 with the new job:
Code
5. Read the result
With eigenkit, values holds one expectation value per observable, as on any other eigenkit
provider. sample(...) and probabilities(...) work as well.
Over HTTP, poll the job until its status is completed, then read the result. Asking for the
result earlier answers 409 job_not_completed. Use the id from the answer above:
Code
The result of a run job is one expectation value per observable, as a float64 array:
Code
The answer also carries execution, which this example omits: what the router ran on the vendor,
for SV1 the Amazon Braket task ID. See Job lifecycle.
Next steps
- API keys and budgets: give each key a spend budget, rename and revoke keys.
- Devices and prices: pick a QPU and read its shot range and price.
- Estimate cost before a run: price a job without running it.
- Job lifecycle: statuses, polling, results, cancel and retention.
- Errors, retries and idempotency: what to do when a call fails.