Skip to content

jammievae/Qbit

Repository files navigation

Qbit Banner

Qbit Banner

Version Rust Python Go License Status

Qbit AI Agent Platform

A production-grade, multi-language AI agent platform built with Rust, Python, and Go. Qbit implements the latest 2025–2026 AI agent research, featuring a 5-layer multi-store memory architecture, autonomous self-learning flywheel, speculative execution, multi-agent swarm orchestration, and open-ended self-improvement driven by a Darwin GΓΆdel Machine (DGM) engine.

πŸ“– Table of Contents

  1. Architecture & System Flow
  2. Key Core Features
  3. Deep-Dive Subsystem Reference
    • 5-Layer Hierarchical Memory Architecture
    • Autonomous Flywheel Self-Learning & Local Backends
    • Darwin GΓΆdel Machine (DGM) Self-Improvement Details
  4. Quick Start Guide
  5. Unified API Reference (REST)
  6. gRPC Service Architecture Matrix
  7. Framework Comparison & Production Scaling
  8. Technologies Used
  9. Troubleshooting & Verification
  10. Development & Contributing
  11. License

πŸ—οΈ Architecture & System Flow

Qbit leverages a split-responsibility 3-service microservice layout optimized for high throughput, predictable memory safety, and top-tier LLM execution reliability. The platform consists of a Go Gateway, a Python Agent, and a Rust Core, communicating primarily via gRPC.

                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                              β”‚       External Clients        β”‚
                              β”‚    (REST / WebSocket / SSE)   β”‚
                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                             β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚              Go Gateway (:8080 / :9090)               β”‚
                 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
                 β”‚  β”‚ REST API β”‚ β”‚   SSE    β”‚ β”‚WebSocket β”‚ β”‚  gRPC   β”‚β”‚
                 β”‚  β”‚  (Gin)   β”‚ β”‚ Streamingβ”‚ β”‚ Progress β”‚ β”‚ Server  β”‚β”‚
                 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
                 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
                 β”‚  β”‚   Task   β”‚ β”‚  Circuit  β”‚ β”‚   Auth   β”‚ β”‚  Rate   β”‚β”‚
                 β”‚  β”‚  Queue   β”‚ β”‚ Breaker  β”‚ β”‚  CORS    β”‚ β”‚ Limiter β”‚β”‚
                 β”‚  β”‚ (Redis)  β”‚ β”‚Resilienceβ”‚ β”‚Middlewareβ”‚ β”‚         β”‚β”‚
                 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
                 β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
                 β”‚  β”‚   DGM    β”‚ β”‚   MCP    β”‚ β”‚ Learning β”‚ β”‚  Agent  β”‚β”‚
                 β”‚  β”‚ Handlers β”‚ β”‚  Client  β”‚ β”‚ Handlers β”‚ β”‚ Client  β”‚β”‚
                 β”‚  β”‚ (21 eps) β”‚ β”‚(to Py)   β”‚ β”‚ (23 eps) β”‚ β”‚(to Py)  β”‚β”‚
                 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
                 β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ gRPC                         β”‚ gRPC
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚     Rust Core (:50051)    β”‚  β”‚   Python Agent (:50052)        β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
      β”‚  β”‚   Vector Store     β”‚   β”‚  β”‚  β”‚   ReAct Agent Loop       β”‚  β”‚
      β”‚  β”‚   (HNSW Search)    β”‚   β”‚  β”‚  β”‚   + Self-Reflection      β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚   Memory Engine    β”‚   β”‚  β”‚  β”‚   Hierarchical Planner   β”‚  β”‚
      β”‚  β”‚  (5-Layer Store)   β”‚   β”‚  β”‚  β”‚   + Adaptive Replanning  β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚   Memory Bridge    β”‚   β”‚  β”‚  β”‚   MCTS / ToolTree        β”‚  β”‚
      β”‚  β”‚ (Cross-Store Coord)β”‚   β”‚  β”‚  β”‚   Planning               β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚   State Machine    β”‚   β”‚  β”‚  β”‚   LLM Client             β”‚  β”‚
      β”‚  β”‚  (Agent FSM)       β”‚   β”‚  β”‚  β”‚   (OpenAI Compatible)    β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚   Knowledge Graph  β”‚   β”‚  β”‚  β”‚   Tool Registry (MCP)    β”‚  β”‚
      β”‚  β”‚   (GraphRAG)       β”‚   β”‚  β”‚  β”‚   + Dynamic Tool Maker   β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚   A2A Engine       β”‚   β”‚  β”‚  β”‚   Self-Learning Engine   β”‚  β”‚
      │  │ (Google Protocol)  │   │  │  │   (Flywheel: E→C→D→I)   │  │
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚  Observability     β”‚   β”‚  β”‚  β”‚   Guardrails + HITL      β”‚  β”‚
      β”‚  β”‚  (OpenTelemetry)   β”‚   β”‚  β”‚  β”‚   (Safety Framework)     β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚  Speculative Exec  β”‚   β”‚  β”‚  β”‚   Swarm Orchestrator     β”‚  β”‚
      β”‚  β”‚  (ICLR 2026)       β”‚   β”‚  β”‚  β”‚   (Multi-Agent)          β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚  Learning Engine   β”‚   β”‚  β”‚  β”‚   RAG Pipeline           β”‚  β”‚
      β”‚  β”‚ (Training/Curric.) β”‚   β”‚  β”‚  β”‚   (Retrieval-Augmented)  β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚  Agent Archive     β”‚   β”‚  β”‚  β”‚   Self-Modify Engine     β”‚  β”‚
      β”‚  β”‚  (DGM Archive)     β”‚   β”‚  β”‚  β”‚   (DGM Improvement)      β”‚  β”‚
      β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β”‚  β”‚   MCP Engine       β”‚   β”‚  β”‚  β”‚   Tool Evolution         β”‚  β”‚
      β”‚  β”‚  (MCP Registry)    β”‚   β”‚  β”‚  β”‚   (DGM Variants)         β”‚  β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚   Multi-Candidate Exec  β”‚  β”‚
              β”‚          β”‚           β”‚  β”‚   (DGM Selection)        β”‚  β”‚
              β”‚          β”‚           β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
              β”‚          β”‚           β”‚  β”‚   Self-Mod Safety        β”‚  β”‚
              β”‚          β”‚           β”‚  β”‚   (8 Principles)         β”‚  β”‚
              β”‚          β”‚           β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
              β”‚          β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                    Data Layer                          β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
      β”‚  β”‚  Redis   β”‚  β”‚  Qdrant   β”‚  β”‚  PostgreSQL 16    β”‚  β”‚
      β”‚  β”‚ (:6379)  β”‚  β”‚ (:6333)   β”‚  β”‚  + pgvector       β”‚  β”‚
      β”‚  β”‚ L2 Cache β”‚  β”‚ L3 Vectorsβ”‚  β”‚  L4/L5 Structured β”‚  β”‚
      β”‚  β”‚ + Queue  β”‚  β”‚  + ANN    β”‚  β”‚  + Archive        β”‚  β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ›°οΈ Functional Data Flow Loops

Task Processing Path

Client ──[HTTP POST]──→ Go Gateway (:8080) ──[gRPC Proxy]──→ Python Agent (:50052)
                                                                 β”‚
                                                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                                   β–Ό                           β–Ό
                                             [ReAct Loop]             [Memory Validation]
                                        Think β†’ Act β†’ Observe                  β”‚
                                                   β”‚                   [gRPC Raw Forward]
                                                   β–Ό                           β–Ό
                                           [Tool Invocations]          Rust Core Core (:50051)
                                         (MCP / Native Sandbox)        (DashMap/Redis/Qdrant)

DGM Self-Improvement Loop

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Evaluate Trajectories ──→ 2. Propose Sandboxed Diff ──→ 3. Empirical Benchmark β”‚
β”‚                                                                        β”‚         β”‚
β”‚ 5. Active Profile Deployment ←── 4. Verify Against 8 Constitutional Safeties  β†β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🌟 Key Core Features

  • 5-Layer Multi-Store Memory: A sophisticated hierarchical memory system that provides seamless tiering from Lock-free DashMap (L1) for immediate state, through Redis (L2) for hot state, Qdrant (L3) for vector storage, PostgreSQL (L4) for relational data, down to deep cold Archives (L5) for historical interactions. This design models human-like cognitive consolidation for efficient and scalable memory management.
  • Darwin GΓΆdel Machine (DGM): An advanced engine enabling open-ended recursive exploration, tracking stepping stones, parent lineages, and variant configurations safely. The DGM drives continuous self-improvement and evolution of the AI agent.
  • Speculative Agent Execution: Implements concurrent, fast predictive path speculative steps paired with authoritative validators to prevent drift and enhance execution efficiency.
  • Model Context Protocol (MCP): Provides native server-and-client routing for external model-context tool registries, facilitating dynamic tool integration and management.
  • Complete Self-Learning Flywheel: An end-to-end learning mechanism encompassing execution, RLAIF (Reinforcement Learning from AI Feedback) evaluation, principle distillation, and built-in QLoRA/Adafactor workflows for continuous learning and adaptation (Execute β†’ Coach β†’ Distill β†’ Improve).
  • Production Hardenings: Designed for robustness with absolute zero placeholder structures, full circuit-breaker fail-safes, and persistent transactional event logs to ensure high reliability and fault tolerance.
  • Self-Modification Safety Guardrails: Inspired by DGM safety discussions and 2026 research, this module provides immutable component protection, constitutional rules for safe self-modification, modification validation, rollback path tracking, and tool/prompt modification safety. It enforces 8 core principles to prevent agents from disabling safety guardrails, removing human oversight, or making irreversible changes.

πŸ”¬ Deep-Dive Subsystem Reference

1. 5-Layer Hierarchical Memory Architecture

Designed to model human-like cognitive consolidation, Qbit's memory architecture ensures efficient storage and retrieval of information across different temporal and semantic contexts.

  • L1 (DashMap): Sub-microsecond local runtime cache for immediate state steps, offering the fastest access for current operational data.
  • L2 (Redis): Cluster-shared hot state manager utilizing standard 1-hour default TTL settings, providing fast access to frequently used data across the cluster.
  • L3 (Qdrant): Pure vector storage utilizing approximate high-dimensional nearest neighbor (HNSW) search, optimized for semantic search and retrieval.
  • L4 (PostgreSQL + pgvector): Highly relational transactional registry indexing procedural and system records, ensuring data integrity and complex query capabilities.
  • L5 (Postgres Cold Archive): Low-frequency compressed engine preserving historical interactions exceeding 30 days, used for long-term storage and compliance.

Memory Promotion Metrics Matrix

Source Tier Destination Tier Trigger Event / Metric Condition Processing Mechanism
L1/L2 Working L3 Episodic Age $\ge 30\text{ mins}$ AND Importance score $\ge 0.7$ Asynchronous Background Threading
L3 Episodic L4 Semantic Recurrent thematic hits across multiple distinct context rooms Cluster Consolidator Daemon
L4 Semantic L5 Archive Total lifetime record age $> 30\text{ days}$ AND Total query hits $< 3$ Batch Job Sweeper Routine

2. Autonomous Flywheel Self-Learning & Local Backends

The system loops continuously through a four-stage process: Execute (capture metrics) $\rightarrow$ Coach (8-dimension performance vector assessment) $\rightarrow$ Distill (generate rules and filter out broken anti-patterns) $\rightarrow$ Improve (run localized optimizations).

Local Backends Core Implementations

  • Pre-Training Optimization: Relies on Adafactor factoring matrices to ensure lower memory requirements during wide-net tokenization ingestion.
  • Fine-Tuning Execution: Employs QLoRA 4-bit NormalFloat (NF4) quantization targeting structural attention anchors (q_proj, v_proj) to compress learning updates without structural degradation.
  • Preference Alignment: Standard DPO (Direct Preference Optimization) sigmoid computation layer using a mirrored twin reference model architecture to ensure human alignment.

3. Darwin GΓΆdel Machine (DGM) Self-Improvement Details

Implements formal open-ended agent self-evolution through several mechanisms:

  1. Agent Archive Evolution: Utilizes a roulette-wheel parent selector based on performance-to-novelty calculation scores to guide the evolution of agent profiles.
  2. Self-Modification Engine: Creates isolated deep-copy engine profiles before execution, safely rejecting attempts to rewrite system core guardrails.
  3. Tool Evolution Engine: Runs independent variant life-cycles that dynamically deploy or roll back utilities based on empirical benchmark pass rates.
  4. Multi-Candidate Generation: Sequentially tests up to N structural execution paths, using a dynamic temperature scaling formula ($0.1 \times \text{attempt}$) to isolate edge case variations.
  5. Focus Architecture Summarization: Leverages a multi-tier fallback context system designed to balance strict chat structural rules while preserving precise raw tool telemetry data.
  6. Self-Modification Constitutional Rules: Enforces 8 core principles (e.g., preserving input validations, tracking transaction rollbacks) via strict runtime isolation, as detailed in python-agent/qbit_agent/governance/self_mod_safety.py.

πŸš€ Quick Start Guide

πŸ“‹ Prerequisites

  • Docker & Docker Compose (v2.0+)
  • OpenAI API Key (or fully compatible alternative endpoint)
  • Minimum hardware: 4 GB System RAM / 3 GB Available Disk Storage

1. Setup Environment

git clone https://github.com/jammievae/Qbit.git
cd Qbit
cp .env.example .env
# Open .env and populate your active credentials
nano .env

2. Launch Services

# Option A: Universal Launcher Script (Recommended)
./run.sh full

# Option B: Profile-Targeted Compose Instructions
docker compose --profile full up -d

# Option C: Granular Local Make Dev Management
make dev-infra # Boots data storage backends inside Docker container
make dev-rust  # Starts localized watch server for performance layers
make dev-python # Starts localized watch server for Python agent
make dev-go # Starts localized watch server for Go gateway

🌐 Unified API Reference (REST)

The Go Gateway exposes a comprehensive REST API for interacting with the Qbit platform. All endpoints are prefixed with /api/v1.

πŸ“‹ Task Lifecycle Engine

  • POST /api/v1/tasks: Enqueue task payload to Redis priority worker queue.
  • GET /api/v1/tasks/:id: Query instant status parameters and tracking payload markers.
  • GET /api/v1/tasks/:id/stream: WebSocket connection for live thinking stream.
  • GET /api/v1/tasks/:id/events: SSE (Server-Sent Events) live thinking stream channel connection.
  • POST /api/v1/tasks/:id/approve: Human-in-the-Loop review confirmation endpoint.

🧠 Multi-Store Memory & Bridge

  • POST /api/v1/memory: Store memory (any type).
  • POST /api/v1/memory/recall: Recall memories.
  • GET /api/v1/memory/stats: Get memory statistics.
  • POST /api/v1/memory/semantic: Store semantic memory (Qdrant).
  • POST /api/v1/memory/semantic/search: Search semantic memory.
  • POST /api/v1/memory/procedural: Store procedural memory (PostgreSQL).
  • POST /api/v1/memory/procedural/recall: Recall procedural memories.
  • POST /api/v1/memory/archive: Archive memories.
  • POST /api/v1/memory/bridge/temporal: Temporal query across all stores.
  • POST /api/v1/memory/bridge/cross-session: Recall related memories from previous sessions.
  • POST /api/v1/memory/bridge/threads: Create a conversation thread.
  • POST /api/v1/memory/bridge/threads/:id/add: Add to a conversation thread.
  • GET /api/v1/memory/bridge/threads/:id: Get a conversation thread.
  • GET /api/v1/memory/bridge/threads/:id/summary: Summarize a conversation thread.
  • POST /api/v1/memory/bridge/lineage: Track parent-child memory relationships.
  • GET /api/v1/memory/bridge/lineage/:id: Get memory lineage.
  • GET /api/v1/memory/bridge/lineage/:id/ancestry: Get ancestry chain of a memory.
  • POST /api/v1/memory/bridge/migrate: Migrate memory between stores.
  • POST /api/v1/memory/bridge/context: Build priority-based context window.
  • GET /api/v1/memory/bridge/health: Memory Bridge health check.
  • GET /api/v1/memory/bridge/stats: Memory Bridge statistics.

