Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Platform Architecture

NeuAIs is built on a three-layer architecture designed for deploying and managing thousands of autonomous AI agents.

High-Level Overview

┌──────────────────────────────────────────────────┐
│   User Applications Layer                        │
│   Dashboard • Admin • Observatory • CLI • Mobile │
└──────────────────────────────────────────────────┘
                      ↓
┌──────────────────────────────────────────────────┐
│   Backend Services Layer (8 services)            │
│   Auth • IAM • KMS • Billing • Compute           │
│   Storage • Database • AI Network                │
└──────────────────────────────────────────────────┘
                      ↓
┌──────────────────────────────────────────────────┐
│   Agent Infrastructure Layer                     │
│   1000+ Micro AI Agents                          │
│   RIC • SMO • rApps • Mesh Network               │
└──────────────────────────────────────────────────┘

Layer 1: User Applications

Dashboard

  • Tech: Svelte frontend, Rust backend
  • Purpose: Primary control plane for agent management
  • Features: Agent CRUD, metrics visualization, configuration
  • Port: 3000

Admin Portal

  • Tech: Next.js, TypeScript
  • Purpose: System administration and service configuration
  • Features: User management, service health, system monitoring
  • Port: 3001

Observatory

  • Tech: Rust, WGPU, WebGPU
  • Purpose: Real-time 3D visualization of agent networks
  • Features: Network topology, performance metrics, agent status
  • Port: 8080

CLI Tool

  • Tech: Python (Calliope framework)
  • Purpose: Command-line interface for all operations
  • Features: Agent deployment, log streaming, configuration

Mobile Apps

  • Android: Kotlin, Jetpack Compose
  • iOS: Swift, SwiftUI
  • Features: Agent monitoring, push notifications, quick actions

Layer 2: Backend Services

Service Mesh Architecture

┌─────────────────────────────────────────────────┐
│              API Gateway (Port 8000)             │
│         Load Balancing • Rate Limiting           │
└─────────────────────────────────────────────────┘
                      ↓
┌──────────┬──────────┬──────────┬────────────────┐
│   Auth   │   IAM    │   KMS    │    Billing     │
│  :8001   │  :8002   │  :8003   │     :8004      │
└──────────┴──────────┴──────────┴────────────────┘
┌──────────┬──────────┬──────────┬────────────────┐
│ Compute  │ Storage  │ Database │  AI Network    │
│  :8005   │  :8006   │  :8007   │     :8080      │
└──────────┴──────────┴──────────┴────────────────┘
                      ↓
┌─────────────────────────────────────────────────┐
│           Service Registry (Consul)              │
│         Auto-discovery • Health Checks           │
└─────────────────────────────────────────────────┘

Auth Service (Port 8001)

  • OAuth2, JWT, API keys
  • Session management
  • MFA support
  • Tech: Go

IAM Service (Port 8002)

  • Roles and policies
  • Resource permissions
  • Service accounts
  • Tech: Go

KMS Service (Port 8003)

  • Key generation
  • Encryption/decryption
  • Secret storage
  • Tech: Go

Billing Service (Port 8004)

  • Usage tracking
  • Cost calculation
  • Invoicing
  • Tech: Go

Compute Service (Port 8005)

  • Agent execution
  • Auto-scaling
  • Resource allocation
  • Tech: Go

Storage Service (Port 8006)

  • S3-compatible object storage
  • CDN integration
  • Replication
  • Tech: Go

Database Service (Port 8007)

  • PostgreSQL
  • Redis
  • Migrations
  • Tech: Go

AI Network Service (Port 8080)

  • RIC (RAN Intelligent Controller)
  • SMO (Service Management & Orchestration)
  • rApps framework
  • Tech: Go

Layer 3: Agent Infrastructure

AI Network Layer

┌─────────────────────────────────────────────────┐
│                SMO Server (Port 8080)            │
│    rApp Manager • Policy Engine • Orchestrator  │
└─────────────────────────────────────────────────┘
                      ↓
┌─────────────────────────────────────────────────┐
│                RIC Server (Port 8081)            │
│    ML Engine • Anomaly Detection • Features     │
└─────────────────────────────────────────────────┘
                      ↓
┌─────────────────────────────────────────────────┐
│              rApps (Network Applications)        │
│   Anomaly Detector • Traffic Optimizer          │
│   Auto-Remediation • Custom rApps               │
└─────────────────────────────────────────────────┘
                      ↓
┌─────────────────────────────────────────────────┐
│            Mesh Network (Port 9000)              │
│   Yggdrasil • QUIC • FRP • Exit Nodes           │
└─────────────────────────────────────────────────┘

RIC (RAN Intelligent Controller)

  • ML-powered network intelligence
  • Real-time inference
  • Anomaly detection (Isolation Forest)
  • Feature extraction
  • Model management

SMO (Service Management & Orchestration)

  • rApp lifecycle management
  • Policy enforcement
  • Resource orchestration
  • Event bus (Kafka, Redis)

rApps Framework

  • Standard interface for network applications
  • Registry and lifecycle management
  • Event processing
  • Action generation

Mesh Network

  • Yggdrasil: IPv6 overlay network
  • QUIC: Low-latency transport
  • FRP: Fast reverse proxy for tunneling
  • Exit Nodes: Failover and health monitoring

Data Flow

Agent Deployment Flow

1. User → CLI/Dashboard
2. CLI → Auth Service (authenticate)
3. CLI → Compute Service (create agent)
4. Compute → Database (store metadata)
5. Compute → Storage (upload binary)
6. Compute → AI Network (register agent)
7. AI Network → Mesh Network (allocate resources)
8. Mesh Network → Agent (start execution)
9. Agent → Observatory (stream metrics)

Monitoring Flow

1. Agent → Metrics (Prometheus format)
2. Metrics → AI Network (collect)
3. AI Network → RIC (ML inference)
4. RIC → SMO (anomaly detection)
5. SMO → rApps (process events)
6. rApps → SMO (generate actions)
7. SMO → Mesh Network (execute actions)
8. All → Observatory (visualize)

Network Protocols

Yggdrasil

  • IPv6 overlay network
  • Automatic routing
  • End-to-end encryption
  • Self-healing topology

QUIC

  • UDP-based transport
  • Low latency
  • Connection migration
  • Multiplexing

FRP

  • Fast reverse proxy
  • Tunneling through NAT
  • Load balancing
  • Health checks

Storage Architecture

Object Storage

  • S3-compatible API
  • Multi-region replication
  • CDN integration
  • Versioning

Database

  • PostgreSQL (primary)
  • Redis (caching, pub/sub)
  • Time-series (metrics)

File System

  • Distributed file service
  • Agent binaries
  • Configuration files
  • Logs

Security Architecture

Authentication Flow

User → Auth Service → JWT Token → API Gateway → Services

Authorization Flow

Request → API Gateway → IAM Service → Policy Check → Allow/Deny

Encryption

  • At Rest: AES-256 (KMS)
  • In Transit: TLS 1.3
  • End-to-End: Agent-to-agent encryption via Yggdrasil

Scaling Architecture

Horizontal Scaling

  • All services are stateless
  • Load balancing via API Gateway
  • Auto-scaling based on metrics

Agent Scaling

  • Auto-scaling policies
  • Resource-based triggers (CPU, memory, custom)
  • Health-based scaling

Database Scaling

  • Read replicas
  • Connection pooling
  • Query optimization

Deployment Architecture

Development

Local machine → Docker Compose → All services

Staging

GitHub → CI/CD → Fly.io → Staging environment

Production

GitHub → CI/CD → Multi-region deployment
- US West (primary)
- US East (failover)
- EU (latency optimization)

Observability

Metrics

  • Prometheus format
  • Custom metrics per agent
  • System metrics (CPU, memory, network)

Logs

  • Structured JSON logs
  • Centralized aggregation
  • Real-time streaming

Traces

  • Distributed tracing
  • OpenTelemetry
  • Request correlation

Visualization

  • Observatory (3D real-time)
  • Grafana (time-series)
  • Dashboard (control plane)

Technology Stack

LayerTechnology
FrontendSvelte, Next.js, React
BackendGo, Rust
DatabasePostgreSQL, Redis
NetworkingYggdrasil, QUIC, FRP
MLIsolation Forest, Custom models
VisualizationWGPU, WebGPU
CLIPython (Calliope)
MobileKotlin, Swift
InfrastructureDocker, Fly.io
MonitoringPrometheus, Grafana

Design Principles

  1. Stateless Services: All services can be restarted without data loss
  2. Service Discovery: Automatic registration and health checks
  3. Fault Tolerance: Automatic failover and retry logic
  4. Observability: Metrics, logs, and traces for everything
  5. Security: Zero-trust architecture with encryption everywhere
  6. Scalability: Horizontal scaling for all components
  7. Performance: Low-latency networking and efficient resource usage

Next Steps