AI-native quantum computing SDK — 20 MCP tools, 200+ qubit MPS/sparse simulation, 31 gates, IBM Quantum hardware, Grover, QAOA, VQE, Shor, QEC
Project description
ONMARTECH QUANTA QUANTUM SDK
AI-native quantum computing SDK for Python
The quantum runtime built for AI agents, researchers, and production workloads
Quanta is an AI-native quantum computing SDK — designed to be called by AI agents (via MCP), used by researchers, and deployed in production. It provides a 3-layer abstraction — from high-level declarative APIs (search(), factor()) to low-level DAG manipulation and QASM export — with 20 MCP tools that let Claude, GPT, and other AI assistants run quantum computations directly.
🚀 What's New in v0.9.2
- 200+ Qubit Simulation — New MPS (tensor network) simulator: 100-qubit GHZ, 200-qubit QAOA ✅
- Sparse Simulator — Dict-based sparse statevector: 35-qubit GHZ in 120 bytes vs 256 GB dense
- SimulatorBackend ABC — Abstract base class for all simulators + factory pattern
- Circuit-Aware Router — Automatic simulator selection (Clifford→PauliFrame, Dense→Sparse→MPS)
- Security Hardened — exec() sandboxing, eval() elimination, traceback leak prevention
- Architecture Fix — Layer 3 algorithms decoupled from specific simulator backends
Table of Contents
- Quick Start
- IBM Quantum Integration
- MCP AI Integration
- Architecture
- Features
- Algorithms
- Qubit Limits
- Examples & Use Cases
- Quality Benchmark
- Installation
- Documentation
- Author
Quick Start
from quanta import circuit, H, CX, measure, run
@circuit(qubits=2)
def bell(q):
H(q[0])
CX(q[0], q[1])
return measure(q)
result = run(bell, shots=1024)
print(result)
╔══════════════════════════════════════════════════╗
║ Quanta Result: bell ║
╠──────────────────────────────────────────────────╣
║ |00> ████████████████████ 50.5% ║
║ |11> ███████████████████ 49.5% ║
╠──────────────────────────────────────────────────╣
║ 0.71|00> + 0.71|11> ║
╚══════════════════════════════════════════════════╝
IBM Quantum Integration
Run circuits on real IBM quantum computers — up to 156 qubits on Heron r3 processors. No Qiskit installation required.
from quanta.backends.ibm_rest import IBMRestBackend
# Connect to IBM Quantum (set IBM_API_KEY and IBM_INSTANCE_CRN env vars)
backend = IBMRestBackend(region="us", backend_name="ibm_torino")
# List available backends
backends = backend.list_backends()
# ibm_fez: 156 qubits (Heron r2), ibm_torino: 156 qubits (Heron r3)
# Submit a Bell state to real hardware
result = backend.run(bell, shots=4096)
# Real quantum noise: |00⟩=47.5%, |11⟩=39.5%, fidelity=87%
Available IBM Backends
| Backend | Qubits | Processor | 2Q Error | Use Case |
|---|---|---|---|---|
| ibm_torino | 156 | Heron r3 | 0.25% | General purpose |
| ibm_fez | 156 | Heron r2 | 0.28% | Large circuits |
| ibm_marrakesh | 156 | Heron r2 | 0.23% | Low error |
ISA Transpilation
All circuits automatically transpile to Heron's native gate set:
| Your Gate | → ISA Decomposition |
|---|---|
| H | rz(π/2) · sx · rz(π/2) |
| CX | H(target) · CZ · H(target) |
| RX, RY | rz + sx combinations |
| CZ, RZ, SX, X | Native (no change) |
Free Tier Limits (Open Plan)
| Resource | Limit |
|---|---|
| QPU time | 10 min/month |
| Qubits | Up to 156 (Heron r3) |
| Shots | Up to 100,000 per job |
| Sessions | Supported |
MCP AI Integration
Quanta exposes 16 MCP tools for AI assistants (Claude, GPT, etc.):
# Install as MCP server
fastmcp install quanta/mcp_server.py --name "Quanta Quantum SDK"
Available Tools
| Tool | Description |
|---|---|
run_circuit |
Execute quantum circuit code |
create_bell_state |
Quick Bell state |
grover_search |
Grover's search algorithm |
shor_factor |
Shor's factoring algorithm |
simulate_noise |
Run with noise model |
draw_circuit |
SVG circuit diagram |
list_gates |
All 31 quantum gates |
explain_result |
Interpret measurements |
monte_carlo_price |
Quantum option pricing |
qaoa_optimize |
QAOA optimization |
cluster_data |
Quantum clustering |
run_on_ibm |
Run on IBM hardware |
ibm_backends |
List IBM quantum computers |
ibm_job_result |
Poll job status & fetch results |
surface_code_simulate |
Surface code QEC simulation |
compare_decoders |
Compare MWPM vs Union-Find decoders |
Architecture
┌──────────────────────────────────────────────────────────┐
│ Layer 3 — Declarative API │
│ search() · optimize() · vqe() · factor() · qsvm() │
│ monte_carlo() · cluster() · resolve() │
├──────────────────────────────────────────────────────────┤
│ Layer 2 — Circuit API │
│ @circuit · 31 gates · measure · run · sweep │
│ SVG visualization · QASM 3.0 export │
├──────────────────────────────────────────────────────────┤
│ Layer 1 — Physical Layer │
│ DAG IR · 6-pass compiler · qubit routing · ISA transpile│
│ statevector · density matrix · Pauli frame · IBM REST │
└──────────────────────────────────────────────────────────┘
Features
31 Quantum Gates (Full IBM Parity + Google/IonQ Native)
| Category | Gates |
|---|---|
| Pauli | X, Y, Z |
| Hadamard | H |
| Phase | S, T, SDG (S†), TDG (T†), P(θ) |
| Root | SX (√X), SXdg (√X†) — Heron native |
| Rotation | RX(θ), RY(θ), RZ(θ) |
| Universal | U(θ, φ, λ) |
| 2-Qubit | CX, CY, CZ, SWAP, RXX(θ), RZZ(θ) |
| Multi | CCX (Toffoli), RCCX, RC3X |
| Other | I (Identity), Measure |
Compiler & IR
- DAG-based intermediate representation — directed acyclic graph for circuit analysis
- 6-pass compiler — gate cancellation, merging, basis translation, routing
- Topology-aware routing — SWAP insertion for linear, ring, and grid topologies
- QASM 3.0 — export for IBM and cross-SDK interop
Circuit Visualization
- ASCII —
draw(circuit)→ terminal-friendly text diagrams - SVG/HTML —
to_html(circuit)→ publication-quality visual diagrams- Color-coded gates by category
- Control dots, target circles, measurement meters
- Responsive layout with legend
Noise Simulation
7 channels integrated into run():
result = run(circ, noise=NoiseModel().add(Depolarizing(0.01)))
Depolarizing · BitFlip · PhaseFlip · AmplitudeDamping · T2Relaxation · Crosstalk · ReadoutError
Error Correction
- Bit-flip [[3,1,3]], Phase-flip [[3,1,3]], Steane [[7,1,3]] codes
- Surface code [[d²,1,d]] — stabilizer-based, threshold ~1%
- Color code — triangular lattice, transversal Clifford gates
- Decoders — MWPM (greedy) + Union-Find (near-linear O(n·α(n)))
Algorithms
| Algorithm | Module | Use Case |
|---|---|---|
| Grover | layer3.search |
Unstructured search (√N speedup) |
| QAOA | layer3.optimize |
Combinatorial optimization |
| VQE | layer3.vqe |
Molecular ground-state energy |
| Shor | layer3.shor |
Integer factoring (RSA) |
| QSVM | layer3.qsvm |
Quantum kernel classification |
| Monte Carlo | layer3.monte_carlo |
Amplitude estimation + pricing |
| Clustering | layer3.clustering |
Swap-test quantum distances |
| QML Classifier | layer3.qml |
Variational quantum classification |
| Entity Resolution | layer3.entity_resolution |
Customer deduplication |
| Portfolio | layer3.finance |
Financial optimization |
Qubit Limits
| Simulator | Max Qubits | Memory | Speed |
|---|---|---|---|
| Statevector | 27 | ~2 GB | Full state simulation |
| Density Matrix | 13 | ~1 GB | Mixed states + noise |
| Pauli Frame | 1,000+ | O(n²) | Clifford-only circuits |
| IBM Heron | 156 | Cloud | Real quantum hardware |
| IonQ Forte | 36 | Cloud | Trapped-ion QPU |
| Google Sycamore | 72 | Cloud | Superconducting QPU |
Note: Statevector memory doubles per qubit (2^n). 20 qubits = 8 MB, 25 = 256 MB, 27 = 1 GB.
Examples & Use Cases
Run any example with python -m quanta.examples.<name>:
01 Bell State
EPR pair — the simplest entanglement demonstration.
python -m quanta.examples.01_bell_state
02 GHZ State
Multi-qubit entanglement: all-or-nothing correlations.
python -m quanta.examples.02_ghz_state
03 Quantum Teleportation
Transfer an unknown quantum state using entanglement + classical bits.
python -m quanta.examples.03_teleportation
04 Deutsch-Jozsa
Determine if a function is constant or balanced in one query.
python -m quanta.examples.04_deutsch_jozsa
05 Grover Search
Quadratic speedup for unstructured search — finds target with 99.9% probability.
python -m quanta.examples.05_grover
06 Molecular Energy
H₂ and HeH⁺ ground state via VQE + Hamiltonian time evolution.
python -m quanta.examples.06_molecule_energy
07 Portfolio Optimization
Quantum-optimized stock portfolios — tech vs crypto, conservative vs aggressive.
python -m quanta.examples.07_portfolio_optimization
08 QKD BB84
Quantum key distribution — detect eavesdroppers via ~25% error rate.
python -m quanta.examples.08_qkd_bb84
09 Full Demo
All SDK features in one script — circuits, custom gates, VQE, Grover, noise, routing, QASM.
python -m quanta.examples.09_full_demo
10 Quantum Benchmark
8-test quality litmus test — Bell fidelity, CHSH, teleportation, Grover, VQE, Shor, QSVM, surface code.
python -m quanta.examples.10_quantum_benchmark
11 Entity Resolution
Real-world use case: OTA customer deduplication with QAOA vs classical greedy.
25 records, 8 columns, Turkish name handling, 3-layer blocking pipeline.
Result: QAOA 86% accuracy vs Greedy 64%.
python -m quanta.examples.11_entity_resolution
Quality Benchmark
Turnusol Test — 8/8 🏆
| # | Test | Result | Metric |
|---|---|---|---|
| 1 | Bell State Fidelity | ✅ | F = 1.0000 |
| 2 | CHSH Inequality | ✅ | S = 2.8284 (Tsirelson bound) |
| 3 | Quantum Teleportation | ✅ | Unitarity preserved |
| 4 | Grover Amplification | ✅ | 99.9% target probability |
| 5 | VQE Convergence (H₂) | ✅ | 0.000054 Ha error |
| 6 | Shor Factoring | ✅ | 15 = 3 × 5 |
| 7 | QSVM Classification | ✅ | 100% accuracy |
| 8 | Surface Code QEC | ✅ | 0% logical error rate |
IBM Hardware Validation
Bell state on ibm_torino (156 qubits, Heron r3):
4096 shots: |00⟩=47.5%, |11⟩=39.5%, entanglement fidelity=87%
QASMBench — 10/10
All standard QASMBench circuits import, compile, and simulate correctly.
Installation
# From PyPI (recommended)
pip install quanta-sdk
# From source (development)
git clone https://github.com/ONMARTECH/quanta-sdk.git
cd quanta-sdk
pip install -e ".[dev]"
# Run tests
pytest
# Run benchmark
python -m quanta.examples.10_quantum_benchmark
Optional IBM Quantum:
export IBM_API_KEY="your-api-key"
export IBM_INSTANCE_CRN="your-crn"
Optional GPU acceleration:
pip install jax jaxlib # JAX GPU backend
pip install cupy # NVIDIA CUDA backend
Documentation
📚 Live Documentation: onmartech.github.io/quanta-sdk
| Document | Description |
|---|---|
| 📖 Tutorials (14) | Step-by-step guides from basics to advanced |
| 📘 API Reference | Full API docs with live examples |
| Architecture (EN) | System design, DAG IR, compiler pipeline |
| Architecture (TR) | Türkçe mimari dokümanı |
| Features (EN) | Complete feature list |
| Comparison (EN) | vs Qiskit, Cirq, Braket |
| CHANGELOG | Version history |
Project Stats
Version: 0.9.2 Gates: 31 (full IBM parity + Google/IonQ)
Files: 84 Tests: 820 (91% coverage)
Algorithms: 10 Examples: 11
Simulators: 6 QEC Codes: 7
MCP Tools: 20 Max Qubits: 200+ (MPS) / 156 (IBM Heron r3)
Noise: 7 channels Backends: IBM + IonQ + Google + local
QASM: 3.0 Decoders: 2 (MWPM + UF)
Tutorials: 14 Notebooks: 14 (Colab)
Benchmark: Bell 0.18ms Docs Pages: 44
Author
Abdullah Enes SARI — ONMARTECH
Contributing
Contributions, issues, and feature requests are welcome!
Feel free to check issues page.
License
Built for the quantum computing community — now running on real IBM quantum hardware
Keywords: quantum computing, quantum SDK, python quantum, MCP server, AI quantum, VQE, QAOA, QML, quantum error correction, surface code, IBM Quantum, Shor algorithm, Bell inequality, quantum machine learning, quantum simulation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quanta_sdk-0.9.2.tar.gz.
File metadata
- Download URL: quanta_sdk-0.9.2.tar.gz
- Upload date:
- Size: 321.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
116acc2cf982a19179d355b72eaa2973693d110dfad2536421c1bff3cb85208d
|
|
| MD5 |
3f213b5a3122f497aa3fa906710e6eaa
|
|
| BLAKE2b-256 |
4aec178d02e1e65599e3adc6ee6c307377fbc93d685fba83ace1281273e7523d
|
File details
Details for the file quanta_sdk-0.9.2-py3-none-any.whl.
File metadata
- Download URL: quanta_sdk-0.9.2-py3-none-any.whl
- Upload date:
- Size: 213.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7ec6e446e5a9a72e3c1b32dbe721d7a33c41eccfee568dfa8f94a468a11df81
|
|
| MD5 |
b64c9531f9924df04c689faf6c2c6a05
|
|
| BLAKE2b-256 |
a423ca594b2b93add5c22627bb1d843fafb480a323a2a9606b78a3c309a25336
|