🧬 Autonomous Learning & DGM

  • POST /api/v1/learning/experiences: Record agent experiences.
  • GET /api/v1/learning/experiences: Get recorded experiences.
  • POST /api/v1/learning/experiences/sample: Sample experiences for replay buffer evaluation.
  • POST /api/v1/learning/feedback: Record feedback.
  • GET /api/v1/learning/feedback: Get feedback.
  • POST /api/v1/learning/skills: Store a new skill.
  • GET /api/v1/learning/skills: Get stored skills.
  • PUT /api/v1/learning/skills/:id/usage: Update skill usage statistics.
  • POST /api/v1/learning/training/jobs: Create a training job.
  • GET /api/v1/learning/training/jobs: List training jobs.
  • GET /api/v1/learning/training/jobs/:id: Get a specific training job.
  • POST /api/v1/learning/training/data: Generate training data.
  • POST /api/v1/learning/curriculum/tasks: Create a curriculum task.
  • GET /api/v1/learning/curriculum: Get the curriculum.
  • PUT /api/v1/learning/curriculum/progress: Update curriculum progress.
  • GET /api/v1/learning/curriculum/progress/:agent_id: Get curriculum progress for an agent.
  • POST /api/v1/learning/distill: Distill knowledge.
  • GET /api/v1/learning/distill: Get distilled knowledge.
  • POST /api/v1/learning/performance/snapshots: Record performance snapshot.
  • GET /api/v1/learning/performance/history/:agent_id: Get performance history for an agent.
  • GET /api/v1/learning/metrics/:agent_id: Get learning metrics for an agent.
  • GET /api/v1/learning/health: Learning subsystem health check.
  • GET /api/v1/learning/stats: Learning subsystem statistics.

🧬 DGM (Darwin Gâdel Machine) Endpoints

  • POST /api/v1/dgm/archive: Archive an agent.
  • POST /api/v1/dgm/archive/select-parent: Select a parent agent from the archive.
  • GET /api/v1/dgm/archive/lineage/:id: Get lineage of an archived agent.
  • GET /api/v1/dgm/archive/best: Get the best archived agent.
  • GET /api/v1/dgm/archive/stepping-stones: Get stepping stones from the archive.
  • POST /api/v1/dgm/archive/record-child: Record a child agent in the archive.
  • GET /api/v1/dgm/archive/stats: Get archive statistics.
  • POST /api/v1/dgm/archive/prune: Prune the archive.
  • POST /api/v1/dgm/self-improve/propose: Propose a self-improvement.
  • POST /api/v1/dgm/self-improve/apply: Apply a self-improvement.
  • POST /api/v1/dgm/self-improve/validate: Validate a self-improvement.
  • POST /api/v1/dgm/self-improve/commit: Commit a self-improvement.
  • POST /api/v1/dgm/self-improve/rollback/:archive_id: Rollback a self-improvement.
  • POST /api/v1/dgm/self-improve/cycle: Trigger a formal 4-phase optimization cycle.
  • POST /api/v1/dgm/tools/evolve: Evolve a tool.
  • POST /api/v1/dgm/tools/validate-variant: Validate a tool variant.
  • POST /api/v1/dgm/tools/compare-variants: Compare tool variants.
  • POST /api/v1/dgm/tools/deploy-best: Deploy the best tool variant.
  • POST /api/v1/dgm/tools/rollback-variant: Rollback a tool variant.
  • GET /api/v1/dgm/tools/variant-history/:tool_name: Get tool variant history.
  • POST /api/v1/dgm/multi-candidate/execute: Execute multi-candidate generation.

