Why Self-Host?
Full Control
Host on your infrastructure. Your data and API keys never leave your network.
Scalable
Deploy multiple instances behind a load balancer as demand grows.
API Access
Expose agents via HTTP API for integration with other services.
Reproducible
Same container runs identically across machines. Share your setup with teammates.
Quick Start
Local Development
For local development, mount your credentials and workspace instead of using environment variables:agentuse auth login.
Run agents via exec:
Configuration
Environment Variables
At least one AI provider authentication is required. For Anthropic, use either
ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN.Using an Environment File
Restarts and Worker Memory
agentuse serve runs agents in per-project worker processes, and two behaviours matter when you put it behind pm2, systemd, or a container supervisor.
A restart releases workers rather than killing them. Runs already in flight keep going in the released worker and finish normally; only the daemon is replaced. A released worker still has a hard deadline, by default the longest in-flight run’s own timeout plus ten minutes of grace, tunable with AGENTUSE_RELEASE_BACKSTOP_SECONDS. Set AGENTUSE_RELEASE_WORKERS=0 if you want the old kill-on-shutdown behaviour instead.
Idle workers are recycled once they get heavy. A fresh worker peaks around 130MB of heap; after it has executed runs, that settles at roughly 350-450MB, which a long-lived daemon would otherwise hold forever. When an idle worker is above AGENTUSE_WORKER_RECYCLE_MB (default 300) it is retired through the same release path, so a replacement starts serving immediately. Recycling only happens while the worker is idle, and never within two minutes of it starting. Set AGENTUSE_WORKER_RECYCLE_MB=0 to disable it.
After a crash, settle the stragglers. If the host or the container died outright, sessions can be left marked running with no process behind them. agentuse serve sweeps these at startup, but only back 30 days:
Including Your Agents
Volume mount (best for development):Docker Compose
Extending the Base Image
Multi-arch Build
Production Deployment
Reverse Proxy with nginx
Rate limiting
Rate limiting
SSL certificates
SSL certificates
Troubleshooting
Container exits immediately
Container exits immediately
Check logs with
docker logs agentuse. Common causes: missing API keys, port already in use.Cannot connect to server
Cannot connect to server
The official image binds to
0.0.0.0 by default. If using a custom image, ensure:Agent file not found
Agent file not found
Check the volume mount with
docker exec -it agentuse ls /agents. Ensure API request paths match container paths.