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
- Client submits a task via
POST /api/v1/tasks - Tenant authentication via headers
- Orchestrator creates a run and enters the ReAct loop
- Context builder assembles agent persona + objective + tools
- Model router selects best LLM and calls it
- If LLM requests tool calls, executor runs them
- Results fed back to LLM for next iteration
- Loop continues until objective is met or max iterations
- 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