Production Deployment
Deploy AgentForge agents to production — state, monitoring, scaling, and best practices.
Checklist
Before deploying:
- Use
RedisStateStorefor persistent state - Configure
PgVectorMemoryStorefor long-term memory - Set budget limits on all agents
- Configure autonomy policy for sensitive tools
- Enable OpenTelemetry export
- Set up error alerting
- Test with
TestHarnessandMockLLM
State Persistence
Always use Redis in production:
import { RedisStateStore } from '@ahzan-agentforge/core';
const stateStore = new RedisStateStore({
url: process.env.REDIS_URL!,
prefix: 'prod:agentforge:',
ttl: 86400 * 30, // 30 days
});Budget Governance
Set sensible defaults:
budget: {
maxCostUsd: 2.00,
maxTokens: 200_000,
warnThreshold: 0.8,
},Observability
Export to your monitoring stack:
observability: {
enabled: true,
exporter: 'otlp',
endpoint: process.env.OTEL_ENDPOINT!,
},Error Handling
hooks: {
onError: async (error, source) => {
await alerting.send({
severity: source === 'framework' ? 'critical' : 'warning',
message: `AgentForge ${source} error: ${error.message}`,
});
},
},Scaling
- Use queue-backed execution (BullMQ) for high throughput
- Separate agent processes from your web server
- Scale Redis for state and queue workloads
- Use connection pooling for PostgreSQL
Next Steps
- Cost Control — managing costs
- Human-in-the-Loop — approval workflows