Aegis Orchestrator
Architecture

Architecture Overview

Component map, bounded contexts, data flow, and technology stack for the AEGIS orchestrator.

Architecture Overview

AEGIS is a self-hosted autonomous agent orchestrator built in Rust. This page provides the system-wide component map and explains how subsystems interact.


Technology Stack

LayerTechnology
LanguageRust (2021 edition)
Async runtimeTokio
HTTP APIAxum
gRPC APITonic + Prost
DatabasePostgreSQL via SQLx
Workflow durabilityTemporal
Container runtimeDocker / Podman (via bollard) for agent containers — Firecracker planned for later phase
Container image distributionOCI registries (Docker Hub, GHCR, private)
Storage backendSeaweedFS
Storage transportUser-space NFSv3 (nfsserve crate)
Secrets managementOpenBao
IAM / OIDCKeycloak
Agent tool protocolMCP (Model Context Protocol)
Agent security protocolSEAL (Signed Envelope Attestation Layer)
Policy engineCedar
Platform deploymentPodman Kube YAML + Makefile (aegis-deploy)
Reverse proxyCaddy (automatic TLS via ACME)
Log aggregationLoki + Promtail
Distributed tracingJaeger (OTLP)
Metrics & alertingPrometheus + Grafana

Component Map

┌─────────────────────────────────────────────────────────────────────┐
│                        AEGIS Orchestrator                           │
│                                                                     │
│  Presentation Layer                                                 │
│  ┌──────────────────┐  ┌────────────────────────────────────────┐  │
│  │  HTTP API (Axum) │  │       gRPC API (Tonic)                 │  │
│  │  /v1/...         │  │  aegis.runtime.v1                      │  │
│  └────────┬─────────┘  └────────────────┬───────────────────────┘  │
│           │                             │                           │
│  Application Layer                      │                           │
│  ┌────────▼─────────────────────────────▼────────────────────────┐ │
│  │           Application Services / Use Cases                     │ │
│  │  DeployAgent  StartExecution  StartWorkflow  SpawnChild        │ │
│  └───────┬────────────────┬──────────────┬─────────────┬─────────┘ │
│          │                │              │             │            │
│  Domain Layer             │              │             │            │
│  ┌───────▼──────┐  ┌──────▼──────┐  ┌───▼────┐  ┌────▼────────┐  │
│  │ Agent        │  │ Execution   │  │Workflow│  │  Swarm      │  │
│  │ Aggregate    │  │ Aggregate   │  │ FSM    │  │  Context    │  │
│  └──────────────┘  └─────────────┘  └────────┘  └─────────────┘  │
│                                                                     │
│  Infrastructure Layer                                               │
│  ┌──────────────┐  ┌──────────┐  ┌─────────┐  ┌────────────────┐ │
│  │  Docker /   │  │  SEAL    │  │  NFS    │  │  PostgreSQL    │ │
│  │  Podman /   │  │ Gateway  │  │ Gateway │  │  Repositories  │ │
│  │ Firecracker │  │ + Cedar  │  │ FSAL    │  │                │ │
│  └──────────────┘  └──────────┘  └─────────┘  └────────────────┘ │
│  ┌──────────────┐  ┌──────────┐  ┌─────────┐                      │
│  │   Temporal   │  │ OpenBao  │  │Keycloak │                      │
│  │  (Workflow)  │  │ Secrets  │  │  IAM    │                      │
│  └──────────────┘  └──────────┘  └─────────┘                      │
└─────────────────────────────────────────────────────────────────────┘

Bounded Contexts

AEGIS is divided into 16 bounded contexts. Each owns its domain model and exposes well-defined service traits:

#ContextLanguagePrimary Responsibility
1Agent LifecycleRustManifest CRUD, agent status
2ExecutionRust100monkeys loop, container lifecycle
3Workflow OrchestrationRustFSM execution, Blackboard, Temporal
4Security PolicyRustSEAL, Cedar policy engine, attestation
5Cortex (Memory)Rust + PythonPattern storage — cloud-managed; not in OSS deployment
6Swarm CoordinationRustMulti-agent hierarchy, messaging, locks
7Storage GatewayRustNFS server, AegisFSAL, SeaweedFS
8Stimulus–ResponseRustTwo-stage hybrid routing pipeline for webhook ingestion and workflow routing
9Zaru Client (UX)TypeScriptUnified operator and consumer interface (merged into BC-12)
10Client SDKPython, TypeScriptProgrammatic access (separate repos)
11Secrets & IdentityRustOpenBao, credential resolution
12Zaru Consumer ProductTypeScript / RustConsumer surface (separate deployment)
13IAM & Identity FederationRustKeycloak OIDC, JWT validation
14SEAL Tooling GatewayRustMacro-tool workflows, ephemeral CLI execution, credential proxy (standalone binary)
15Observability & TelemetryRustOTLP log export, Prometheus metrics, telemetry resource injection
16Infrastructure & HostingRustMulti-node cluster topology, execution routing, inter-node security

Contexts communicate via service traits and domain events. No cross-context direct database access.


Request Data Flow

Agent Execution Request

Client
  │  POST /v1/executions (HTTP) or ExecuteAgent (gRPC)

Presentation Layer
  │  GrpcIamAuthInterceptor validates Bearer JWT

Application Layer: StartExecutionUseCase
  │  1. Resolves Agent by ID from AgentRepository
  │  2. Creates Execution aggregate (ExecutionId, status=pending)
  │  3. Saves to PostgreSQL
  │  4. Publishes ExecutionStarted domain event

Execution Context: ExecutionSupervisor
  │  5. Starts Container (Docker / Podman / Firecracker)
  │  6. Resolves volumes, starts NFS gateways
  │  7. Begins outer iteration loop

NFS Server Gateway
  │  8. Mounts volumes into container via NFSv3

Container: bootstrap.py
  │  9. Calls /v1/dispatch-gateway → inner loop begins

Orchestrator: InnerLoopService
  │  10. Forwards to LLM provider (OpenAI / Anthropic / Ollama)
  │  11. Receives tool calls  → routes via SEAL → executes → returns
  │  12. Loop until no more tool calls

Validators
  │  13. Each validator runs; scores aggregated
  │  14. If score ≥ threshold → success → execution completes
  │  15. If score < threshold and retries remain → refine → back to step 9

Event Bus
  │  16. ExecutionCompleted / ExecutionFailed published

Client (gRPC stream or polling)
     17. Receives final status and output

Layer Structure (Codebase)

aegis-orchestrator/
├── orchestrator/
│   ├── core/
│   │   ├── domain/           # Aggregates, value objects, domain services
│   │   ├── application/      # Use cases, application services
│   │   ├── infrastructure/   # Repositories, runtime adapters, external clients
│   │   └── presentation/     # HTTP and gRPC handlers, auth middleware
│   └── swarm/                # Swarm coordination domain
├── aegis-config.yaml         # Node runtime configuration
└── Cargo.toml

Each layer only depends on layers below it. The domain layer has no external dependencies other than serde.


Deep Dives

TopicPage
Execution engine (outer loop, inner loop, Dispatch Protocol)Execution Engine
Workflow FSM and Temporal integrationWorkflow Engine
SEAL security protocolSEAL
MCP tool routing pathsTool Routing
AegisFSAL and NFS storage gatewayStorage Gateway
Event bus and domain eventsEvent Bus
SEAL Tooling Gateway — macro-tool workflows, ephemeral CLI, credential proxyTooling Gateway
Stimulus-Response Routing — two-stage hybrid routing pipeline for external event ingestionStimulus-Response Routing

On this page