Skip to content

Architecture

Kernel Service is a standalone Python/FastAPI service deployed on AWS ECS Fargate.

Components

┌─────────────────────────────────────┐
│ API Gateway │
│ (FastAPI, tenant auth, rate limit) │
└──────────────┬──────────────────────┘
│
┌──────────────▼──────────────────────┐
│ Orchestrator │
│ (ReAct loop, state management) │
├─────────┬──────────┬────────────────┤
│ Context │ Model │ Tool │
│ Builder │ Router │ Executor │
│ │ │ │
│ Agent │ Claude │ Your App's │
│ memory │ GPT │ tool │
│ + RAG │ Gemini │ endpoints │
└─────────┴──────────┴────────────────┘
│
┌──────────────▼──────────────────────┐
│ Per-Tenant Storage │
│ PostgreSQL + pgvector + Redis │
└─────────────────────────────────────┘

Request Flow

  1. Client submits a task via POST /api/v1/tasks
  2. Tenant authentication via headers
  3. Orchestrator creates a run and enters the ReAct loop
  4. Context builder assembles agent persona + objective + tools
  5. Model router selects best LLM and calls it
  6. If LLM requests tool calls, executor runs them
  7. Results fed back to LLM for next iteration
  8. Loop continues until objective is met or max iterations
  9. Full audit trail recorded (steps, tokens, cost)

Infrastructure

  • Compute: AWS ECS Fargate (auto-scaling)
  • Database: PostgreSQL 16 + pgvector
  • Cache/Queue: Redis (ElastiCache)
  • DNS: Cloudflare (edge SSL, DDoS protection)
  • Secrets: AWS SSM Parameter Store
  • IaC: Terraform