Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

βš›οΈ Quantum Lab Agent System

A complete multi-agent workspace for IBM Quantum

Python 3.11+ IBM Granite A2A IBM Quantum

Generate quantum code, inspect live IBM Quantum backends, execute circuits on real hardware, and retrieve job results through one coordinated interface.

Quick start Β· Architecture Β· Try it Β· Repositories


Overview

This repository contains the complete multi-agent system. The Quantum Lab Agent is the main entry point: it coordinates the Developer, Status, Computing, and development-stage Experiment agents through the Agent-to-Agent protocol.

Local inference uses IBM Granite 4.2 8B through Ollama by default.

Important

Full functionality requires all five agents to be running. Start the four specialized agents before the Lab Agent, or simply use ./start_all.sh.

Agent Responsibility Port Public repository
🎯 Quantum Lab Agent Main orchestrator coordinating all agents 8000 quantum_lab_agent
πŸ’» Quantum Developer Agent Code generation specialist 8001 quantum-developer-agent
πŸ“Š Quantum Status Agent Status monitoring specialist 8002 quantum-status-agent
⚑ Quantum Computing Agent Circuit execution specialist 8003 quantum-computing-agent
πŸ§ͺ Quantum Experiment Agent (Development) Hybrid experiment and optimization specialist 8004 quantum-experiment-agent

🎬 Demo

Quantum Lab Agent generating and executing a Grover circuit in Agent Stack

Grover circuit generation, coordinated execution, measurement results, and circuit visualization in Agent Stack Canvas.

QAOA experiment on real IBM Quantum hardware

QAOA Max-Cut experiment optimized locally, submitted to real IBM Quantum hardware, and visualized in Agent Stack

End-to-end QAOA Max-Cut: exact classical validation, experiment Canvas, execution on ibm_marrakesh, tagged Job ID, and live results from 1,024 shots.

Run the QAOA Max-Cut experiment on a 5-node graph and execute the optimized circuit once on the least busy real IBM Quantum backend with 1024 shots. Always create a new job and return the backend name and Job ID.

πŸ—οΈ Architecture

flowchart TB
    USER([User]) <-->|Request / response| LAB["Quantum Lab Agent<br/>:8000<br/><small>BeeAI orchestration Β· IBM Granite 4.2</small>"]

    LAB -->|A2A| DEV["Quantum Developer Agent<br/>:8001<br/><small>QASM and Qiskit code</small>"]
    LAB -->|A2A| STATUS["Quantum Status Agent<br/>:8002<br/><small>Backends and jobs</small>"]
    LAB -->|A2A| COMPUTE["Quantum Computing Agent<br/>:8003<br/><small>Fresh quantum jobs</small>"]
    LAB -->|A2A| EXPERIMENT["Quantum Experiment Agent<br/>:8004 Β· Development<br/><small>QAOA and VQE studies</small>"]

    EXPERIMENT -.->|Delegates real execution| COMPUTE
    STATUS -->|Qiskit| IBMQ["IBM Quantum Platform<br/><small>Live backends and real QPUs</small>"]
    COMPUTE -->|Qiskit| IBMQ

    classDef user fill:#f4f4f4,stroke:#525252,color:#161616,stroke-width:1px;
    classDef orchestrator fill:#31135e,stroke:#6929c4,color:#ffffff,stroke-width:2px;
    classDef agent fill:#f7f5ff,stroke:#8a3ffc,color:#161616,stroke-width:1.5px;
    classDef development fill:#fff7e6,stroke:#f1c21b,color:#161616,stroke-width:1.5px,stroke-dasharray:5 4;
    classDef platform fill:#001d6c,stroke:#0f62fe,color:#ffffff,stroke-width:2px;

    class USER user;
    class LAB orchestrator;
    class DEV,STATUS,COMPUTE agent;
    class EXPERIMENT development;
    class IBMQ platform;
Loading

The Lab Agent combines the specialized responses into a single answer containing the generated circuit, selected backend, IBM Quantum Job ID, status, or measurement results.

✨ Capabilities

Capability What it provides
🎯 Intelligent routing Selects the correct specialized agent for each prompt
πŸ’» Code generation Produces OpenQASM, Qiskit code, and common quantum algorithms
⚑ Real execution Submits circuits to accessible IBM Quantum hardware
πŸ“Š Live monitoring Retrieves backend availability, queues, job state, and results
πŸ—ΊοΈ Backend Canvas Shows a live topology and health dashboard for specific ibm_* backend queries
πŸ“ˆ Execution Canvas Presents fresh job results, readable multi-row circuits, QASM, and local query timestamps
πŸ”„ Multi-agent workflows Chains generation β†’ execution β†’ result inspection
πŸ§ͺ Hybrid experiments Runs QAOA Max-Cut optimization, exact validation, Canvas analysis, and optional QPU evaluation (development)
🧠 Local inference Runs IBM Granite 4.2 8B through Ollama

πŸš€ Quick start

Requirements

1. Clone and install

git clone https://github.com/BrUn3y/quantum_lab_agent.git
cd quantum_lab_agent
uv sync
ollama pull granite4.2:8b

2. Configure credentials

cp .env.example .env

Add your IBM Quantum token to .env. The default model configuration is:

QISKIT_IBM_TOKEN=your_ibm_quantum_token
OLLAMA_API_BASE=http://127.0.0.1:11434

LAB_MODEL=ollama:granite4.2:8b
DEVELOPER_MODEL=ollama:granite4.2:8b
STATUS_MODEL=ollama:granite4.2:8b
COMPUTING_MODEL=ollama:granite4.2:8b

Watsonx remains available as an optional fallback through the WATSONX_* variables documented in .env.example.

3. Start the complete system

./start_all.sh

Or start each service in a separate terminal:

./start_developer.sh  # Port 8001
./start_status.sh     # Port 8002
./start_computing.sh  # Port 8003
./start_experiment.sh # Port 8004 β€” development
./start_lab.sh        # Port 8000 β€” start last

View agent logs

The start scripts write separate logs to .logs/. Follow every agent in one terminal:

./view_logs.sh

Select one agent or print a snapshot without following new output:

./view_logs.sh lab
./view_logs.sh computing -n 200
./view_logs.sh all --no-follow

4. Verify every agent

for port in 8000 8001 8002 8003 8004; do
  curl -fsS "http://127.0.0.1:${port}/.well-known/agent-card.json" \
    | jq -r '.name'
done

πŸ’¬ Try it

All requests enter through the Lab Agent's A2A JSON-RPC endpoint:

curl -X POST http://127.0.0.1:8000/jsonrpc/ \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "quantum-demo",
    "method": "message/send",
    "params": {
      "message": {
        "kind": "message",
        "messageId": "11111111-1111-4111-8111-111111111111",
        "role": "user",
        "parts": [{
          "kind": "text",
          "text": "Create a Bell state and execute it once on the least busy real IBM Quantum backend."
        }]
      }
    }
  }'

Suggested prompts

Goal Prompt
Bell state end-to-end Create a Bell state, execute it on the local simulator with 1024 shots, and explain the results
Grover search Create Grover's algorithm for 3 qubits and run it on the local simulator
Real QPU execution Create a Bell state and execute it once on the least busy real IBM Quantum backend
List available QPUs What quantum computers are available?
Inspect a backend Give me detailed information about ibm_fez
Deutsch–Jozsa Create and execute a Deutsch-Jozsa circuit for a balanced oracle
QAOA Max-Cut (development) Use QAOA to solve Max-Cut on a 5-node graph using the local simulator
Explain a concept Explain what quantum entanglement is
Check a job Show me the status and results of job <job-id>

Backend availability depends on the IBM Quantum account. The agent queries the live service and chooses among the backends actually accessible to the configured account.

πŸ§ͺ End-to-end tests

Run the live suite to verify all five services, execute Bell, CX, Grover, and Deutsch–Jozsa circuits through the Lab β†’ Developer β†’ Computing flow, and validate a QAOA Max-Cut experiment through the Experiment Agent:

./test_e2e.sh

