Architecture Overview
This document explains the architecture of Omnia and the design decisions behind it.
High-Level Architecture
Omnia consists of three main components:
┌─────────────────────────────────────────────────────────────────┐
│ Kubernetes Cluster │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Omnia │ │ Agent │ │ Agent │ │
│ │ Operator │───▶│ Pod 1 │ │ Pod 2 │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │ │ │
│ │ ┌──────┴──────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ PromptPack │ │ Redis │ │
│ │ ConfigMap │ │ (Sessions) │ │
│ └─────────────┘ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
│
│ WebSocket
▼
┌─────────┐
│ Clients │
└─────────┘
Components
Omnia Operator
The operator is a Kubernetes controller that:
- Watches for AgentRuntime, PromptPack, and ToolRegistry resources
- Creates and manages Deployments for agent pods
- Creates Services for agent access
- Monitors referenced resources and updates agents accordingly
The operator follows the standard Kubernetes controller pattern:
- Watch - Monitor custom resources for changes
- Reconcile - Bring actual state to desired state
- Status - Report current state back to the resource
Agent Container
Each agent pod runs the Omnia agent container, which provides:
- WebSocket Facade - Handles client connections and message routing
- Session Management - Maintains conversation state
- LLM Integration - Communicates with configured providers
- Tool Execution - Invokes tools from the ToolRegistry
Custom Resource Definitions
AgentRuntime
The primary resource for deploying agents. It references:
- Provider configuration (which LLM to use)
- PromptPack (what prompts to use)
- ToolRegistry (what tools are available)
- Session configuration
PromptPack
Defines versioned prompt configurations following the PromptPack specification. Supports:
- Structured prompt definitions with variables, parameters, and validators
- ConfigMap-based storage of compiled PromptPack JSON
- Canary rollouts for safe prompt updates
- Automatic agent notification on changes
ToolRegistry
Defines tools available to agents:
- Inline URL-based tools
- Service discovery via label selectors
- Mixed sources in a single registry
Design Decisions
Why Kubernetes Operator?
We chose the operator pattern because:
- Native integration - Agents are first-class Kubernetes citizens
- Declarative configuration - Define desired state, not procedures
- Self-healing - Automatic recovery from failures
- Scalability - Leverage Kubernetes scaling mechanisms
Why WebSocket?
WebSocket was chosen for the client facade because:
- Streaming - Essential for LLM response streaming
- Bidirectional - Enables tool calls and results
- Persistent - Maintains connection for multi-turn conversations
- Efficient - Lower overhead than HTTP polling
Why Separate PromptPack?
Separating prompts from agents allows:
- Reusability - Same prompts across multiple agents
- Versioning - Track prompt changes independently
- Safe rollouts - Canary deployments for prompts
- Separation of concerns - Prompt engineers vs DevOps
Why Service Discovery for Tools?
Label-based tool discovery enables:
- Dynamic registration - Tools can come and go
- Team boundaries - Teams own their tool services
- Decoupling - Agents don’t need to know tool details
- Standard Kubernetes - Uses familiar patterns
Resource Relationships
AgentRuntime
│
├── references ──▶ PromptPack ──▶ ConfigMap
│
├── references ──▶ ToolRegistry ──▶ Services (via selector)
│
├── creates ────▶ Deployment
│
└── creates ────▶ Service
Reconciliation Flow
When an AgentRuntime is created or updated:
- Validate the referenced PromptPack exists
- Optionally validate the referenced ToolRegistry
- Build the agent container spec with environment variables
- Create or update the Deployment
- Create or update the Service
- Update the AgentRuntime status
When a PromptPack changes:
- Validate the source ConfigMap
- Find all AgentRuntimes referencing this PromptPack
- Trigger reconciliation for those agents
- Update PromptPack status with rollout state
Security Considerations
Secrets Management
- API keys are stored in Kubernetes Secrets
- Secrets are mounted as environment variables, not files
- Secrets can be from the same or different namespace
Network Policies
Consider implementing NetworkPolicies to:
- Restrict agent egress to allowed LLM providers
- Limit tool access to specific services
- Isolate agent namespaces
RBAC
The operator requires specific permissions:
- Full access to Omnia CRDs
- Read access to ConfigMaps and Secrets
- Create/Update access to Deployments and Services