curl --request GET \
--url 'https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY='import requests
url = "https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"algorithm": "lr-qaoa",
"code": "from qiskit import QuantumCircuit\n# ... verified internals inlined here ...\nMANIFEST = {'algorithm': 'lr-qaoa', 'n_qubits': 8, 'qasm': '...'}\n",
"language": "python",
"note": "Run: pip install qiskit qiskit-aer qiskit-ibm-runtime networkx numpy; python the_file.py. The haiqu_run + haiqu_full variants additionally need `pip install haiqu-sdk` and HAIQU_API_KEY; the two baselines run without them.",
"steps": [
{
"id": "show_recipe",
"intent": "User reads what is about to execute before any side effects.",
"render_after": [],
"render_before": [
"Paste the `code` field as a fenced Python block.",
"Point out the EDIT-HERE region."
],
"title": "Show the recipe code"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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”).
curl --request GET \
--url 'https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY='import requests
url = "https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/qakb/algorithms/{algorithm_key}/recipe?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"algorithm": "lr-qaoa",
"code": "from qiskit import QuantumCircuit\n# ... verified internals inlined here ...\nMANIFEST = {'algorithm': 'lr-qaoa', 'n_qubits': 8, 'qasm': '...'}\n",
"language": "python",
"note": "Run: pip install qiskit qiskit-aer qiskit-ibm-runtime networkx numpy; python the_file.py. The haiqu_run + haiqu_full variants additionally need `pip install haiqu-sdk` and HAIQU_API_KEY; the two baselines run without them.",
"steps": [
{
"id": "show_recipe",
"intent": "User reads what is about to execute before any side effects.",
"render_after": [],
"render_before": [
"Paste the `code` field as a fenced Python block.",
"Point out the EDIT-HERE region."
],
"title": "Show the recipe code"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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).
Show child attributes
Show child attributes