home / skills / dexploarer / hyper-forge / deployment-helper

deployment-helper skill

/.claude/skills/deployment-helper

This skill deploys elizaOS agents to production with Docker, monitoring, and scaling guidance for reliable, scalable deployments.

npx playbooks add skill dexploarer/hyper-forge --skill deployment-helper

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.4 KB
---
name: deployment-helper
description: Deploy elizaOS agents to production with best practices, monitoring, and scaling. Triggers on "deploy agent", "production setup", or "deploy elizaOS"
allowed-tools: [Write, Read, Bash]
---

# Deployment Helper Skill

Production deployment configurations for elizaOS agents with Docker, monitoring, and scaling.

## Deployment Patterns

### 1. Single Agent Deployment

```typescript
// src/index.ts
import { AgentRuntime } from '@elizaos/core';
import { PGAdapter } from '@elizaos/adapter-postgresql';
import character from './character';

const runtime = new AgentRuntime({
  databaseAdapter: new PGAdapter(process.env.DATABASE_URL),
  character,
  env: process.env
});

await runtime.initialize();

// Health check endpoint
app.get('/health', (req, res) => {
  res.json({
    status: 'healthy',
    agent: character.name,
    uptime: process.uptime()
  });
});

// Graceful shutdown
process.on('SIGTERM', async () => {
  await runtime.stop();
  process.exit(0);
});
```

### 2. Docker Deployment

```dockerfile
# Dockerfile
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .
RUN npm run build

EXPOSE 3000

CMD ["npm", "start"]
```

```yaml
# docker-compose.yml
version: '3.8'

services:
  agent:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgresql://user:pass@db:5432/eliza
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    depends_on:
      - db
      - redis
    restart: unless-stopped

  db:
    image: postgres:15
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=eliza
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=pass

  redis:
    image: redis:7-alpine
    volumes:
      - redisdata:/data

volumes:
  pgdata:
  redisdata:
```

### 3. Multi-Agent Deployment

```typescript
// agents/coordinator.ts
const agents = [
  { character: agent1, id: 'agent-1' },
  { character: agent2, id: 'agent-2' },
  { character: agent3, id: 'agent-3' }
];

const runtimes = await Promise.all(
  agents.map(async ({ character, id }) => {
    const runtime = new AgentRuntime({
      databaseAdapter: new PGAdapter(DATABASE_URL),
      character,
      env: process.env
    });
    await runtime.initialize();
    return { id, runtime };
  })
);

// Load balancing
function selectAgent(message: string): AgentRuntime {
  const hash = hashCode(message);
  const index = hash % runtimes.length;
  return runtimes[index].runtime;
}
```

## Monitoring

```typescript
// Metrics collection
import { collectDefaultMetrics, register, Counter, Histogram } from 'prom-client';

collectDefaultMetrics();

const messageCounter = new Counter({
  name: 'agent_messages_total',
  help: 'Total messages processed',
  labelNames: ['agent', 'status']
});

const responseTime = new Histogram({
  name: 'agent_response_duration_seconds',
  help: 'Response time',
  buckets: [0.1, 0.5, 1, 2, 5]
});

// Metrics endpoint
app.get('/metrics', async (req, res) => {
  res.set('Content-Type', register.contentType);
  res.end(await register.metrics());
});
```

## Production Checklist

- [ ] Environment variables configured
- [ ] Database migrations run
- [ ] Health check endpoint working
- [ ] Monitoring configured
- [ ] Logging setup
- [ ] Error tracking (Sentry)
- [ ] Rate limiting enabled
- [ ] HTTPS configured
- [ ] Secrets secured
- [ ] Backup strategy
- [ ] Scaling plan
- [ ] Rollback procedure

Overview

This skill helps deploy elizaOS agents to production with practical patterns for single-agent, multi-agent, and containerized setups. It bundles guidance for health checks, graceful shutdowns, metrics, and common production checklist items. Use it to get a reliable, observable, and scalable deployment pipeline for TypeScript-based elizaOS agents.

How this skill works

The skill inspects runtime configuration and provides runnable patterns: a minimal single-agent runtime, Docker and docker-compose manifests, and a coordinator for multi-agent deployments with simple load distribution. It also integrates Prometheus-style metrics collection endpoints and shows how to implement health checks and graceful shutdown. Finally, it lists a production checklist covering migrations, monitoring, secrets, backups, and rollback planning.

When to use it

  • Deploy a single elizaOS agent to production with a minimal footprint.
  • Run multiple agents on one host or coordinate per-request routing and basic load distribution.
  • Containerize agents with Docker and orchestrate dependencies like Postgres and Redis.
  • Add observability: expose /metrics and health endpoints for monitoring and readiness checks.
  • Prepare for production readiness audits and operational handoffs.

Best practices

  • Expose a /health endpoint and implement graceful shutdown on SIGTERM to avoid in-flight truncation.
  • Use a managed database and run migrations before startup; keep connection strings in environment variables.
  • Collect metrics via prom-client and expose /metrics for scraping by Prometheus.
  • Run agents in Docker with restart policies and separate services for DB and cache; persist volumes for stateful services.
  • Implement logging, error tracking (e.g., Sentry), rate limiting, HTTPS, secrets management, and a tested rollback plan.

Example use cases

  • Single-agent API for a game asset generation microservice behind a load balancer.
  • Docker-compose local staging environment with Postgres and Redis to mirror production.
  • Multi-agent coordinator that shards requests across character-specific runtimes for parallelism.
  • Add Prometheus metrics to track messages processed and response latency for SLOs.
  • Operational checklist automation to validate environment variables, migrations, and backups before deploy.

FAQ

How do I scale beyond a single host?

Use container orchestration (Kubernetes, ECS) to run multiple agent replicas, place a load balancer in front, and share state via managed Postgres/Redis. Consider sharding characters across pods for horizontal scaling.

What monitoring should I prioritize first?

Start with health checks, metrics for request count and response latency, and centralized logging. Add error tracking and alerting for high error rates or slow responses before expanding to detailed traces.