数据分析

Quantum Agent Engineering

试用

一键搭建并部署基于 Quantinuum 的量子 Web 应用:Guppy 电路 + Selene 后端 + Fly.io 托管。

它能做什么

该技能提供一套量子应用的完整脚手架:Guppy 电路在 Selene FastAPI 服务中执行,服务部署到 Fly.io,再由 Lovable 的 React/TS 前端对接。自带 CLI 脚本(create_quantum_app.py、setup_selene_service.py、flyio_deploy.py、lovable_integrate.py)、Guppy / Selene / Fly.io 参考文档,以及前后端模板。预置的工作负载类型包括:化学(VQE 风格的能量与性质计算)、优化(QAOA)、量子机器学习(QNN/QSVM)、量子随机数、量子安全加密。临床相关说明强调:演示阶段只能使用合成或去标识化数据,API 密钥必须通过 fly secrets set 存入 Fly.io secrets,生产环境需补齐鉴权、限流以及 HIPAA/DPA 等合规措施。原本面向 OpenClaw Clinical Hackathon,同样适用于一般量子 Web 应用。

什么时候用它

  • 脚手架 Selene FastAPI 后端并部署到 Fly.io
  • 把 Guppy 电路接到 Selene 暴露的 REST 接口
  • 为临床或黑客松场景搭建量子 Demo 并对接 React 前端
  • 把化学、优化、机器学习、随机数、加密等工作负载映射到量子代码

技能文档

QuantinuumClaw – Quantum Guppy/Selene Stack

This skill provides everything needed to build production-ready quantum applications using Quantinuum (hardware/emulator), Guppy (quantum language), Selene (FastAPI backend), and Fly.io (deployment), with optional Lovable frontend. It is tuned for the OpenClaw Clinical Hackathon and general quantum web apps.

When to Use This Skill

Use when:

  • Building for the OpenClaw Clinical Hackathon or any clinical/healthcare quantum project
  • Building web applications that use quantum computing (optimization, chemistry, ML, random, crypto)
  • Deploying quantum algorithms as REST APIs or creating dashboards for quantum results
  • User mentions: clinical, healthcare, drug discovery, treatment optimization, patient stratification, molecular simulation, clinical trials, Guppy, Selene, Fly.io

Example requests: "Build a quantum portfolio optimizer with a web interface" · "Deploy my Guppy algorithm to the cloud" · "Create a clinical molecular simulation demo" · "Set up a quantum ML service on Fly.io"

Stack at a Glance

ComponentRole
QuantinuumQuantum hardware (H-series) or emulator
GuppyQuantum programming (circuits, gates, measurement)
SeleneFastAPI backend that runs Guppy and exposes REST API
Fly.ioHosts the Selene backend in the cloud
LovableReact/TS frontend template; use assets/lovable-template/ or any app that calls the Selene API

Quick Start (One Command)

From the repo root:

python3 scripts/create_quantum_app.py \
  --app-name "clinical-demo" \
  --use-case "chemistry" \
  --description "Clinical molecular simulation" \
  --deploy

Then set VITE_API_URL in the frontend to your Fly.io app URL (e.g. https://clinical-demo.fly.dev).

Clinical use-case → --use-case mapping:

Clinical idea--use-caseNotes
Drug discovery / molecular simchemistryMolecules, energy, properties
Treatment / resource optimizationoptimizationQAOA-style optimization
Patient stratification / MLmlQuantum ML models
Trial randomizationrandomQuantum RNG
Secure keys / protocolscryptoQuantum-safe crypto

General use cases (portfolio, finance, etc.) also use optimization, chemistry, ml, random, crypto, or finance. See references/clinical-use-cases.md for detailed clinical mappings.

Full Workflow: Creating a Quantum Application

Step 1: Define the use case

Identify the problem (optimization, simulation, ML, cryptography, clinical, etc.).

Step 2: Create Selene backend

python3 scripts/setup_selene_service.py \
  --app-name "my-quantum-app" \
  --use-case "chemistry" \
  --description "Quantum chemistry simulator"

This creates a backend dir with FastAPI, health check, Dockerfile, and fly.toml.

Step 3: Implement your Guppy circuit

Edit my-quantum-app/main.pyQuantumService._run_real_quantum(). Use references/guppy_guide.md for syntax. For clinical: chemistry (molecule, shots, precision), optimization (objective, constraints), ML (features, epochs).

Step 4: Deploy to Fly.io

python3 scripts/flyio_deploy.py --app-name "my-quantum-app" --service-dir "my-quantum-app" --region "lhr"

Set secrets with fly secrets set; use emulator for demos if preferred.

Step 5: Frontend

Use assets/lovable-template/ or run:

python3 scripts/lovable_integrate.py \
  --app-name "my-frontend" \
  --backend-url "https://my-quantum-app.fly.dev" \
  --quantum-use-case "chemistry"

Then npm install and npm run dev in the frontend dir.

Step 6: Connect and test

Point frontend VITE_API_URL to the Fly.io backend; hit /health to verify.

Clinical Use Case Cheat Sheet

  • Drug discovery / molecular simulation: chemistry — VQE-style energy/property in Guppy; expose molecule type and params via API.
  • Treatment / resource optimization: optimization — Define objective (cost, wait time); run QAOA in Selene; display results in UI.
  • Patient stratification / classification: ml — Map patient features to model inputs; return risk/stratum or classification.
  • Randomization (e.g. trials): random — Quantum RNG from Guppy; expose bits/shots in API.
  • Security / key material: crypto — Key generation or quantum-safe primitives; keep keys on backend only.

Data and Compliance (Clinical / Hackathon)

  • Demos: Use synthetic or de-identified data only. Do not send real PHI to quantum backends or store in Fly.io without a compliance plan.
  • API keys: Store in Fly.io secrets (fly secrets set), never in code or frontend.
  • Production: Add auth, rate limiting, and consider HIPAA/DPA; restrict CORS in Selene.

Resources

scripts/

  • create_quantum_app.py — All-in-one: backend + deploy + frontend
  • setup_selene_service.py — Scaffold Selene backend
  • flyio_deploy.py — Deploy to Fly.io
  • lovable_integrate.py — Frontend wired to backend URL

references/

  • guppy_guide.md — Guppy syntax, gates, circuits, examples
  • selene_api.md — Endpoints, request/response, errors, jobs
  • flyio_config.md — Fly.io scaling, regions, secrets, monitoring
  • lovable_patterns.md — Frontend patterns, dashboard, API client
  • clinical-use-cases.md — Detailed clinical use-case mappings and compliance notes

assets/

  • selene-template/ — Backend boilerplate (main.py, Dockerfile, fly.toml, .env.example)
  • lovable-template/ — React/TS frontend with QuantumDashboard and API client

Advanced: Multi-Quantum Use Cases

  • Optimization dashboard: Selene + QAOA/VQE; Lovable with sliders; Fly.io with scaling.
  • Chemistry explorer: Guppy molecular simulations; 3D viewer; optional persistent storage.
  • Quantum ML API: Selene exposing QNN/QSVM; Lovable for training/predictions; Fly.io (GPU if needed).

Performance, Cost, and Security

  • Queuing: Use job queues for long-running quantum jobs; WebSockets or polling in frontend.
  • Caching: Cache identical computations to reduce quantum hardware cost.
  • Fly.io: Scale to zero when idle (min_machines_running = 0); use references/flyio_config.md for VM sizing.
  • Security: No API keys in frontend; rate limiting on Selene; HTTPS in production; see references/selene_api.md for auth patterns.

Troubleshooting

  • Guppy import error: pip install guppy in backend; or use mock mode for demos.
  • Selene not starting: Check fly.toml, fly logs, and env vars.
  • Frontend can’t connect: Verify VITE_API_URL, CORS in Selene, and curl .../health.
  • Fly.io deploy fails: fly deploy --clean; fly logs --phase build; ensure fly auth login.
  • Quantum results wrong: Validate circuit logic and measurement; test with emulator first.

Next Steps

After initial setup: monitor quantum usage/costs; add auth to Selene if public; improve error handling and logging; consider persistence for job history.


For detailed clinical use-case specs and compliance reminders, see references/clinical-use-cases.md.

常见问题

包含部署能力吗?
包含。flyio_deploy.py 把 Selene 后端部署到 Fly.io 并配置区域、密钥与扩缩容;lovable_integrate.py 通过 VITE_API_URL 把 Lovable React 前端连到后端 URL。
覆盖哪些量子工作负载?
参考文档讲解 Guppy 的电路、门和测量语法。技能列出示例负载:VQE 风格化学计算、QAOA 优化、QNN/QSVM 量子机器学习、量子随机数,以及量子安全加密原语。
可以直接用于真实临床数据吗?
不能直接用。技能要求演示阶段只使用合成或去标识化数据,API 密钥必须放入 Fly.io secrets 而非写进代码或前端;进入生产前需补齐鉴权、限流,并评估 HIPAA/DPA 等合规要求。

相关技能

Quantum Circuit Builder with Proof: Use this product when a quantum circuit needs verifiable evidence, not just. Use when an agent needs quantum circuit builder with proof, formally verified quantum circuit design, proof carrying quantum circuit certificates (qpcert), independent verification of a quantum proof certificate from another party, audit ready quantum computing artifacts for research and compliance, certify circuit, circuit, claims through AgentPMT-hosted remote tool calls.

1 次安装

Real-time quantum measurement control based on MCP (Model Context Protocol) for executing experimental tasks including: (1) S21 spectroscopy scans, (2) Rabi...

Unified quantum calibration analysis package. Aggregates curve fitting and parameter extraction (qubitclient-scope), neural network spectrum analysis (qubitc...

Quantum Cryptographic Seed Generator: Generate cryptographic seeds, UUIDs, tokens, passwords, and prime numbers using quantum-derived randomness with verific...

5 次安装

Quantum experiment NUMERICAL curve fitting and parameter extraction. Support for (1) S21 peak detection (single/multi), (2) Optimal π-pulse calibration, (3)...

Quantum Distribution Generator: Sample from probability distributions (exponential, Poisson, binomial, beta, gamma) with Monte Carlo and. Use when an agent n...

5 次安装