The suite uses the agents already running on ports 8000–8004. If none are running, it starts all five with granite4.2:8b, waits for their agent cards, runs every circuit and experiment on local simulators, and stops only the processes it started. Logs from an automatic startup are written to .logs/e2e/.

Useful options:

./test_e2e.sh --no-start        # Require an existing five-agent system
./test_e2e.sh --shots 256       # Change the number of simulator shots
./test_e2e.sh --timeout 300     # Allow slower local environments

Custom --lab-port, --developer-port, --status-port, --computing-port, and --experiment-port options are available for isolated or parallel test environments.

βš™οΈ Configuration

Variable Default Purpose
OLLAMA_API_BASE http://127.0.0.1:11434 Ollama endpoint
LAB_MODEL ollama:granite4.2:8b Lab orchestrator model
DEVELOPER_MODEL ollama:granite4.2:8b Code generation model
STATUS_MODEL ollama:granite4.2:8b Status model
COMPUTING_MODEL ollama:granite4.2:8b Execution model
LAB_PORT 8000 Lab Agent port
DEVELOPER_PORT 8001 Developer Agent port
STATUS_PORT 8002 Status Agent port
COMPUTING_PORT 8003 Computing Agent port
EXPERIMENT_PORT 8004 Experiment Agent port (development)

πŸ” How requests are handled

Request Agents involved
β€œGenerate a teleportation circuit” Developer
β€œCreate a Bell state and run it” Developer β†’ Computing
β€œWhich backends are available?” Status
β€œCheck job … and show its results” Status
β€œCreate, execute, and inspect the result” Developer β†’ Computing β†’ Status
β€œUse QAOA to solve a 5-node Max-Cut problem” Experiment β†’ Computing (when QPU execution is requested)

🐳 Docker

The included image runs the Lab Agent. Start the four specialized agents on the host, then build and run the orchestrator:

docker build -t quantum-lab-agent .
docker run --env-file .env -p 8000:8000 quantum-lab-agent

The Developer, Status, Computing, and Experiment agents must remain reachable through the host and port values configured in .env. For an all-local setup, ./start_all.sh is the recommended option.

🧰 Troubleshooting

Problem Check
A workflow is incomplete Confirm that all five agent cards respond
Ollama cannot be reached Run ollama list and confirm granite4.2:8b is installed
IBM Quantum authentication fails Verify QISKIT_IBM_TOKEN in .env
A port is already occupied Run lsof -nP -iTCP:<port> -sTCP:LISTEN
A named backend is unavailable List the live backends and use one accessible to the account

πŸ“ Project structure

quantum_lab_agent/
β”œβ”€β”€ docs/images/quantum-lab-demo.gif
β”œβ”€β”€ docs/images/quantum-experiment-real-hardware.gif
β”œβ”€β”€ src/beeai_agents/
β”‚   β”œβ”€β”€ quantum_lab_agent.py
β”‚   β”œβ”€β”€ quantum_developer_agent.py
β”‚   β”œβ”€β”€ quantum_status_agent.py
β”‚   β”œβ”€β”€ quantum_computing_agent.py
β”‚   β”œβ”€β”€ quantum_experiment_agent.py
β”‚   └── tools/
β”œβ”€β”€ .env.example
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ start_all.sh
β”œβ”€β”€ start_lab.sh
β”œβ”€β”€ start_developer.sh
β”œβ”€β”€ start_status.sh
β”œβ”€β”€ start_computing.sh
β”œβ”€β”€ start_experiment.sh
β”œβ”€β”€ view_logs.sh
└── pyproject.toml

πŸ”— Public agent repositories

Repository Role
Quantum Computing Agent Circuit execution specialist
Quantum Status Agent Status monitoring and job tracking
Quantum Developer Agent Code generation and algorithm implementation
Quantum Lab Agent Main orchestrator coordinating all agents
Quantum Experiment Agent Hybrid optimization and experiment analysis (in development)

Contributing

Issues and pull requests are welcome. When changing a workflow, validate all five agent endpoints and include an end-to-end prompt test.


About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages