Documentation

Install the CLI, authenticate once, send a problem. Everything below works from a terminal or from any HTTP client.

1. Install

The CLI is a thin client — no engine on your machine.

terminal
pip install hexstellar
PyPI version PyPI downloads Python versions

2. Authenticate

Create a key in API keys, then store it once.

terminal
hexstellar login --key YOUR_KEY

3. Solve

terminal
echo '{"n":4,"edges":[[0,1,1],[1,2,1],[2,3,1],[3,0,1]]}' | hexstellar solve maxcut --format json

Or straight over HTTP:

http
curl -sS https://admin.hexstellar.com/api/v1/solve/maxcut \
  -H "Authorization: Bearer $HEXSTELLAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":4,"edges":[[0,1,1],[1,2,1],[2,3,1],[3,0,1]]}'

4. Every mode

One API, one JSON-in / JSON-out contract, across every mode below. Start with a core solver; reach for rules when a real problem has real constraints; the science and reliability modes are there when you need them. An answer is a certified optimum when the space was checked in full, and a strong hypothesis when it was too large — always labelled.

Core solvers

Send a problem, get the answer.

Mode What it does Where it fits
optimize Minimize any QUBO / Ising objective — the general-purpose optimizer. Any hard combinatorial cost
maxcut Maximum cut of a weighted graph. Clustering, telecom, partitioning
tsp Shortest closed tour over a distance matrix. Routing & travel
qap Assign facilities to locations, minimizing flow × distance. Factory & warehouse layout
milp Mixed-integer and continuous minimization. Supply chain, planning
select Pick exactly k of m items, maximizing value minus overlap. Shortlisting, sensor placement
design Choose one option of K at each site, minimizing conflict. Configuration & assignment
rank Turn noisy pairwise comparisons into one consistent ranking. Search, voting, sports

Rules — advanced, constrained

Add your real-world business rules on top of an objective. No modelling by hand.

Mode What it does Where it fits
rules Declare constraints in plain JSON; get an answer that satisfies every one. Logistics, rostering, portfolios, cloud
want Pin some outputs and solve for the rest — a constrained answer. What-if & scenario solving

Science & research

The engine behind next-generation R&D.

Mode What it does Where it fits
spectrum Eigenvalues and ground-state energy of a Hamiltonian. Materials & chemistry
entropy Entanglement (von Neumann) entropy of a subsystem. Quantum R&D
frequency Dominant frequency and power spectrum of a noisy signal. Radar, seismic, sensors
phase Detect a critical or topological phase transition. Condensed-matter research
quantum-scale Reach the planted optimum of a 2ⁿ landscape. Benchmarking & validation
xorsat Satisfy the most k-body parity (XOR) clauses. Logic & hardware verification
feel Give fields and couplings directly, get the answer. Custom energy models
sample Draw samples from the low-cost region of a problem. Ensembles & uncertainty
world Virtual-world core: kinematics, terrain, neighbours, pose. Simulation & physical AI

Precision, reliability & discovery

Exact arithmetic, data integrity, and constant discovery.

Mode What it does Where it fits
relation Find exact integer relations among values, or abstain. Discovery, anomaly auditing
reduce LLL lattice-basis reduction — short, near-orthogonal bases. Cryptanalysis research
precision Evaluate an operation at extreme (Dd) precision. Scientific computing
protect Shield any byte payload against corruption. Data integrity
recover Heal a corrupted payload back to byte-exact, or abstain. Fault tolerance

The nine rules rules understands

choose_one choose_exactly capacity_limit mutual_exclusion requires identical different force_true force_false

Send them as a constraints array — e.g. {"type": "capacity_limit", "k": 3, "nodes": [...]} — and the engine returns an assignment that breaks none of them.

5. Read the answer

Every response carries a certainty label. Treat a certified answer as proven, and a heuristic one as a strong hypothesis to verify.

certified optimum (proven by exhaustion) heuristic (hypothesis — verify)

6. Errors & backpressure

StatusMeaningWhat to do
200 Solved Read data.answer and the certainty label.
202 Queued (expensive solve) Poll the returned job_id until it completes.
402 Out of compute units Top up — do not retry.
422 Invalid problem Fix the field named in the error and resubmit.
429 Rate or compute budget hit Wait for Retry-After, then resend.
503 Busy / queue full Wait for Retry-After, then resend. Nothing was charged.

7. Model versions — pin the math

Cortex ships frozen model versions, the way an LLM ships gpt-4o / claude side by side — a released model is never overwritten. Pin cortex-1.0 and the math is byte-stable forever (your automated tests never break under the hood); use cortex-latest to always ride the newest. The response echoes the resolved version; an unknown version is a clean error, never a silent switch.

terminal
hexstellar models                                          # the catalogue
echo '{...}' | hexstellar solve maxcut --model cortex-1.0   # frozen math, forever
# HTTP: "version":"cortex-1.0" in the body, or ?version=cortex-1.0 · GET /api/v1/models

8. Latency budget — never a hung request

Every solve runs under a wall-clock budget. If the search reaches it, the service returns the best answer found so far — marked stopped_at_deadline: true and certainty: "heuristic — verify" — never a dropped connection, never a fabricated “certified”. Set your own budget below your client's timeout so you always get a usable answer back in time. You can ask for less than the service ceiling, never more.

terminal
echo '{"n":2000,"edges":[...]}' | hexstellar solve maxcut --effort max --max-latency-ms 5000
# → answer + cut_value, stopped_at_deadline: true, latency_budget_ms: 5000

Over HTTP: ?max_latency_ms=5000 or {"contract":{"requirements":{"max_latency_ms":5000}}}. The response echoes latency_budget_ms and stopped_at_deadline.

9. For AI agents

The CLI carries a machine-readable spec, and hexstellar spec / hexstellar prompt fetch the latest live version from the docs site every run (so your agent is never out of date), falling back to the bundled copy offline — add --offline to force the bundled one.

terminal
hexstellar capabilities   # every command + input schema (bundled)
hexstellar spec           # the exhaustive agent specification (live — always current)
hexstellar prompt         # a drop-in system prompt for your agent (live)
hexstellar examples       # ready-to-run problem templates