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 (via bollard) — Firecracker in development
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 protocolSMCP (Secure Model Context Protocol)
Policy engineCedar

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 /   │  │  SMCP    │  │  NFS    │  │  PostgreSQL    │ │
│  │  Firecracker │  │ Gateway  │  │ Gateway │  │  Repositories  │ │
│  │  Runtime     │  │ + Cedar  │  │ FSAL    │  │                │ │
│  └──────────────┘  └──────────┘  └─────────┘  └────────────────┘ │
│  ┌──────────────┐  ┌──────────┐  ┌─────────┐                      │
│  │   Temporal   │  │ OpenBao  │  │Keycloak │                      │
│  │  (Workflow)  │  │ Secrets  │  │  IAM    │                      │
│  └──────────────┘  └──────────┘  └─────────┘                      │
└─────────────────────────────────────────────────────────────────────┘

Bounded Contexts

AEGIS is divided into 13 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 PolicyRustSMCP, 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–ResponseRustWebhook ingestion, workflow routing
9Control Plane (UX)TypeScriptOperator dashboard (separate repo)
10Client SDKPython, TypeScriptProgrammatic access (separate repos)
11Secrets & IdentityRustOpenBao, credential resolution
12Zaru Consumer ProductTypeScript / RustConsumer surface (separate deployment)
13IAM & Identity FederationRustKeycloak OIDC, JWT validation

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
  │  KeycloakAuthInterceptor 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 / 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/llm/generate → inner loop begins

Orchestrator: InnerLoopService
  │  10. Forwards to LLM provider (OpenAI / Anthropic / Ollama)
  │  11. Receives tool calls  → routes via SMCP → 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
SMCP security protocolSMCP
MCP tool routing pathsTool Routing
AegisFSAL and NFS storage gatewayStorage Gateway
Event bus and domain eventsEvent Bus

On this page