Get Haiqu Algorithm Recipe
Return a complete, runnable Python script for one algorithm.
Use this tool when the user wants to run an algorithm, see its code, asks
“how do I run LR-QAOA”, “give me the code”, “show me a noise-mitigation
benchmark”, or “benchmark this on a noisy device”. Get the key from
list_haiqu_algorithms first if the user did not give an exact one.
The returned code is self-contained: it runs the algorithm across four
variants (ideal baseline, noisy baseline, transpiled-on-Haiqu run, full
Haiqu stack with error mitigation) on one problem instance and prints an
approximation-ratio comparison. The user can run it as-is or edit the
clearly marked EDIT-HERE block (graph, layers, shots, device) to change
the problem. The two Haiqu variants require the user’s Haiqu API key; the
two baselines run with only open-source packages.
Args:
algorithm_key: Algorithm identifier from list_haiqu_algorithms
(e.g. “lr-qaoa”).
Authorizations
Path Parameters
Response
Successful Response
A self-contained, runnable Python script for one algorithm, plus a per-algorithm demo orchestration plan.
Algorithm key the recipe is for.
Complete, copy-pasteable Python script. Runs locally and on Haiqu.
How to run it + which variants need a Haiqu API key.
Source language of the recipe.
Ordered demo plan. The orchestrating LLM should walk these in order, rendering the indicated artifacts inline. The plan is algorithm-agnostic in shape; algorithm-specific render content comes from sandbox-side hooks the recipe defines (compute_results, format_headline).