Put AI coworkers in your Discord server. Each one has a role, its own workspace and its own tools.
You message an agent the way you would message a teammate. It reads the request, works in its own folder (files, git, shell commands), and replies in the channel. Each agent's role and rules live in one plain text file, so changing how it behaves means editing a document, not code. A web dashboard shows which agents are online and how many tasks each has handled.
Every agent runs in its own Docker container, so one agent's workspace is separate from the next.
Built with TypeScript, the Anthropic TypeScript SDK (Claude Messages API), Redis, Docker and a React dashboard.
- Features
- Architecture
- Project Structure
- Quick Start
- Usage
- Development
- API Endpoints
- Security model
- Deployment
- Troubleshooting
- Architecture Details
- Contributing
- License
- Credits
- Multiple agents: run several specialized agents side by side, each with its own role, prompt and tools. Agents work independently and do not message each other.
- Discord Integration, each agent runs as a Discord bot, responding to mentions and direct messages.
- Real-time Monitoring, live dashboard showing agent status, metrics, and activity logs.
- Containerized Deployment, Docker-based architecture for easy scaling and isolation.
- Redis state: each agent writes its status and metrics to Redis and publishes its activity on a pub/sub channel that the dashboard reads.
- TypeScript, fully typed codebase for reliability and maintainability.
┌─────────────────────────────────────────────────────────────┐
│ React Dashboard │
│ (Real-time WebSocket + REST API for metrics) │
└──────────────────────┬──────────────────────────────────────┘
│
┌────────▼─────────┐
│ Metrics API │
│ (Express + WS) │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Redis │
│ Pub/Sub + KV │
└────────┬─────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌────▼────┐ ┌────▼────┐ ┌────▼────┐
│ Agent │ │ Agent │ │ Agent │
│ Backend │ │ DevOps │ │Frontend │
└────┬────┘ └────┬────┘ └────┬────┘
│ │ │
└──────────────┼──────────────┘
│
┌────────▼─────────┐
│ Discord │
└──────────────────┘
agentbase/
├── backend/
│ ├── src/
│ │ ├── agent.ts # Main agent wrapper class
│ │ ├── config-parser.ts # YAML config parser
│ │ ├── metrics-api.ts # Express + WebSocket API
│ │ └── index.ts # Agent entrypoint
│ ├── examples/
│ │ └── dev-workforce/
│ │ ├── agent-backend/ # Senior backend engineer
│ │ ├── agent-devops/ # Senior DevOps engineer
│ │ ├── agent-frontend/ # Senior frontend engineer
│ │ └── dev-workforce.yaml # Team configuration
│ ├── Dockerfile
│ ├── Dockerfile.metrics
│ ├── docker-compose.yml
│ └── package.json
├── dashboard/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom hooks
│ │ ├── App.tsx # Main app component
│ │ └── main.tsx # Entry point
│ ├── package.json
│ └── vite.config.ts
└── README.md
- Node.js 20+
- Docker and Docker Compose
- Discord bot tokens (one per agent)
- Anthropic API keys (one per agent)
- Go to the Discord Developer Portal.
- Create 3 applications (
backend,devops,frontend). - For each application:
- Open the Bot section and click Add Bot.
- Copy the bot token.
- Enable Message Content Intent under Privileged Gateway Intents.
- Go to OAuth2 → URL Generator.
- Select the
botscope and theSend MessagesandRead Messages/View Channelspermissions. - Use the generated URL to invite the bot to your server.
cd backend
cp .env.example .envEdit .env and add your API keys and bot tokens:
BACKEND_API_KEY=sk-ant-api03-your-backend-key
BACKEND_DISCORD_TOKEN=your-backend-bot-token
DEVOPS_API_KEY=sk-ant-api03-your-devops-key
DEVOPS_DISCORD_TOKEN=your-devops-bot-token
FRONTEND_API_KEY=sk-ant-api03-your-frontend-key
FRONTEND_DISCORD_TOKEN=your-frontend-bot-tokencd backend
# Install dependencies
npm install
# Start with Docker Compose
docker-compose up --buildThis will start:
| Service | Port |
|---|---|
| Redis | 6379 |
| Agent Backend | n/a |
| Agent DevOps | n/a |
| Agent Frontend | n/a |
| Metrics API | 3001 |
cd dashboard
# Install dependencies
npm install
# Start development server
npm run devThe dashboard will be available at http://localhost:5173.
In Discord, mention an agent or send it a direct message:
@backend Design a REST endpoint for user auth.
@devops Help me set up a CI/CD pipeline.
@frontend What's the best way to optimize this React component?
Each agent has its own system prompt at backend/examples/dev-workforce/agent-{name}/CLAUDE.md. Edit these files to customize agent behavior.
-
Create a new directory:
backend/examples/dev-workforce/agent-{name}/. -
Add a
CLAUDE.mdfile with the system prompt. -
Add the agent to
dev-workforce.yaml:agents: - name: "yourname" config_path: "examples/dev-workforce/agent-yourname" env: ANTHROPIC_API_KEY: "${YOURNAME_API_KEY}" DISCORD_BOT_TOKEN: "${YOURNAME_DISCORD_TOKEN}" volumes: workspace: "/agent-workspace"
-
Add the agent service to
docker-compose.yml(or regenerate using the config parser). -
Update your
.envfile with the new credentials.
cd backend
# Build TypeScript
npm run build
# Run in development mode
npm run dev
# Run metrics API separately
npm run metricscd dashboard
# Start dev server with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| GET | /api/metrics |
Get all agent metrics |
| GET | /api/metrics/:agentId |
Get specific agent metrics |
| GET | /api/stats |
Get system statistics |
| WS | ws://localhost:3001 |
Real-time updates |
{
"totalAgents": 3,
"activeAgents": 3,
"agents": [
{
"agentId": "backend",
"status": "online",
"uptime": "2h 15m",
"tasksCompleted": 42,
"cpu": 12.5,
"memory": 35.8,
"lastUpdated": 1703123456789
}
],
"timestamp": 1703123456789
}cpu and memory are process-level measurements taken inside each agent container. cpu is the percent of one CPU core the agent process used between the last two metric samples, derived from process.cpuUsage() over elapsed wall time. memory is the agent process resident set size as a percent of the total memory the container sees.
Agents execute shell commands and git operations requested through Discord, inside their own container and workspace volume. Anyone who can message the bot can make it run commands as the agent. Run AgentBase only in a private server with members you trust, and give each agent credentials scoped to what it actually needs.
Limits that exist today:
- Path guard, the file tools (
read_file,write_file,list_directory) and the git and shell working directories resolve inside the agent's workspace, and paths that escape it are rejected. - Exec timeout,
bash_commandis killed afterBASH_TIMEOUT_MSmilliseconds (default 60000). - Turn cap, each message stops after
MAX_TOOL_TURNStool turns (default 25), and the agent says so in the channel. - Container isolation, each agent runs in its own container with its own workspace volume, so one agent's files are separate from the next.
There is no command allowlist and no sandbox inside the container. A command the agent runs can reach the network and anything else the container can reach.
- Backend, deploy to any Docker-compatible platform (AWS ECS, Fly.io, Railway, etc.).
- Dashboard, deploy to Vercel, Netlify, or any static hosting.
- Redis, use a managed Redis service (Upstash, Redis Cloud, AWS ElastiCache).
For production, update docker-compose.yml and environment variables accordingly.
Agents not connecting to Discord
- Verify bot tokens are correct.
- Ensure Message Content Intent is enabled in the Discord Developer Portal.
- Check that bots are invited to your server.
Dashboard not showing metrics
- Ensure the Metrics API is running on port
3001. - Check CORS settings in
metrics-api.ts. - Verify Redis is accessible.
WebSocket connection failed
- Check firewall settings.
- Ensure
WS_URLin the dashboard.envis correct. - Verify the Metrics API is running.
- Agent initializes with the system prompt from
CLAUDE.md. - Connects to Redis to report status, metrics and activity.
- Logs into Discord.
- Starts metrics reporting (every 10 seconds).
- Listens for Discord messages.
- Processes messages via the Claude API.
- Publishes activity to Redis.
- Updates metrics in Redis.
- Agents publish metrics to Redis (
agent:{id}:activity). - Agents publish activities to Redis pub/sub (
agent-activity). - Metrics API subscribes to Redis channels.
- Metrics API broadcasts to WebSocket clients.
- Dashboard receives real-time updates.
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT
Built with: