Skip to main content
This guide covers deploying AFK agents to production environments, from single-container setups to distributed, multi-worker deployments.

Docker deployment

Basic Dockerfile

Production Dockerfile with multi-stage build

docker-compose.yml

Environment configuration

Required environment variables

Production configuration file

Create config/production.yaml:

Scaling patterns

Horizontal scaling with workers

Kubernetes deployment

Kubernetes HPA for auto-scaling

Health checks

Implement health endpoints in your server:

Database schema

SQLite (development)

SQLite requires no schema setup — tables are created automatically on first use.

PostgreSQL

Security checklist

1

Secrets management

Store API keys in secrets managers (AWS Secrets Manager, HashiCorp Vault, Kubernetes Secrets). Never commit keys to version control.
2

Network policies

Restrict traffic between services. Agents should only reach LLM providers and necessary databases.
3

Rate limiting

Configure rate limits on public endpoints to prevent abuse.
4

Cost limits

Always set max_total_cost_usd in FailSafeConfig for production agents.
5

Audit logging

Enable telemetry export to your logging infrastructure for compliance.

Monitoring

Key metrics to track:

Next steps

Observability

Set up telemetry and alerting for production monitoring.

Security Model

Security hardening checklist and best practices.

Evals

CI-gated quality checks for agent releases.

Building with AI

Production patterns and anti-patterns.