Skip to content

Architecture

ZERG is a production-grade agentic orchestration platform built on three pillars.

System Architecture

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Limon     │     │  ZERG CLI   │     │   API       │
│  (Vue.js)   │     │  (LuaJIT)   │     │  Clients    │
└──────┬──────┘     └──────┬──────┘     └──────┬──────┘
       │                   │                   │
       └───────────┬───────┴───────────────────┘
                   │ HTTP/SSE
       ┌───────────┴───────────┐
       │        Sol Server      │
       │    (Erlang/OTP)        │
       │  ┌─────────────────┐  │
       │  │ Cowboy HTTP     │  │
       │  │ 110+ endpoints  │  │
       │  ├─────────────────┤  │
       │  │ Event Store     │  │
       │  │ (Mnesia, 35     │  │
       │  │  event types)   │  │
       │  ├─────────────────┤  │
       │  │ Workflow Engine │  │
       │  │ (gen_statem)    │  │
       │  ├─────────────────┤  │
       │  │ Inference       │  │
       │  │ (llama.cpp)     │  │
       │  ├─────────────────┤  │
       │  │ Scheduler       │  │
       │  │ (cron/at/every) │  │
       │  └─────────────────┘  │
       └───────────┬───────────┘
                   │ ZMQ (ROUTER/DEALER)
       ┌───────────┴───────────┐
       │     Worker Boundary    │
       │  ┌─────┐  ┌─────┐    │
       │  │Luna │  │Luna │    │
       │  │     │  │     │    │
       │  └─────┘  └─────┘    │
       │  (LuaJIT, <10MB each) │
       └───────────────────────┘

Component Details

Sol Server (Erlang/OTP)

  • 219 modules, ~28K lines of Erlang code
  • 110+ REST endpoints with SSE streaming
  • Event sourcing with Mnesia (35 event types)
  • gen_statem-based workflow engine with compensation
  • llama.cpp local inference with remote provider fallback
  • 10 provider adapters (Anthropic, OpenAI, z.ai, etc.)
  • Prometheus metrics + OpenTelemetry tracing

Luna Agent (LuaJIT)

  • 108 modules, ~25K lines of Lua code
  • 994KB binary (bytecode + XOR + CRC32)
  • 45+ built-in tools + 14 computer use tools
  • 6 agent modes (Build/Plan/Explore/Review/General/Coordinate)
  • MCP client (stdio + HTTP, multi-server)
  • Dual-write sessions (JSONL + SQLite with FTS5)

Mango (Python/Tornado)

  • Auth service with token validation and RBAC
  • Microservice framework for extending the platform

Key Design Decisions

  1. Erlang/OTP for massive concurrency and fault tolerance
  2. LuaJIT for ultra-lightweight worker nodes
  3. ZMQ for the polyglot worker boundary
  4. Event sourcing as the orchestration backbone
  5. llama.cpp for local-first inference

Released under the MIT License.