docs/DEPLOYMENT_GUIDE.md
elizaOS agents can be deployed to a variety of platforms. This repository includes production-ready examples in the examples/ directory, with implementations in TypeScript, Python, and Rust for each deployment target.
The TypeScript runtime (AgentRuntime) is designed to run in both long-lived and serverless contexts.
| Platform | Directory | Languages | Runtime Type |
|---|---|---|---|
| Cloudflare Workers | examples/cloudflare/ | TypeScript, Rust (WASM), Python | Edge/Serverless |
| AWS Lambda | examples/aws/ | TypeScript, Python, Rust | Serverless |
| GCP Cloud Run | examples/gcp/ | TypeScript, Python, Rust | Container |
| Vercel | examples/vercel/ | TypeScript, Python, Rust (WASM) | Edge/Serverless |
| Supabase | examples/supabase/ | TypeScript, Rust (WASM) | Edge (Deno) |
| Local/CLI | examples/chat/ | TypeScript, Rust | Long-running |
Regardless of target, the pattern is:
name and optionally bio, system, settings, secrets.new AgentRuntime({ character, plugins: [...] })await runtime.initialize({ skipMigrations?: boolean })runtime.ensureConnection(...) so entities/rooms/worlds exist.Memory (often with createMessageMemory(...)) and call runtime.messageService.handleMessage(runtime, message, callback)Location: examples/cloudflare/
Cloudflare Workers provide globally distributed edge compute with sub-millisecond cold starts.
cd examples/cloudflare
bun install
# Set API key for local dev
export OPENAI_API_KEY=your_key_here
# Start local dev server
bun run dev
# Set secret (first time only)
wrangler secret put OPENAI_API_KEY
# Deploy
wrangler deploy
| Language | Directory | Port | Notes |
|---|---|---|---|
| TypeScript | ./ (root) | 8787 | Primary, with streaming |
| Rust | ./rust-worker/ | 8788 | High-performance WASM |
| Python | ./python-worker/ | 8789 | Beta support |
POST /chat, POST /chat/stream)wrangler.tomlwrangler.tomlSee examples/cloudflare/README.md for complete documentation.
Location: examples/aws/
Deploy agents as serverless functions with AWS Lambda and API Gateway.
cd examples/aws
bun install
# Deploy using AWS SAM
sam build
sam deploy --guided
| Language | Directory | Runtime |
|---|---|---|
| TypeScript | typescript/ | Node.js 20 |
| Python | python/ | Python 3.11 |
| Rust | rust/ | provided.al2 (cargo-lambda) |
examples/aws/
├── template.yaml # SAM template
├── samconfig.toml # SAM configuration
├── scripts/deploy.sh # Deployment script
├── typescript/handler.ts
├── python/handler.py
├── rust/src/lib.rs
└── test-client.ts # Test client
The examples use a singleton runtime reused across invocations to reduce cold-start overhead:
let runtime: AgentRuntime | null = null;
async function initializeRuntime() {
if (!runtime) {
runtime = new AgentRuntime({ character, plugins });
await runtime.initialize();
}
return runtime;
}
See examples/aws/README.md for complete documentation.
Location: examples/gcp/
Deploy containerized agents to Google Cloud Run with automatic scaling.
cd examples/gcp
# Build and deploy TypeScript version
./deploy.sh typescript
# Or use Cloud Build
gcloud builds submit --config cloudbuild.yaml
| Language | Directory | Dockerfile |
|---|---|---|
| TypeScript | typescript/ | typescript/Dockerfile |
| Python | python/ | python/Dockerfile |
| Rust | rust/ | rust/Dockerfile |
Terraform configuration is provided:
cd terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your values
terraform init
terraform apply
# Build stage
FROM node:20-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:20-slim
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
CMD ["node", "dist/handler.js"]
See examples/gcp/README.md for complete documentation.
Location: examples/vercel/
Deploy to Vercel's global edge network with automatic deployments from Git.
cd examples/vercel
bun install
# Deploy
vercel deploy
| Language | Directory | Runtime |
|---|---|---|
| TypeScript | typescript/ | Edge Runtime |
| Python | python/ | Serverless Function |
| Rust | rust/ | Edge Runtime (WASM) |
See examples/vercel/README.md for complete documentation.
Location: examples/supabase/
Deploy to Supabase's Deno-based edge runtime.
cd examples/supabase
# Deploy
supabase functions deploy elizaos-agent
| Language | Directory | Notes |
|---|---|---|
| TypeScript | typescript/ | Native Deno support |
| Rust | rust/ | WASM compiled |
Note: Python is not supported (Supabase uses Deno runtime).
See examples/supabase/README.md for complete documentation.
Location: examples/chat/
Run agents locally for development and testing.
cd examples/chat/typescript
bun install
bun run chat.ts
cd examples/chat/rust-wasm
bun install
bun run chat.ts # Uses WASM-compiled Rust
Secrets/config are accessed through runtime.getSetting(...) and/or character settings/secrets. In the TypeScript runtime initialization, persisted settings from the database are merged back into the runtime's character (see AgentRuntime.initialize() in packages/typescript/src/runtime.ts).
wrangler secret put| Variable | Description |
|---|---|
OPENAI_API_KEY | OpenAI API key |
OPENAI_BASE_URL | Custom OpenAI-compatible endpoint |
OPENAI_MODEL | Model to use (e.g., gpt-5) |
CHARACTER_NAME | Agent character name |
CHARACTER_BIO | Agent biography |
CHARACTER_SYSTEM | System prompt |
The TypeScript runtime requires a database adapter at initialization. For serverless deployments:
// Skip migrations for faster cold starts
await runtime.initialize({ skipMigrations: true });
| Platform | Recommended Database |
|---|---|
| Cloudflare | Cloudflare D1, KV, or Durable Objects |
| AWS Lambda | DynamoDB, Aurora Serverless, or RDS |
| GCP | Cloud SQL, Firestore, or Spanner |
| Vercel | Vercel Postgres, Planetscale, or Neon |
| Supabase | Supabase Postgres (built-in) |
For containerized deployments (Kubernetes, ECS, Cloud Run, etc.), use the Dockerfiles in examples/gcp/ as templates.
# Stage 1: Build
FROM node:20-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Stage 2: Production
FROM node:20-slim
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 8080
CMD ["node", "dist/handler.js"]
The examples/ directory contains many more deployment scenarios:
| Example | Description |
|---|---|
examples/discord/ | Discord bot deployment |
examples/telegram/ | Telegram bot deployment |
examples/twitter-xai/ | Twitter/X integration |
examples/next/ | Next.js web application |
examples/react/ | React frontend integration |
examples/rest-api/ | REST API servers (Express, Hono, etc.) |
examples/app/ | Desktop apps (Electron, Tauri) |
The elizaos package in this repo is an example scaffolder (commands: create, info, version) located at packages/elizaos/.
Use it to copy an example project into a new directory, then follow that example's package.json scripts (for instance, the chat example uses bun run chat.ts).
README.mdexamples/ for the most up-to-date deployment patternsARCHITECTURE.md for runtime internalsCORE_CONCEPTS.md for conceptual overview