🀝 MCP (Model Context Protocol) Endpoints

  • GET /api/v1/mcp/tools: List available MCP tools.
  • POST /api/v1/mcp/tools/call: Call an MCP tool.
  • GET /api/v1/mcp/resources: List available MCP resources.
  • POST /api/v1/mcp/resources/read: Read an MCP resource.
  • GET /api/v1/mcp/prompts: List available MCP prompts.
  • POST /api/v1/mcp/prompts/get: Get an MCP prompt.

🩺 Health Check

  • GET /api/v1/health: Gateway health check.

πŸŽ›οΈ gRPC Service Architecture Matrix

The core structural transport is defined in qbit.proto, dividing workloads across multiple discrete services.

                                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                  β”‚   Go Gateway RPC Router   β”‚
                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚ :9090
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚ :50051                                            β”‚ :50052
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚     Rust Core Node      β”‚                         β”‚    Python AI Agent      β”‚
         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€                         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
         β”‚ 1. VectorStoreService   β”‚                         β”‚ 1. AgentService         β”‚
         β”‚ 2. MemoryService        β”‚                         β”‚ 2. MCPService           β”‚
         β”‚ 3. MemoryBridgeService  β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ 4. AgentStateService    β”‚                                      β”‚
         β”‚ 5. A2AService           β”‚                                      β”‚ (9 Core Proxied
         β”‚ 6. KnowledgeGraphSvc    β”‚                                      β”‚  Services via Raw
         β”‚ 7. ObservabilityService β”‚                                      β”‚  Proto Forwarding)
         β”‚ 8. SpeculativeService   β”‚                                      β”‚
         β”‚ 9. LearningService      β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ 10. AgentArchiveService β”‚
         β”‚ 11. McpService          β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Service Identifier Name Network Location Binding Native RPC Count Primary Operational Responsibility
AgentService Python Layer (:50052) 4 Orchestrates high-level agent tasks, plans, and statuses.
MCPService Python Layer (:50052) 6 Standard Anthropic protocol connection interface.
VectorStoreService Rust Performance Core (:50051) 3 High-speed indexing using HNSW vector algorithms.
MemoryService Rust Performance Core (:50051) 10 Coordinates core multi-store memory operations.
MemoryBridgeService Rust Performance Core (:50051) 13 Manages cross-store queries and temporal lookbacks.
AgentStateService Rust Performance Core (:50051) 4 Controls the 9-state formal lifecycle FSM.
A2AService Rust Performance Core (:50051) 4 Handles Google Agent-to-Agent discovery routines.
KnowledgeGraphService Rust Performance Core (:50051) 4 Powers hybrid Vector GraphRAG queries.
ObservabilityService Rust Performance Core (:50051) 4 OpenTelemetry tracing and span aggregation.
SpeculativeService Rust Performance Core (:50051) 8 Manages multi-model lookahead execution.
LearningService Rust Performance Core (:50051) 23 Tracks experiences, skills, and curriculum progression.
AgentArchiveService Rust Performance Core (:50051) 8 Implements parent selection and DGM pruning algorithms.
McpService Rust Performance Core (:50051) 6 Handles MCP requests for tools, resources, and prompts.

πŸ“Š Framework Comparison & Production Scaling

πŸ”¬ Competitive Architecture Landscape

Capability Feature Qbit Platform LangChain / LangGraph CrewAI AutoGen
Engine Foundation Rust + Python + Go Python Only Python Only Python Only
Memory Engine 5-Layer Multi-Store Architecture Single-store plugins Single linear array Key-Value structures
Self-Improvement Native DGM Archive & Loops Explicitly absent Explicitly absent Explicitly absent
Context System 6-Strategy Focus Truncation Primitive window limits Hard-coded tokens Basic rolling windows
Fail-Safe Mode Native Graceful Degradation Crash on error Task stall behavior Intermittent loop halts

