AAASP (Agent-as-a-Service Platform) is multi-tenant infrastructure for AI agent deployment. Built on Elixir/OTP, it handles the hard parts: session memory that persists across runs, async job queuing, per-provider HTTP pools, and usage-based billing — so agent builders focus on behavior, not infrastructure.
Core Architecture
**OTP supervision tree** gives AAASP production-grade reliability: - `DynamicSupervisor` spawns isolated agent processes per tenant - `GenServer` per active session with automatic cleanup after 30-minute idle - `Registry` provides unique naming for session lookup - `Oban` job queue with persistent PostgreSQL backing for runs, webhooks, and billing
Key Features
- >Session Memory: Per-session GenServer with Merkle-checkpointing every 20 messages — context survives restarts
- >Multi-Provider Routing: Anthropic, OpenAI, DeepSeek, Together, Groq, Fireworks — swappable per agent deployment
- >Async Run Model: 202 Accepted → PubSub streaming for sync clients; batch endpoint for N-prompt atomic jobs
- >RunBatcher: GenServer buffers 200 entries into single `insert_all` — 15.9 → 65 req/s (+300% throughput)
- >ETS Tenant Cache: 60-second TTL with `read_concurrency: true` — sub-microsecond auth lookups
- >Credential Vaults: Cloak AES-GCM encryption for stored provider API keys
Performance Profile
Benchmarked at 200 concurrent connections on a single node: - **~65–70 req/s** sustained throughput - **Sub-microsecond** tenant auth via ETS cache - **Single `insert_all`** per batch via RunBatcher (vs N individual inserts) - **Cross-node coordination** via Oban PG notifier for multi-node deployments
API Surface
| Endpoint | Function |
| POST /v1/runs | Submit single agent run (async or sync) |
| POST /v1/batches | Submit N runs as atomic batch |
| GET /v1/sessions | List active sessions with memory state |
| POST /v1/agents | Register agent with provider config |
| POST /v1/deployments | Deploy agent to tenant with billing config |
Dashboard
Phoenix LiveView dashboard with real-time OTP process tree visualization, Oban queue monitoring, per-tenant usage metrics, and live run state streaming.
Tech Stack
Elixir/Phoenix with Oban for background jobs. Finch HTTP/2 connection pools per provider. PostgreSQL with Ecto ORM. Phoenix LiveView for the dashboard. Cloak for credential encryption. Bandit HTTP server on port 8002.