Deploy Agent
Docs/Getting Started/Architecture
Technical

Platform Architecture

A deep dive into how Lobstack provisions dedicated infrastructure, runs AI agents, and connects everything together.

💡

Architecture Overview

Lobstack is a multi-tenant SaaS platform that provisions dedicated VMs for each AI agent. Every agent runs its own instance of the proprietary Lobstack Agent Runtime with isolated compute, memory, and network access.

System Diagram#

The platform consists of four main layers that communicate via authenticated HTTP APIs.

High-Level Architecture
┌─────────────────────────────────────────────────────────────┐
│                    User (Browser / API)                      │
└─────────────────────────────┬───────────────────────────────┘
                              │
                              ▼
                ┌───────────────────────────┐
                │     Next.js Application   │
                │   (Vercel Serverless)     │
                │                           │
                │  ┌─────────┐ ┌─────────┐  │
                │  │ React   │ │ 56 API  │  │
                │  │Dashboard│ │ Routes  │  │
                │  └─────────┘ └────┬────┘  │
                └───────────────────┼───────┘
                                    │
              ┌─────────────────────┼─────────────────────┐
              │                     │                     │
              ▼                     ▼                     ▼
    ┌──────────────────┐  ┌────────────────┐  ┌────────────────┐
    │    Supabase       │  │     Stripe     │  │ Cloud Provider │
    │  (PostgreSQL +    │  │  (Payments &   │  │ (Hetzner Cloud)│
    │   Auth + RLS)     │  │  Subscriptions)│  │                │
    └──────────────────┘  └────────────────┘  └───────┬────────┘
                                                      │
                                                      ▼
                                            ┌──────────────────┐
                                            │   Agent VM        │
                                            │                   │
                                            │  ┌─────────────┐  │
                                            │  │Agent Bridge  │  │
                                            │  │ (REST + WS)  │  │
                                            │  └──────┬──────┘  │
                                            │         │         │
                                            │  ┌──────▼──────┐  │
                                            │  │Lobstack      │  │
                                            │  │ Runtime      │  │
                                            │  └──────┬──────┘  │
                                            │         │         │
                                            │  ┌──────▼──────┐  │
                                            │  │  MCP Servers │  │
                                            │  │  (10+ tools) │  │
                                            │  └─────────────┘  │
                                            └──────────────────┘

Architecture Layers#

1. Frontend — Next.js Dashboard#

The user-facing application is built with Next.js 16, React 19, and Tailwind CSS 4. It provides:

ComponentPurpose
Dashboard8-panel agent control center (Overview, Agent, Chat, Skills, Sandbox, Memory, Logs, Settings)
Onboarding3-step setup wizard: model → plan → deploy
Docs Site30+ pages of documentation with sidebar navigation
Admin Panel12-section admin dashboard with Master Terminal
Landing PageMarketing site with Spline 3D hero, pricing, and social proof

2. API Layer — 56 Serverless Routes#

All backend logic runs as serverless functions on Vercel. Routes are organized by domain:

DomainRoutesPurpose
/api/agent/*30+Agent lifecycle, chat, config, skills, memory, workflows, analytics
/api/admin/*20+Admin operations, monitoring, payments, user management
/api/checkout1Stripe checkout session creation
/api/webhooks/stripe1Stripe webhook handler (5 event types)
/api/cron/health1Health check + auto-recovery (runs every minute)
/api/affiliate/*2Affiliate registration and stats

3. Database — Supabase PostgreSQL#

All state is stored in a Supabase-managed PostgreSQL database with Row Level Security (RLS) enabled on every table. The schema includes 19 tables:

Table GroupTablesPurpose
Identityusers, subscriptionsUser accounts, billing, Stripe mapping
Agentagent_instances, agent_configs, agent_skills, agent_memoryAgent state, configuration, integrations, knowledge
Messagingmessages, chat_sessionsChat history, session grouping
Automationworkflows, workflow_triggers, workflow_executionsWorkflow definitions, triggers (cron/webhook/event), execution tracking
Webhookswebhooks, webhook_deliveriesOutbound webhook config and delivery log
Monitoringagent_logs, health_checks, token_usageOperational logs, health history, token consumption
Affiliateaffiliates, referrals, commissionsPartner program, referral tracking, commission payouts

4. Infrastructure — Dedicated VMs#

Each agent runs on a dedicated virtual machine provisioned via cloud provider APIs. The provisioning flow:

Agent Provisioning Flow
User selects plan → Stripe checkout → Webhook fires
                                          │
                                          ▼
                                   provisionAgent()
                                          │
                              ┌───────────┼───────────┐
                              ▼           ▼           ▼
                         Create VM   Create DB    Seed Config
                         (cloud-init)  Records    (SOUL.md, etc.)
                              │
                              ▼
                     cloud-init script runs:
                     ├── Install Node.js 22
                     ├── Install Python 3.11
                     ├── Install Lobstack Agent Runtime
                     ├── Configure MCP servers
                     ├── Start agent bridge
                     └── POST /api/agent/provisioned
                              │
                              ▼
                     Agent online (status: running)
                     Heartbeat every 30 seconds
PlanvCPURAMStorageMessages/mo
Starter22 GB50 GB SSD1,000
Pro24 GB80 GB SSD5,000
Performance48 GB160 GB SSD15,000
Enterprise832 GB320 GB SSD50,000

Key Data Flows#

Chat Message Flow#

User → Agent → Response
Dashboard sends POST /api/agent/chat
       │
       ▼
API validates auth + checks message quota
       │
       ▼
Forwards to Agent Bridge (HTTP → agent VM:3001)
       │
       ▼
Bridge → Lobstack Runtime → AI Model (Claude/GPT/Gemini)
       │
       ▼
Response returns through same path
       │
       ▼
Bridge async: POST /api/agent/messages (store + extract memories)

Health Check & Auto-Recovery#

A Vercel Cron job runs every minute to monitor all agents:

CheckThresholdAction
Stuck provisioning (silent)8 minutesAuto-rebuild with provider rotation
Stuck provisioning (total)25 minutesMark error, preserve server for inspection
Health check failure5 consecutiveMark agent as error
Heartbeat timeout5 minutesFlag as potentially unhealthy

Security Architecture#

Security is enforced at every layer of the stack:

LayerMechanism
AuthenticationSupabase JWT with PKCE flow, auto-refresh via middleware
AuthorizationRow Level Security (RLS) on all 19 database tables
Agent BridgeShared secret (X-Agent-Secret header) + agent ID validation
Admin APISeparate admin secret (X-Admin-Secret header)
Stripe WebhooksHMAC-SHA256 signature verification
Outgoing WebhooksHMAC-SHA256 signature in X-Lobstack-Signature header
Agent IsolationDedicated VM per agent, loopback-only runtime binding
Agent RuntimeSandboxed mode, token auth, security audit on provision

Technology Stack#

CategoryTechnologyVersion
FrameworkNext.js16.1.6
UIReact19.2.3
StylingTailwind CSS4.x
AnimationFramer Motion12.x
LanguageTypeScript5.9.3
DatabaseSupabase (PostgreSQL)Latest
AuthSupabase AuthJWT + PKCE
PaymentsStripe20.3.1
AI RuntimeLobstack Agent Runtimev17
Tool ProtocolMCP (Model Context Protocol)1.25.3
HostingVercelServerless
ComputeHetzner CloudOn-demand dedicated VMs
ChartsD3.js7.9.0

Scaling & Reliability#

Lobstack is designed for horizontal scaling:

ComponentScaling Strategy
APIVercel serverless auto-scaling (per-request)
DatabaseSupabase managed PostgreSQL (vertical + read replicas)
Agent VMsOne dedicated VM per agent (horizontal by nature)
Health checksParallel batches of 10 agents, ~1 min for 100 agents
WebhooksFire-and-forget pattern, logged for retry
Memory extractionAsync background, rate-limited per agent (1/60s)

Want to dive deeper?

Check out the Security docs for encryption, Vault secrets, and compliance details. See Core Concepts for how the runtime, memory, and tools fit together.