πŸ“ˆ Production Topology Implementation

                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚   HA Proxy Balancer Tier β”‚
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β–Ό                                             β–Ό
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚ Go API Gateway 01 β”‚                         β”‚ Go API Gateway 02 β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚                                             β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β–Ό
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β”‚   Redis Enterprise Queue   β”‚
                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β–Ό                                             β–Ό
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚ Python Worker 01  β”‚                         β”‚ Python Worker 02  β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚                                             β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Rust Core Sharded Storage Ring       β”‚
                    β”‚  [DashMap L1 Cache / Sharded Core]    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β–Ό                      β–Ό                      β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚ Qdrant Vector β”‚      β”‚ Redis L2 Ring β”‚      β”‚ PostgreSQL 16 β”‚
         β”‚ Cluster Ring  β”‚      β”‚ Cache Store   β”‚      β”‚ Primary Write β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

8. Technologies Used

Qbit leverages a modern, polyglot technology stack to achieve its high performance and advanced AI capabilities:

  • Rust: For the high-performance core services, including vector store, memory engine, and gRPC services, ensuring memory safety and speed.
  • Python: For the AI agent's intelligence layer, implementing ReAct loops, planning, tools, and governance, utilizing its rich ecosystem for AI/ML.
  • Go: For the API Gateway, providing robust and efficient handling of REST, WebSocket, and SSE traffic, and acting as a gRPC proxy.
  • Gin: A high-performance HTTP web framework for Go, used in the Go Gateway.
  • gRPC: A high-performance, open-source universal RPC framework used for inter-service communication between the Go, Python, and Rust components.
  • Redis: Utilized for L2 caching, task queuing, and hot state management.
  • Qdrant: A vector similarity search engine, used for L3 episodic memory and semantic search.
  • PostgreSQL 16 + pgvector: A powerful relational database used for L4 semantic memory, L5 cold archive, and procedural memory, with pgvector for vector embeddings.
  • Docker & Docker Compose: For containerization and orchestration of the microservices, simplifying deployment and environment setup.
  • OpenAI Compatible LLMs: The Python agent is designed to work with OpenAI-compatible Large Language Models.
  • Adafactor, QLoRA, DPO: Advanced machine learning techniques used for pre-training optimization, fine-tuning execution, and preference alignment within the self-learning flywheel.

πŸ› οΈ Troubleshooting & Verification

πŸ” Service Health Verification Diagnostics

# Check status of the internal deployment services
make health

# Query Go API status via terminal curl
curl -s http://localhost:8080/api/v1/health | jq

# Verify underlying transactional cluster engines
redis-cli -h localhost -p 6379 ping
pg_isready -h localhost -p 5432

πŸ“‹ Common Error Resolution Matrix

  • Symptom: UNIMPLEMENTED status returns during gRPC messaging loops.
    • Root Cause: Python worker process disconnected or instance missed the proxy registration loop hook in grpc_server.py.
    • Resolution Steps: Run docker compose restart python-agent to re-trigger the automated service binding handshake.
  • Symptom: Memory reads succeed but data vanishes across full container restarts.
    • Root Cause: PostgreSQL connection timed out, causing the system to degrade to non-persistent DashMap/Redis L1/L2 operation modes.
    • Resolution Steps: Inspect credentials using docker compose logs rust-core and verify storage space allocation mappings.

πŸ’» Development & Contributing

πŸ“œ Strict Engineering Standards

  1. Zero Placeholders: Pull requests containing todo!(), unimplemented!(), or empty mock stubs will be automatically rejected.
  2. No Suppressed Warnings: Rust code must compile under Edition 2024 specifications with zero global lints bypassed.
  3. Additive Schema Migrations: All database updates must include safe column default configurations to prevent production table locking.

πŸ› οΈ Setting Up Local Framework Testing

# Initialize local configuration files and environment anchors
make init

# Spin up core datastores via docker containers
make dev-infra

# Execute comprehensive test verification packages
cd rust-core && cargo test
cd ../python-agent && pytest
cd ../go-gateway && go test ./...

πŸ“„ License

This platform is released under the terms of the open-source MIT License. Review the project repository LICENSE file for additional usage conditions.

Made with ❀️ in Libya πŸ‡±πŸ‡Ύ

About

A production-grade, multi-language AI agent platform built with Python, Rust and Go

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors