Skip to content

Local Deployment Overview

ERA Agent can run locally on your machine in multiple modes, giving you full control over code execution in isolated sandboxes. This is ideal for development, testing, or self-hosted deployments.

ERA Agent supports several local deployment modes:

Connect Claude Desktop directly to ERA Agent for AI-powered code execution.

Terminal window
./agent mcp

Use Cases:

  • Execute code through Claude’s natural language interface
  • Create and manage persistent sessions via Claude
  • Let Claude write and test code in multiple languages
  • File operations and multi-step workflows

Learn More: MCP Server Setup

Run ERA Agent as an HTTP API server.

Terminal window
./agent serve
# or
AGENT_MODE=http ./agent

Use Cases:

  • Integrate with your existing applications
  • Build custom frontends or automation tools
  • RESTful API access to all ERA Agent features
  • Self-hosted alternative to Cloudflare Workers deployment

Learn More: HTTP Server Mode

Direct command-line execution for quick testing and automation.

Terminal window
./agent vm create --language python
./agent vm run --vm <id> --cmd "python script.py"

Use Cases:

  • Quick code testing and debugging
  • Shell scripts and automation
  • CI/CD integration
  • Manual session management

Learn More: CLI Usage

Package ERA Agent in a Docker container for easy deployment.

Terminal window
docker build -t era-agent .
docker run -p 8787:8787 era-agent

Use Cases:

  • Consistent deployment across environments
  • Easy scaling and orchestration
  • Isolated runtime environment
  • Cloud deployment (AWS, GCP, Azure, etc.)

Learn More: Docker Deployment

ERA Agent uses Firecracker microVMs for secure code execution:

  • Linux: Native Firecracker support
  • macOS: Firecracker runs inside Docker
  • Windows: Firecracker via WSL2 or Docker

Each code execution runs in a completely isolated VM with:

  • Dedicated CPU and memory resources
  • Network isolation (disabled by default)
  • Filesystem isolation
  • Automatic cleanup after execution
┌─────────────────────────────────────────┐
│ ERA Agent (Go Binary) │
├─────────────────────────────────────────┤
│ • CLI Interface │
│ • HTTP Server │
│ • MCP Server (stdio) │
├─────────────────────────────────────────┤
│ VM Service Layer │
│ • Session management │
│ • VM lifecycle control │
│ • State persistence │
├─────────────────────────────────────────┤
│ Firecracker VMs │
│ Python │ Node.js │ Go │ TypeScript │
└─────────────────────────────────────────┘
  • Go 1.21+ - For building the agent binary
  • Docker (macOS/Windows) or Firecracker (Linux) - For running code sandboxes
  • Claude Desktop - For MCP server integration
  • jq - For JSON processing in examples
  • Docker Compose - For orchestrated deployments
Terminal window
git clone https://github.com/yourusername/era-agent
cd era-agent
Terminal window
go build -o agent
Terminal window
./agent --help

You should see the help output with available commands.

macOS:

Terminal window
# Install and start Docker Desktop
brew install --cask docker
# Start Docker Desktop from Applications

Linux:

Terminal window
# Install Firecracker
# See: https://github.com/firecracker-microvm/firecracker/blob/main/docs/getting-started.md
# Verify KVM access
ls -l /dev/kvm
# Should show: crw-rw---- 1 root kvm ...
# Add your user to kvm group
sudo usermod -aG kvm $USER

Windows:

Terminal window
# Install Docker Desktop with WSL2 backend
# See: https://docs.docker.com/desktop/install/windows-install/

Create a test Python script:

Terminal window
echo 'print("Hello from ERA Agent!")' > test.py

Execute it:

Terminal window
# Using CLI
./agent vm create --language python
./agent vm run --vm <vm-id> --file test.py
# Using HTTP server
./agent serve &
curl -X POST http://localhost:8787/api/execute \
-H "Content-Type: application/json" \
-d '{
"code": "print(\"Hello from ERA Agent!\")",
"language": "python"
}'

Control agent behavior with environment variables:

Terminal window
# Operation mode
export AGENT_MODE=http # Run as HTTP server
# HTTP server settings
export PORT=8787 # Server port (default: 8787)
# Logging
export AGENT_LOG_LEVEL=debug # debug, info, warn, error
# Storage
export AGENT_STATE_DIR=/custom/path/to/state

For persistent configuration, create .env:

Terminal window
AGENT_MODE=http
PORT=8787
AGENT_LOG_LEVEL=info
AGENT_STATE_DIR=/var/lib/era-agent

Then run:

Terminal window
source .env
./agent

All deployment modes support the same languages:

LanguageVersionNotes
Python3.11+pip, venv support
Node.js20+npm, package.json support
TypeScript5.0+Automatic transpilation
Go1.21+go.mod support
Deno1.40+TypeScript, imports from URLs
FeatureCloudflare WorkersLocal Deployment
SetupZero configRequires Go + Docker/Firecracker
ScalingAutomaticManual
CostPay per useFree (your hardware)
LatencyGlobal edgeLocal (fastest)
PrivacyData goes to CloudflareEverything stays local
CustomizationLimitedFull control
IntegrationHTTP APIHTTP API + CLI + MCP
Best ForProduction appsDevelopment, testing, self-hosted
  • All code runs in isolated Firecracker VMs
  • Network access disabled by default
  • Filesystem isolation per session
  • Resource limits (CPU, memory, timeout)

By default, network access is disabled. Enable only when necessary:

Terminal window
# CLI
./agent vm create --language python --network allow_all
# HTTP API
{
"language": "python",
"network_mode": "allow_all"
}

Session data and VM state stored in:

  • Linux: /var/lib/era-agent
  • macOS: ~/Library/Application Support/era-agent
  • Custom: Set AGENT_STATE_DIR

Ensure proper permissions:

Terminal window
chmod 700 $AGENT_STATE_DIR

Adjust CPU and memory per session:

Terminal window
./agent vm create \
--language python \
--cpu 2 \
--mem 512

ERA Agent can handle multiple concurrent sessions. Monitor with:

Terminal window
./agent vm list

Containers sleep after inactivity to save resources:

{
"sleepAfter": 5, // seconds of inactivity
"language": "python"
}

Enable debug logging:

Terminal window
AGENT_LOG_LEVEL=debug ./agent serve

Log output includes:

  • Request/response details
  • VM lifecycle events
  • Execution timing
  • Error stack traces

Monitor agent health:

Terminal window
# List active sessions
./agent vm list
# Check specific session
./agent vm get --vm <id>

Problem: Docker or Firecracker not running

Solution:

  • macOS: Start Docker Desktop
  • Linux: Check Firecracker installation and KVM access

Problem: Execution timeout

Solution:

Terminal window
# Increase timeout
./agent vm run --vm <id> --cmd "..." --timeout 60
# Or set default for session
{
"language": "python",
"default_timeout": 60
}

Problem: Port 8787 in use

Solution:

Terminal window
PORT=9000 ./agent serve

Choose your deployment mode: