@desplega.ai/agent-swarm 1.2.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +20 -1
- package/.dockerignore +3 -0
- package/.env.docker.example +22 -1
- package/.env.example +17 -0
- package/.github/workflows/docker-publish.yml +92 -0
- package/CONTRIBUTING.md +270 -0
- package/DEPLOYMENT.md +391 -0
- package/Dockerfile.worker +29 -1
- package/FAQ.md +19 -0
- package/LICENSE +21 -0
- package/MCP.md +249 -0
- package/README.md +105 -185
- package/assets/agent-swarm-logo-orange.png +0 -0
- package/assets/agent-swarm-logo.png +0 -0
- package/assets/agent-swarm.png +0 -0
- package/deploy/docker-push.ts +30 -0
- package/docker-compose.example.yml +137 -0
- package/docker-entrypoint.sh +223 -7
- package/package.json +13 -4
- package/{cc-plugin → plugin}/.claude-plugin/plugin.json +1 -1
- package/plugin/README.md +1 -0
- package/plugin/agents/.gitkeep +0 -0
- package/plugin/agents/codebase-analyzer.md +143 -0
- package/plugin/agents/codebase-locator.md +122 -0
- package/plugin/agents/codebase-pattern-finder.md +227 -0
- package/plugin/agents/web-search-researcher.md +109 -0
- package/plugin/commands/create-plan.md +415 -0
- package/plugin/commands/implement-plan.md +89 -0
- package/plugin/commands/research.md +200 -0
- package/plugin/commands/start-leader.md +101 -0
- package/plugin/commands/start-worker.md +56 -0
- package/plugin/commands/swarm-chat.md +78 -0
- package/plugin/commands/todos.md +66 -0
- package/plugin/commands/work-on-task.md +44 -0
- package/plugin/skills/.gitkeep +0 -0
- package/scripts/generate-mcp-docs.ts +415 -0
- package/slack-manifest.json +69 -0
- package/src/be/db.ts +1431 -25
- package/src/cli.tsx +135 -11
- package/src/commands/lead.ts +13 -0
- package/src/commands/runner.ts +255 -0
- package/src/commands/setup.tsx +5 -5
- package/src/commands/worker.ts +8 -220
- package/src/hooks/hook.ts +108 -14
- package/src/http.ts +361 -5
- package/src/prompts/base-prompt.ts +131 -0
- package/src/server.ts +56 -0
- package/src/slack/app.ts +73 -0
- package/src/slack/commands.ts +88 -0
- package/src/slack/handlers.ts +281 -0
- package/src/slack/index.ts +3 -0
- package/src/slack/responses.ts +175 -0
- package/src/slack/router.ts +170 -0
- package/src/slack/types.ts +20 -0
- package/src/slack/watcher.ts +119 -0
- package/src/tools/create-channel.ts +80 -0
- package/src/tools/get-tasks.ts +54 -21
- package/src/tools/join-swarm.ts +28 -4
- package/src/tools/list-channels.ts +37 -0
- package/src/tools/list-services.ts +110 -0
- package/src/tools/poll-task.ts +47 -3
- package/src/tools/post-message.ts +87 -0
- package/src/tools/read-messages.ts +192 -0
- package/src/tools/register-service.ts +118 -0
- package/src/tools/send-task.ts +80 -7
- package/src/tools/store-progress.ts +9 -3
- package/src/tools/task-action.ts +211 -0
- package/src/tools/unregister-service.ts +110 -0
- package/src/tools/update-profile.ts +105 -0
- package/src/tools/update-service-status.ts +118 -0
- package/src/types.ts +110 -3
- package/src/utils/pretty-print.ts +224 -0
- package/thoughts/shared/plans/.gitkeep +0 -0
- package/thoughts/shared/plans/2025-12-18-inverse-teleport.md +1142 -0
- package/thoughts/shared/plans/2025-12-18-slack-integration.md +1195 -0
- package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +732 -0
- package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +361 -0
- package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +501 -0
- package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +560 -0
- package/thoughts/shared/research/.gitkeep +0 -0
- package/thoughts/shared/research/2025-12-18-slack-integration.md +442 -0
- package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +339 -0
- package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +390 -0
- package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +376 -0
- package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +264 -0
- package/tsconfig.json +3 -1
- package/ui/bun.lock +692 -0
- package/ui/index.html +22 -0
- package/ui/package.json +32 -0
- package/ui/pnpm-lock.yaml +3034 -0
- package/ui/postcss.config.js +6 -0
- package/ui/public/logo.png +0 -0
- package/ui/src/App.tsx +43 -0
- package/ui/src/components/ActivityFeed.tsx +415 -0
- package/ui/src/components/AgentDetailPanel.tsx +534 -0
- package/ui/src/components/AgentsPanel.tsx +549 -0
- package/ui/src/components/ChatPanel.tsx +1820 -0
- package/ui/src/components/ConfigModal.tsx +232 -0
- package/ui/src/components/Dashboard.tsx +534 -0
- package/ui/src/components/Header.tsx +168 -0
- package/ui/src/components/ServicesPanel.tsx +612 -0
- package/ui/src/components/StatsBar.tsx +288 -0
- package/ui/src/components/StatusBadge.tsx +124 -0
- package/ui/src/components/TaskDetailPanel.tsx +807 -0
- package/ui/src/components/TasksPanel.tsx +575 -0
- package/ui/src/hooks/queries.ts +170 -0
- package/ui/src/index.css +235 -0
- package/ui/src/lib/api.ts +161 -0
- package/ui/src/lib/config.ts +35 -0
- package/ui/src/lib/theme.ts +214 -0
- package/ui/src/lib/utils.ts +48 -0
- package/ui/src/main.tsx +32 -0
- package/ui/src/types/api.ts +164 -0
- package/ui/src/vite-env.d.ts +1 -0
- package/ui/tailwind.config.js +35 -0
- package/ui/tsconfig.json +31 -0
- package/ui/vite.config.ts +22 -0
- package/cc-plugin/README.md +0 -49
- package/cc-plugin/commands/setup-leader.md +0 -73
- package/cc-plugin/commands/start-worker.md +0 -64
- package/docker-compose.worker.yml +0 -35
- package/example-req-meta.json +0 -24
- /package/{cc-plugin → plugin}/hooks/hooks.json +0 -0
package/MCP.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# MCP Tools Reference
|
|
2
|
+
|
|
3
|
+
> Auto-generated from source. Do not edit manually.
|
|
4
|
+
> Run `bun run docs:mcp` to regenerate.
|
|
5
|
+
|
|
6
|
+
## Table of Contents
|
|
7
|
+
|
|
8
|
+
- [Core Tools](#core-tools)
|
|
9
|
+
- [join-swarm](#join-swarm)
|
|
10
|
+
- [poll-task](#poll-task)
|
|
11
|
+
- [get-swarm](#get-swarm)
|
|
12
|
+
- [get-tasks](#get-tasks)
|
|
13
|
+
- [send-task](#send-task)
|
|
14
|
+
- [get-task-details](#get-task-details)
|
|
15
|
+
- [store-progress](#store-progress)
|
|
16
|
+
- [my-agent-info](#my-agent-info)
|
|
17
|
+
- [Task Pool Tools](#task-pool-tools)
|
|
18
|
+
- [task-action](#task-action)
|
|
19
|
+
- [Messaging Tools](#messaging-tools)
|
|
20
|
+
- [list-channels](#list-channels)
|
|
21
|
+
- [create-channel](#create-channel)
|
|
22
|
+
- [post-message](#post-message)
|
|
23
|
+
- [read-messages](#read-messages)
|
|
24
|
+
- [Profiles Tools](#profiles-tools)
|
|
25
|
+
- [update-profile](#update-profile)
|
|
26
|
+
- [Services Tools](#services-tools)
|
|
27
|
+
- [register-service](#register-service)
|
|
28
|
+
- [unregister-service](#unregister-service)
|
|
29
|
+
- [list-services](#list-services)
|
|
30
|
+
- [update-service-status](#update-service-status)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Core Tools
|
|
35
|
+
|
|
36
|
+
*Always available tools for basic swarm operations.*
|
|
37
|
+
|
|
38
|
+
### join-swarm
|
|
39
|
+
|
|
40
|
+
**Join the agent swarm**
|
|
41
|
+
|
|
42
|
+
Tool for an agent to join the swarm of agents with optional profile information.
|
|
43
|
+
|
|
44
|
+
| Parameter | Type | Required | Default | Description |
|
|
45
|
+
|-----------|------|----------|---------|-------------|
|
|
46
|
+
| `lead` | `boolean` | No | false | Whether this agent should be the lead. |
|
|
47
|
+
| `name` | `string` | Yes | - | The name of the agent joining the swarm. |
|
|
48
|
+
| `description` | `string` | No | - | Agent description. |
|
|
49
|
+
|
|
50
|
+
### poll-task
|
|
51
|
+
|
|
52
|
+
**Poll for a task**
|
|
53
|
+
|
|
54
|
+
Poll for a new task assignment. Returns immediately if there are offered tasks awaiting accept/reject. Also returns count of unassigned tasks in the pool.
|
|
55
|
+
|
|
56
|
+
*No parameters*
|
|
57
|
+
|
|
58
|
+
### get-swarm
|
|
59
|
+
|
|
60
|
+
**Get the agent swarm**
|
|
61
|
+
|
|
62
|
+
Returns a list of agents in the swarm without their tasks.
|
|
63
|
+
|
|
64
|
+
| Parameter | Type | Required | Default | Description |
|
|
65
|
+
|-----------|------|----------|---------|-------------|
|
|
66
|
+
| `a` | `string` | No | - | - |
|
|
67
|
+
|
|
68
|
+
### get-tasks
|
|
69
|
+
|
|
70
|
+
**Get tasks**
|
|
71
|
+
|
|
72
|
+
Returns a list of tasks in the swarm with various filters. Sorted by priority (desc) then lastUpdatedAt (desc).
|
|
73
|
+
|
|
74
|
+
| Parameter | Type | Required | Default | Description |
|
|
75
|
+
|-----------|------|----------|---------|-------------|
|
|
76
|
+
| `mineOnly` | `boolean` | No | - | Only return tasks assigned to you. |
|
|
77
|
+
| `unassigned` | `boolean` | No | - | Only return unassigned tasks in the pool. |
|
|
78
|
+
| `readyOnly` | `boolean` | No | - | Only return tasks whose dependencies are met. |
|
|
79
|
+
| `taskType` | `string` | No | - | Filter by task type (e.g., 'bug', 'feature |
|
|
80
|
+
| `tags` | `array` | No | - | Filter by any matching tag. |
|
|
81
|
+
| `search` | `string` | No | - | Search in task description. |
|
|
82
|
+
|
|
83
|
+
### send-task
|
|
84
|
+
|
|
85
|
+
**Send a task**
|
|
86
|
+
|
|
87
|
+
Sends a task to a specific agent, creates an unassigned task for the pool, or offers a task for acceptance.
|
|
88
|
+
|
|
89
|
+
| Parameter | Type | Required | Default | Description |
|
|
90
|
+
|-----------|------|----------|---------|-------------|
|
|
91
|
+
| `task` | `string` | Yes | - | The task description to send. |
|
|
92
|
+
| `dependsOn` | `array` | No | - | Task IDs this task depends on. |
|
|
93
|
+
|
|
94
|
+
### get-task-details
|
|
95
|
+
|
|
96
|
+
**Get task details**
|
|
97
|
+
|
|
98
|
+
Returns detailed information about a specific task, including output, failure reason, and log history.
|
|
99
|
+
|
|
100
|
+
| Parameter | Type | Required | Default | Description |
|
|
101
|
+
|-----------|------|----------|---------|-------------|
|
|
102
|
+
| `taskId` | `uuid` | Yes | - | The ID of the task to get details for. |
|
|
103
|
+
|
|
104
|
+
### store-progress
|
|
105
|
+
|
|
106
|
+
**Store task progress**
|
|
107
|
+
|
|
108
|
+
Stores the progress of a specific task. Can also mark task as completed or failed, which will set the agent back to idle.
|
|
109
|
+
|
|
110
|
+
| Parameter | Type | Required | Default | Description |
|
|
111
|
+
|-----------|------|----------|---------|-------------|
|
|
112
|
+
| `taskId` | `uuid` | Yes | - | The ID of the task to update progress for. |
|
|
113
|
+
| `progress` | `string` | No | - | The progress update to store. |
|
|
114
|
+
| `output` | `string` | No | - | The output of the task (used when completing). |
|
|
115
|
+
|
|
116
|
+
### my-agent-info
|
|
117
|
+
|
|
118
|
+
**Get your agent info**
|
|
119
|
+
|
|
120
|
+
Returns your agent ID based on the X-Agent-ID header.
|
|
121
|
+
|
|
122
|
+
*No parameters*
|
|
123
|
+
|
|
124
|
+
## Task Pool Tools
|
|
125
|
+
|
|
126
|
+
*Messaging*
|
|
127
|
+
|
|
128
|
+
### task-action
|
|
129
|
+
|
|
130
|
+
**Task Pool Actions**
|
|
131
|
+
|
|
132
|
+
Perform task pool operations: create unassigned tasks, claim/release tasks from pool, accept/reject offered tasks.
|
|
133
|
+
|
|
134
|
+
| Parameter | Type | Required | Default | Description |
|
|
135
|
+
|-----------|------|----------|---------|-------------|
|
|
136
|
+
| `taskType` | `string` | No | - | Task type (e.g., 'bug', 'feature |
|
|
137
|
+
| `dependsOn` | `array` | No | - | Task IDs this task depends on. |
|
|
138
|
+
|
|
139
|
+
## Messaging Tools
|
|
140
|
+
|
|
141
|
+
*Messaging*
|
|
142
|
+
|
|
143
|
+
### list-channels
|
|
144
|
+
|
|
145
|
+
**List Channels**
|
|
146
|
+
|
|
147
|
+
Lists all available channels for cross-agent communication.
|
|
148
|
+
|
|
149
|
+
*No parameters*
|
|
150
|
+
|
|
151
|
+
### create-channel
|
|
152
|
+
|
|
153
|
+
**Create Channel**
|
|
154
|
+
|
|
155
|
+
Creates a new channel for cross-agent communication.
|
|
156
|
+
|
|
157
|
+
| Parameter | Type | Required | Default | Description |
|
|
158
|
+
|-----------|------|----------|---------|-------------|
|
|
159
|
+
| `name` | `string` | Yes | - | Channel name (must be unique). |
|
|
160
|
+
| `description` | `string` | No | - | Channel description. |
|
|
161
|
+
| `participants` | `array` | No | - | Agent IDs for DM channels. |
|
|
162
|
+
|
|
163
|
+
### post-message
|
|
164
|
+
|
|
165
|
+
**Post Message**
|
|
166
|
+
|
|
167
|
+
Posts a message to a channel for cross-agent communication.
|
|
168
|
+
|
|
169
|
+
| Parameter | Type | Required | Default | Description |
|
|
170
|
+
|-----------|------|----------|---------|-------------|
|
|
171
|
+
| `channel` | `string` | No | "general" | Channel name (default: 'general |
|
|
172
|
+
| `content` | `string` | Yes | - | Message content. |
|
|
173
|
+
| `replyTo` | `uuid` | No | - | Message ID to reply to (for threading). |
|
|
174
|
+
|
|
175
|
+
### read-messages
|
|
176
|
+
|
|
177
|
+
**Read Messages**
|
|
178
|
+
|
|
179
|
+
Reads messages from a channel. If no channel is specified, returns unread messages from ALL channels. Supports filtering by unread, mentions, and time range. Automatically marks messages as read.
|
|
180
|
+
|
|
181
|
+
| Parameter | Type | Required | Default | Description |
|
|
182
|
+
|-----------|------|----------|---------|-------------|
|
|
183
|
+
| `since` | `unknown` | No | - | Only messages after this ISO timestamp. |
|
|
184
|
+
| `unreadOnly` | `boolean` | No | false | Only return unread messages. |
|
|
185
|
+
|
|
186
|
+
## Profiles Tools
|
|
187
|
+
|
|
188
|
+
*Profiles*
|
|
189
|
+
|
|
190
|
+
### update-profile
|
|
191
|
+
|
|
192
|
+
**Update Profile**
|
|
193
|
+
|
|
194
|
+
Updates the calling agent's profile information (description, role, capabilities).
|
|
195
|
+
|
|
196
|
+
| Parameter | Type | Required | Default | Description |
|
|
197
|
+
|-----------|------|----------|---------|-------------|
|
|
198
|
+
| `description` | `string` | No | - | Agent description. |
|
|
199
|
+
|
|
200
|
+
## Services Tools
|
|
201
|
+
|
|
202
|
+
*Services*
|
|
203
|
+
|
|
204
|
+
### register-service
|
|
205
|
+
|
|
206
|
+
**Register Service**
|
|
207
|
+
|
|
208
|
+
Register a background service (e.g., PM2 process) for discovery by other agents. The service URL is automatically derived from your agent ID (https://{AGENT_ID}.{SWARM_URL}). Each agent can only run one service on port 3000.
|
|
209
|
+
|
|
210
|
+
| Parameter | Type | Required | Default | Description |
|
|
211
|
+
|-----------|------|----------|---------|-------------|
|
|
212
|
+
| `script` | `string` | Yes | - | Path to the script to run (required for PM2 restart). |
|
|
213
|
+
| `description` | `string` | No | - | What this service does. |
|
|
214
|
+
| `cwd` | `string` | No | - | Working directory for the script. |
|
|
215
|
+
| `args` | `array` | No | - | Command line arguments for the script. |
|
|
216
|
+
| `metadata` | `object` | No | - | Additional metadata. |
|
|
217
|
+
|
|
218
|
+
### unregister-service
|
|
219
|
+
|
|
220
|
+
**Unregister Service**
|
|
221
|
+
|
|
222
|
+
Remove a service from the registry. Use this after stopping a PM2 process. You can only unregister your own services.
|
|
223
|
+
|
|
224
|
+
| Parameter | Type | Required | Default | Description |
|
|
225
|
+
|-----------|------|----------|---------|-------------|
|
|
226
|
+
| `serviceId` | `uuid` | No | - | Service ID to unregister. |
|
|
227
|
+
|
|
228
|
+
### list-services
|
|
229
|
+
|
|
230
|
+
**List Services**
|
|
231
|
+
|
|
232
|
+
Query services registered by agents in the swarm. Use this to discover services exposed by other agents.
|
|
233
|
+
|
|
234
|
+
| Parameter | Type | Required | Default | Description |
|
|
235
|
+
|-----------|------|----------|---------|-------------|
|
|
236
|
+
| `agentId` | `uuid` | No | - | Filter by specific agent ID. |
|
|
237
|
+
| `name` | `string` | No | - | Filter by service name (partial match). |
|
|
238
|
+
|
|
239
|
+
### update-service-status
|
|
240
|
+
|
|
241
|
+
**Update Service Status**
|
|
242
|
+
|
|
243
|
+
Update the health status of a registered service. Use this after a service becomes healthy or needs to be marked as stopped/unhealthy.
|
|
244
|
+
|
|
245
|
+
| Parameter | Type | Required | Default | Description |
|
|
246
|
+
|-----------|------|----------|---------|-------------|
|
|
247
|
+
| `serviceId` | `uuid` | No | - | Service ID to update. |
|
|
248
|
+
| `name` | `string` | No | - | Service name to update (alternative to serviceId). |
|
|
249
|
+
|
package/README.md
CHANGED
|
@@ -1,258 +1,178 @@
|
|
|
1
1
|
# Agent Swarm MCP
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="assets/agent-swarm.png" alt="Agent Swarm" width="800">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
> Agent orchestration layer MCP for Claude Code, Codex, Gemini CLI, and more!
|
|
4
8
|
|
|
5
|
-
##
|
|
9
|
+
## Table of Contents
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
- [What is Agent Swarm?](#what-is-agent-swarm)
|
|
12
|
+
- [Quick Start](#quick-start)
|
|
13
|
+
- [CLI Commands](#cli-commands)
|
|
14
|
+
- [Deployment](#deployment)
|
|
15
|
+
- [Documentation](#documentation)
|
|
16
|
+
- [License](#license)
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
---
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
## What is Agent Swarm?
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
Agent Swarm MCP enables multi-agent coordination for AI coding assistants. It provides:
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
- **Task Management** - Assign, track, and coordinate tasks across agents
|
|
25
|
+
- **Agent Communication** - Channel-based messaging between agents
|
|
26
|
+
- **Service Discovery** - Register and discover background services
|
|
27
|
+
- **Docker Workers** - Run isolated Claude workers in containers
|
|
28
|
+
- **Lead/Worker Pattern** - Coordinate work with a lead agent and multiple workers
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
- Create `.claude` directory and `settings.local.json` if needed
|
|
21
|
-
- Create `.mcp.json` if needed
|
|
22
|
-
- Add entries to `.gitignore`
|
|
23
|
-
- Configure permissions and hooks
|
|
24
|
-
- Prompt for your API token and Agent ID
|
|
25
|
-
|
|
26
|
-
Options:
|
|
27
|
-
- `--dry-run` - Preview changes without writing
|
|
28
|
-
- `--restore` - Restore files from `.bak` backups
|
|
29
|
-
|
|
30
|
-
### Manual Installation
|
|
31
|
-
|
|
32
|
-
Add to your `.mcp.json`:
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"mcpServers": {
|
|
37
|
-
"agent-swarm": {
|
|
38
|
-
"type": "http",
|
|
39
|
-
"url": "https://agent-swarm-mcp.desplega.sh/mcp",
|
|
40
|
-
"headers": {
|
|
41
|
-
"Authorization": "Bearer <your-token>",
|
|
42
|
-
"X-Agent-ID": "<your-agent-id>"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
```
|
|
30
|
+
---
|
|
48
31
|
|
|
49
|
-
|
|
32
|
+
## Quick Start
|
|
50
33
|
|
|
51
|
-
|
|
52
|
-
claude mcp add --transport http agent-swarm https://agent-swarm-mcp.desplega.sh/mcp --header "Authorization: Bearer <your-token>" --header "X-Agent-ID: <your-agent-id>"
|
|
53
|
-
```
|
|
34
|
+
The recommended setup: run the API locally, run a Docker worker, and connect Claude Code as the lead agent.
|
|
54
35
|
|
|
55
|
-
|
|
36
|
+
### Prerequisites
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
- [Bun](https://bun.sh) (or Node.js 22+)
|
|
39
|
+
- [Docker](https://docker.com)
|
|
40
|
+
- [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code)
|
|
58
41
|
|
|
59
|
-
|
|
42
|
+
### 1. Clone & Install
|
|
60
43
|
|
|
61
44
|
```bash
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
git clone https://github.com/desplega-ai/agent-swarm.git
|
|
46
|
+
cd agent-swarm
|
|
47
|
+
bun install
|
|
48
|
+
```
|
|
64
49
|
|
|
65
|
-
|
|
66
|
-
bunx @desplega.ai/agent-swarm setup --dry-run
|
|
50
|
+
### 2. Configure Environment
|
|
67
51
|
|
|
68
|
-
|
|
69
|
-
bunx @desplega.ai/agent-swarm setup --restore
|
|
52
|
+
**For the API server:**
|
|
70
53
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
```bash
|
|
55
|
+
cp .env.example .env
|
|
56
|
+
```
|
|
74
57
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
bunx @desplega.ai/agent-swarm claude --headless -m "Hello"
|
|
58
|
+
Required in `.env`:
|
|
59
|
+
- `API_KEY` - Secret key for API authentication (can be left empty, e.g. for local-only setups)
|
|
78
60
|
|
|
79
|
-
|
|
80
|
-
bunx @desplega.ai/agent-swarm hook
|
|
61
|
+
**For Docker workers:**
|
|
81
62
|
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
```bash
|
|
64
|
+
cp .env.docker.example .env.docker
|
|
84
65
|
```
|
|
85
66
|
|
|
86
|
-
|
|
67
|
+
Required in `.env.docker`:
|
|
68
|
+
- `API_KEY` - Same key as the API server
|
|
69
|
+
- `CLAUDE_CODE_OAUTH_TOKEN` - Run `claude setup-token` to get this
|
|
87
70
|
|
|
88
|
-
|
|
71
|
+
> See `.env.example` and `.env.docker.example` for additional optional variables.
|
|
89
72
|
|
|
90
|
-
###
|
|
73
|
+
### 3. Start the API Server
|
|
91
74
|
|
|
92
75
|
```bash
|
|
93
|
-
|
|
94
|
-
docker build -f Dockerfile.worker -t agent-swarm-worker .
|
|
95
|
-
|
|
96
|
-
# Or using npm script
|
|
97
|
-
bun run docker:build:worker
|
|
76
|
+
bun run start:http
|
|
98
77
|
```
|
|
99
78
|
|
|
100
|
-
|
|
79
|
+
The MCP server runs at `http://localhost:3013`.
|
|
101
80
|
|
|
102
|
-
|
|
103
|
-
# Using docker run
|
|
104
|
-
docker run --rm -it \
|
|
105
|
-
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
106
|
-
-e API_KEY=your-api-key \
|
|
107
|
-
-v ./logs:/logs \
|
|
108
|
-
agent-swarm-worker
|
|
81
|
+
### 4. Run a Docker Worker
|
|
109
82
|
|
|
110
|
-
|
|
111
|
-
docker-compose -f docker-compose.worker.yml up
|
|
83
|
+
In a new terminal:
|
|
112
84
|
|
|
113
|
-
|
|
85
|
+
```bash
|
|
86
|
+
bun run docker:build:worker
|
|
87
|
+
mkdir -p ./logs ./work/shared ./work/worker-1
|
|
114
88
|
bun run docker:run:worker
|
|
115
89
|
```
|
|
116
90
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
| Variable | Required | Description |
|
|
120
|
-
|----------|----------|-------------|
|
|
121
|
-
| `CLAUDE_CODE_OAUTH_TOKEN` | Yes | OAuth token for Claude CLI |
|
|
122
|
-
| `API_KEY` | Yes | API key for MCP server |
|
|
123
|
-
| `AGENT_ID` | No | Agent UUID (assigned on join if not set) |
|
|
124
|
-
| `MCP_BASE_URL` | No | MCP server URL (default: `http://host.docker.internal:3013`) |
|
|
125
|
-
| `SESSION_ID` | No | Log folder name (auto-generated if not provided) |
|
|
126
|
-
| `WORKER_YOLO` | No | Continue on errors (default: `false`) |
|
|
127
|
-
|
|
128
|
-
### Architecture
|
|
129
|
-
|
|
130
|
-
The Docker worker image is built using a multi-stage build:
|
|
131
|
-
|
|
132
|
-
1. **Builder stage**: Compiles `src/cli.tsx` into a standalone binary using Bun
|
|
133
|
-
2. **Runtime stage**: Ubuntu 24.04 with full development environment
|
|
134
|
-
|
|
135
|
-
**Pre-installed tools:**
|
|
136
|
-
- **Languages**: Python 3, Node.js 22, Bun
|
|
137
|
-
- **Build tools**: gcc, g++, make, cmake
|
|
138
|
-
- **Utilities**: git, git-lfs, vim, nano, jq, curl, wget, ssh
|
|
139
|
-
- **Sudo access**: Worker can install packages with `sudo apt-get install`
|
|
140
|
-
|
|
141
|
-
**Working directory**: `/workspace` (empty, for cloning repos)
|
|
91
|
+
The worker joins the swarm and waits for tasks.
|
|
142
92
|
|
|
143
|
-
|
|
93
|
+
#### Note
|
|
144
94
|
|
|
145
|
-
|
|
95
|
+
We automatically build a Docker image for Claude Code workers: `ghcr.io/desplega-ai/agent-swarm-worker:latest`.
|
|
146
96
|
|
|
147
|
-
|
|
148
|
-
|----------|-------------|---------|
|
|
149
|
-
| `MCP_BASE_URL` | Base URL for the MCP server | `https://agent-swarm-mcp.desplega.sh` |
|
|
150
|
-
| `PORT` | Port for self-hosted MCP server | `3013` |
|
|
151
|
-
| `API_KEY` | API key for server authentication | - |
|
|
97
|
+
### 5. Connect Claude Code as Lead
|
|
152
98
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Deploy the MCP server to a Linux host with systemd.
|
|
156
|
-
|
|
157
|
-
### Prerequisites
|
|
158
|
-
|
|
159
|
-
- Linux with systemd
|
|
160
|
-
- Bun installed (`curl -fsSL https://bun.sh/install | bash`)
|
|
161
|
-
|
|
162
|
-
### Install
|
|
99
|
+
In your project directory:
|
|
163
100
|
|
|
164
101
|
```bash
|
|
165
|
-
|
|
166
|
-
cd agent-swarm
|
|
167
|
-
sudo bun deploy/install.ts
|
|
102
|
+
bunx @desplega.ai/agent-swarm setup
|
|
168
103
|
```
|
|
169
104
|
|
|
170
|
-
This
|
|
171
|
-
- Copy files to `/opt/agent-swarm`
|
|
172
|
-
- Create `.env` file (edit to set `API_KEY`)
|
|
173
|
-
- Install systemd service with health checks every 30s
|
|
174
|
-
- Start the service on port 3013
|
|
105
|
+
This configures Claude Code to connect to the swarm. Then start Claude Code normally and mention the following:
|
|
175
106
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
After pulling new changes:
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
git pull
|
|
182
|
-
sudo bun deploy/update.ts
|
|
107
|
+
```
|
|
108
|
+
Register yourself as the lead agent in the agent-swarm MCP.
|
|
183
109
|
```
|
|
184
110
|
|
|
185
|
-
|
|
111
|
+
This will be a one-time setup, to make sure you are registered as the lead agent in the swarm, using the provided API key and agent ID (optional).
|
|
186
112
|
|
|
187
|
-
|
|
188
|
-
# Check status
|
|
189
|
-
sudo systemctl status agent-swarm
|
|
113
|
+
#### Notes
|
|
190
114
|
|
|
191
|
-
|
|
192
|
-
|
|
115
|
+
- The `setup` command will automatically back-up the updated files, in case you want to revert later (using `--restore`).
|
|
116
|
+
- Use `--dry-run` to preview changes without applying them.
|
|
193
117
|
|
|
194
|
-
|
|
195
|
-
sudo systemctl restart agent-swarm
|
|
118
|
+
---
|
|
196
119
|
|
|
197
|
-
|
|
198
|
-
sudo systemctl stop agent-swarm
|
|
199
|
-
```
|
|
120
|
+
## CLI Commands
|
|
200
121
|
|
|
201
|
-
|
|
122
|
+
> We will be publishing the package to npm as `@desplega.ai/agent-swarm` on each new tag bump of the [`package.json`](./package.json).
|
|
202
123
|
|
|
203
|
-
Install dependencies:
|
|
204
124
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
125
|
+
| Command | Description |
|
|
126
|
+
|---------|-------------|
|
|
127
|
+
| `setup` | Initialize agent-swarm in a project |
|
|
128
|
+
| `mcp` | Start the MCP HTTP server |
|
|
129
|
+
| `worker` | Run Claude as a worker agent |
|
|
130
|
+
| `lead` | Run Claude as a lead agent |
|
|
131
|
+
| `hook` | Handle Claude Code hook events |
|
|
132
|
+
| `help` | Show help message |
|
|
208
133
|
|
|
209
|
-
|
|
134
|
+
### Examples
|
|
210
135
|
|
|
211
136
|
```bash
|
|
212
|
-
|
|
213
|
-
|
|
137
|
+
# Setup wizard
|
|
138
|
+
bunx @desplega.ai/agent-swarm setup
|
|
214
139
|
|
|
215
|
-
|
|
140
|
+
# Start MCP & API server on custom port
|
|
141
|
+
bunx @desplega.ai/agent-swarm mcp --port 8080 --key my-api-key
|
|
216
142
|
|
|
217
|
-
|
|
218
|
-
|
|
143
|
+
# Run worker with custom system prompt (not in docker!!! beware)
|
|
144
|
+
bunx @desplega.ai/agent-swarm worker --system-prompt "You are a Python specialist"
|
|
145
|
+
|
|
146
|
+
# Run lead agent in the background (without human-in-the-loop mode via MCP client)
|
|
147
|
+
bunx @desplega.ai/agent-swarm lead
|
|
219
148
|
```
|
|
220
149
|
|
|
221
|
-
|
|
150
|
+
---
|
|
222
151
|
|
|
223
|
-
|
|
224
|
-
bun run dev # STDIO
|
|
225
|
-
bun run dev:http # HTTP
|
|
226
|
-
```
|
|
152
|
+
## Deployment
|
|
227
153
|
|
|
228
|
-
|
|
154
|
+
For production deployments, see [`docker-compose.example.yml`](./docker-compose.example.yml) which sets up:
|
|
229
155
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
156
|
+
- API service (MCP HTTP server)
|
|
157
|
+
- Multiple worker agents
|
|
158
|
+
- Lead agent
|
|
159
|
+
- Shared volumes for logs and workspaces
|
|
234
160
|
|
|
235
|
-
|
|
161
|
+
Full deployment options are documented in [DEPLOYMENT.md](./DEPLOYMENT.md).
|
|
236
162
|
|
|
237
|
-
|
|
238
|
-
bun run cli setup
|
|
239
|
-
bun run cli setup --dry-run
|
|
240
|
-
bun run hook # Hook handler
|
|
241
|
-
```
|
|
163
|
+
---
|
|
242
164
|
|
|
243
|
-
##
|
|
165
|
+
## Documentation
|
|
244
166
|
|
|
245
|
-
|
|
167
|
+
| Document | Description |
|
|
168
|
+
|----------|-------------|
|
|
169
|
+
| [DEPLOYMENT.md](./DEPLOYMENT.md) | Docker, Docker Compose, systemd deployment |
|
|
170
|
+
| [CONTRIBUTING.md](./CONTRIBUTING.md) | Development setup, code quality, project structure |
|
|
171
|
+
| [MCP.md](./MCP.md) | MCP tools reference (auto-generated) |
|
|
172
|
+
| [FAQ.md](./FAQ.md) | Frequently asked questions |
|
|
246
173
|
|
|
247
|
-
|
|
248
|
-
- `poll-task` - Poll for assigned tasks (worker agents)
|
|
249
|
-
- `send-task` - Assign a task to an agent (lead agent)
|
|
250
|
-
- `get-swarm` - List all agents in the swarm
|
|
251
|
-
- `get-tasks` - List tasks filtered by status
|
|
252
|
-
- `get-task-details` - Get detailed info about a task
|
|
253
|
-
- `store-progress` - Update task progress or mark complete/failed
|
|
254
|
-
- `my-agent-info` - Get current agent's info
|
|
174
|
+
---
|
|
255
175
|
|
|
256
176
|
## License
|
|
257
177
|
|
|
258
|
-
MIT License
|
|
178
|
+
[MIT License](./LICENSE) - 2025-2026 desplega.ai
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { $ } from "bun";
|
|
4
|
+
import pkg from "../package.json";
|
|
5
|
+
|
|
6
|
+
const IMAGE = "ghcr.io/desplega-ai/agent-swarm-worker";
|
|
7
|
+
const VERSION = pkg.version;
|
|
8
|
+
|
|
9
|
+
console.log(`Publishing ${IMAGE}:${VERSION}...`);
|
|
10
|
+
|
|
11
|
+
// Login to GHCR using gh CLI
|
|
12
|
+
const token = await $`gh auth token`.text();
|
|
13
|
+
const username = await $`gh api user -q .login`.text();
|
|
14
|
+
await $`echo ${token.trim()} | docker login ghcr.io -u ${username.trim()} --password-stdin`;
|
|
15
|
+
|
|
16
|
+
// Build
|
|
17
|
+
console.log("Building image...");
|
|
18
|
+
await $`docker build -f Dockerfile.worker -t agent-swarm-worker .`;
|
|
19
|
+
|
|
20
|
+
// Tag
|
|
21
|
+
console.log(`Tagging as ${VERSION} and latest...`);
|
|
22
|
+
await $`docker tag agent-swarm-worker ${IMAGE}:${VERSION}`;
|
|
23
|
+
await $`docker tag agent-swarm-worker ${IMAGE}:latest`;
|
|
24
|
+
|
|
25
|
+
// Push
|
|
26
|
+
console.log("Pushing to GHCR...");
|
|
27
|
+
await $`docker push ${IMAGE}:${VERSION}`;
|
|
28
|
+
await $`docker push ${IMAGE}:latest`;
|
|
29
|
+
|
|
30
|
+
console.log(`Done! Published ${IMAGE}:${VERSION}`);
|