agent-worker 0.2.0 → 0.4.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/README.md +342 -247
- package/dist/backends-D3MAlJBX.mjs +3 -0
- package/dist/backends-DenGdkrj.mjs +735 -0
- package/dist/cli/index.mjs +2195 -856
- package/dist/context-C7nBmU5D.mjs +4 -0
- package/dist/index.d.mts +272 -173
- package/dist/index.mjs +27 -36
- package/dist/mcp-server-DtIApaBD.mjs +549 -0
- package/dist/{skills-B8z8tFaH.mjs → skills-VyC7eQyK.mjs} +263 -136
- package/dist/workflow-CaRCNEh6.mjs +1784 -0
- package/package.json +10 -4
- package/dist/backends-BGJk-onJ.mjs +0 -559
- package/dist/backends-bvhx4Wb6.mjs +0 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agent-worker
|
|
2
2
|
|
|
3
|
-
CLI and SDK for
|
|
3
|
+
CLI and SDK for running AI agents — from standalone instances to collaborative workflows.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,244 +10,385 @@ npm install -g agent-worker
|
|
|
10
10
|
bun add -g agent-worker
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Two Modes of Operation
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
agent-worker supports two distinct usage patterns:
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# Create with system prompt
|
|
22
|
-
agent-worker session new -s "You are a code reviewer."
|
|
17
|
+
| Mode | Use Case | Entry Point | Coordination |
|
|
18
|
+
|------|----------|-------------|--------------|
|
|
19
|
+
| **Agent** | Single AI assistant | CLI commands | Direct interaction |
|
|
20
|
+
| **Workflow** | Multi-agent collaboration | YAML workflow file | @mention-based |
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
agent-worker session new -f ./prompts/reviewer.txt
|
|
22
|
+
---
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
agent-worker session new -n my-session
|
|
24
|
+
## 🤖 Agent Mode
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
agent-worker session new -b claude
|
|
26
|
+
**Run individual AI agents as standalone instances.**
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
agent-worker session list
|
|
28
|
+
Perfect for: testing, prototyping, interactive Q&A, code assistance.
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
agent-worker session use my-session
|
|
30
|
+
### Quick Start
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
```bash
|
|
33
|
+
# Start an agent
|
|
34
|
+
agent-worker new alice -m anthropic/claude-sonnet-4-5
|
|
41
35
|
|
|
42
|
-
#
|
|
43
|
-
agent-worker
|
|
36
|
+
# Send a message
|
|
37
|
+
agent-worker send alice "Analyze this codebase"
|
|
44
38
|
|
|
45
|
-
#
|
|
46
|
-
agent-worker
|
|
39
|
+
# View conversation
|
|
40
|
+
agent-worker peek
|
|
47
41
|
|
|
48
|
-
#
|
|
49
|
-
agent-worker
|
|
42
|
+
# Check status
|
|
43
|
+
agent-worker status alice
|
|
50
44
|
```
|
|
51
45
|
|
|
52
|
-
###
|
|
46
|
+
### Organizing Agents
|
|
47
|
+
|
|
48
|
+
Agents can be grouped into **workflows** by defining them in YAML:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
# review.yaml
|
|
52
|
+
agents:
|
|
53
|
+
reviewer:
|
|
54
|
+
backend: claude
|
|
55
|
+
system_prompt: You are a code reviewer.
|
|
56
|
+
|
|
57
|
+
coder:
|
|
58
|
+
backend: cursor
|
|
59
|
+
system_prompt: You are a code implementer.
|
|
60
|
+
```
|
|
53
61
|
|
|
54
62
|
```bash
|
|
55
|
-
#
|
|
56
|
-
agent-worker
|
|
63
|
+
# Run workflow agents (workflow name from YAML)
|
|
64
|
+
agent-worker run review.yaml
|
|
65
|
+
|
|
66
|
+
# Send to specific agent in workflow
|
|
67
|
+
agent-worker send reviewer@review "Check this code"
|
|
68
|
+
```
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
agent-worker send "Explain recursion" --to my-session
|
|
70
|
+
**Note**: Agent Mode (`agent-worker new`) only creates standalone agents in the global workflow. For coordinated agents in named workflows, use Workflow Mode (YAML files).
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
agent-worker history
|
|
63
|
-
agent-worker history --last 5
|
|
72
|
+
### Multiple Instances (workflow:tag)
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
agent-worker stats
|
|
74
|
+
Run multiple isolated instances of the same workflow using **tags**:
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
```bash
|
|
77
|
+
# Different PRs, isolated contexts
|
|
78
|
+
agent-worker run review.yaml --tag pr-123
|
|
79
|
+
agent-worker run review.yaml --tag pr-456
|
|
70
80
|
|
|
71
|
-
#
|
|
72
|
-
agent-worker
|
|
81
|
+
# Each has its own conversation history
|
|
82
|
+
agent-worker send reviewer@review:pr-123 "LGTM"
|
|
83
|
+
agent-worker peek @review:pr-123 # Only sees pr-123 messages
|
|
73
84
|
```
|
|
74
85
|
|
|
75
|
-
|
|
86
|
+
**Target syntax** (used in send/peek/ls/stop commands):
|
|
87
|
+
- `alice` → alice@global:main (standalone agent)
|
|
88
|
+
- `alice@review` → alice@review:main (agent in review workflow)
|
|
89
|
+
- `alice@review:pr-123` → full specification
|
|
90
|
+
- `@review` → review workflow (for broadcast or listing)
|
|
91
|
+
- `@review:pr-123` → specific workflow instance
|
|
92
|
+
|
|
93
|
+
### Agent Commands
|
|
76
94
|
|
|
77
95
|
```bash
|
|
78
|
-
#
|
|
79
|
-
agent-worker
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
# Lifecycle
|
|
97
|
+
agent-worker new <name> [options] # Create standalone agent
|
|
98
|
+
agent-worker stop <target> # Stop agent
|
|
99
|
+
agent-worker ls [target] # List agents (default: global)
|
|
100
|
+
agent-worker ls --all # List all agents from all workflows
|
|
101
|
+
agent-worker status <target> # Check agent status
|
|
102
|
+
|
|
103
|
+
# Interaction
|
|
104
|
+
agent-worker send <target> <message> # Send to agent or workflow
|
|
105
|
+
agent-worker peek [target] [options] # View messages (default: @global)
|
|
106
|
+
|
|
107
|
+
# Scheduling (periodic wakeup when idle)
|
|
108
|
+
agent-worker schedule <target> set <interval> [--prompt "Task"]
|
|
109
|
+
agent-worker schedule <target> get
|
|
110
|
+
agent-worker schedule <target> clear
|
|
111
|
+
|
|
112
|
+
# Shared documents
|
|
113
|
+
agent-worker doc read <target>
|
|
114
|
+
agent-worker doc write <target> --content "..."
|
|
115
|
+
agent-worker doc append <target> --file notes.txt
|
|
116
|
+
|
|
117
|
+
# Testing & Debugging
|
|
118
|
+
agent-worker mock tool <name> <response> # Mock tool response
|
|
119
|
+
agent-worker feedback [target] # View agent feedback/observations
|
|
120
|
+
```
|
|
82
121
|
|
|
83
|
-
|
|
84
|
-
agent-worker tool add delete_file \
|
|
85
|
-
-d "Delete a file" \
|
|
86
|
-
-p "path:string:File path" \
|
|
87
|
-
--needs-approval
|
|
122
|
+
### Backend Options
|
|
88
123
|
|
|
89
|
-
|
|
90
|
-
agent-worker
|
|
124
|
+
```bash
|
|
125
|
+
agent-worker new alice -m anthropic/claude-sonnet-4-5 # SDK (default)
|
|
126
|
+
agent-worker new alice -b claude # Claude CLI
|
|
127
|
+
agent-worker new alice -b cursor # Cursor Agent
|
|
128
|
+
agent-worker new alice -b mock # Testing (no API)
|
|
129
|
+
|
|
130
|
+
# Specify tools at creation (SDK backend only)
|
|
131
|
+
agent-worker new alice --tool ./custom-tools.ts
|
|
132
|
+
agent-worker new alice --skill ./skills --tool ./tools.ts
|
|
133
|
+
```
|
|
91
134
|
|
|
92
|
-
|
|
93
|
-
agent-worker tool mock get_weather '{"temp": 72, "condition": "sunny"}'
|
|
135
|
+
### Examples
|
|
94
136
|
|
|
95
|
-
|
|
96
|
-
|
|
137
|
+
**Quick testing without API keys:**
|
|
138
|
+
```bash
|
|
139
|
+
agent-worker new -b mock
|
|
140
|
+
agent-worker send a0 "Hello"
|
|
97
141
|
```
|
|
98
142
|
|
|
99
|
-
|
|
143
|
+
**Scheduled agent (runs every 30s when idle):**
|
|
144
|
+
```bash
|
|
145
|
+
# Standalone agent with wakeup schedule
|
|
146
|
+
agent-worker new monitor --wakeup 30s --prompt "Check CI status"
|
|
100
147
|
|
|
148
|
+
# Or schedule existing agent
|
|
149
|
+
agent-worker schedule monitor set 30s --prompt "Check CI status"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Send to workflow (broadcast or @mention):**
|
|
101
153
|
```bash
|
|
102
|
-
#
|
|
103
|
-
agent-worker
|
|
154
|
+
# Broadcast to entire workflow
|
|
155
|
+
agent-worker send @review "Status update"
|
|
104
156
|
|
|
105
|
-
#
|
|
106
|
-
agent-worker
|
|
157
|
+
# @mention specific agents in workflow
|
|
158
|
+
agent-worker send @review "@alice @bob discuss this"
|
|
159
|
+
```
|
|
107
160
|
|
|
108
|
-
|
|
109
|
-
|
|
161
|
+
**Feedback-enabled agent (reports observations):**
|
|
162
|
+
```bash
|
|
163
|
+
agent-worker new -m anthropic/claude-sonnet-4-5 --feedback
|
|
110
164
|
```
|
|
111
165
|
|
|
112
|
-
|
|
166
|
+
---
|
|
113
167
|
|
|
114
|
-
|
|
168
|
+
## 📋 Workflow Mode
|
|
115
169
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
agent
|
|
170
|
+
**Define multi-agent collaboration through YAML workflows.**
|
|
171
|
+
|
|
172
|
+
Perfect for: structured tasks, agent orchestration, reproducible pipelines.
|
|
119
173
|
|
|
120
|
-
|
|
121
|
-
agent-worker session new --skill ./my-skills/custom-skill
|
|
174
|
+
### Quick Start
|
|
122
175
|
|
|
123
|
-
|
|
124
|
-
|
|
176
|
+
```yaml
|
|
177
|
+
# review.yaml
|
|
178
|
+
agents:
|
|
179
|
+
reviewer:
|
|
180
|
+
backend: claude
|
|
181
|
+
system_prompt: You are a code reviewer. Provide constructive feedback.
|
|
125
182
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
183
|
+
coder:
|
|
184
|
+
backend: cursor
|
|
185
|
+
model: sonnet-4.5
|
|
186
|
+
system_prompt: You implement code changes based on feedback.
|
|
130
187
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
agent-worker session new --import-skill gitlab:myorg/skills@v1.0.0:custom
|
|
188
|
+
kickoff: |
|
|
189
|
+
@reviewer Review the recent changes and provide feedback.
|
|
190
|
+
@coder Implement the suggested improvements.
|
|
135
191
|
```
|
|
136
192
|
|
|
137
|
-
|
|
193
|
+
```bash
|
|
194
|
+
# Run once and exit
|
|
195
|
+
agent-worker run review.yaml
|
|
138
196
|
|
|
139
|
-
|
|
197
|
+
# Run and keep agents alive
|
|
198
|
+
agent-worker start review.yaml
|
|
140
199
|
|
|
141
|
-
|
|
142
|
-
|
|
200
|
+
# Run in background
|
|
201
|
+
agent-worker start review.yaml --background
|
|
143
202
|
```
|
|
144
203
|
|
|
145
|
-
|
|
146
|
-
- `vercel-labs/agent-skills` - Import all skills from GitHub main branch
|
|
147
|
-
- `vercel-labs/agent-skills:dive` - Import single skill
|
|
148
|
-
- `vercel-labs/agent-skills:{dive,memory}` - Import multiple skills (brace expansion)
|
|
149
|
-
- `vercel-labs/agent-skills@v1.0.0:dive` - Import from specific tag/branch
|
|
150
|
-
- `gitlab:myorg/skills:custom` - Import from GitLab
|
|
151
|
-
- `gitee:org/repo@dev:{a,b}` - Import from Gitee dev branch
|
|
204
|
+
### Workflow Instances (Tags)
|
|
152
205
|
|
|
153
|
-
|
|
206
|
+
Run the same workflow definition with different contexts:
|
|
154
207
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
208
|
+
```bash
|
|
209
|
+
# Each PR gets its own isolated instance (workflow name from YAML)
|
|
210
|
+
agent-worker run review.yaml --tag pr-123
|
|
211
|
+
agent-worker run review.yaml --tag pr-456
|
|
212
|
+
|
|
213
|
+
# Context isolation
|
|
214
|
+
├── .workflow/
|
|
215
|
+
│ └── review/
|
|
216
|
+
│ ├── pr-123/ # Independent channel + documents
|
|
217
|
+
│ └── pr-456/ # Independent channel + documents
|
|
218
|
+
```
|
|
163
219
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
220
|
+
### Workflow Structure
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
# Full workflow structure
|
|
224
|
+
name: code-review # Optional, defaults to filename
|
|
225
|
+
|
|
226
|
+
agents:
|
|
227
|
+
alice:
|
|
228
|
+
backend: sdk | claude | cursor | codex | mock
|
|
229
|
+
model: anthropic/claude-sonnet-4-5 # Required for SDK
|
|
230
|
+
system_prompt: |
|
|
231
|
+
You are Alice, a senior code reviewer.
|
|
232
|
+
tools: [bash, read, write] # CLI backend tool names
|
|
233
|
+
max_tokens: 8000
|
|
234
|
+
max_steps: 20
|
|
235
|
+
|
|
236
|
+
bob:
|
|
237
|
+
backend: claude
|
|
238
|
+
system_prompt_file: ./prompts/bob.txt # Load from file
|
|
239
|
+
|
|
240
|
+
# Context configuration (shared channel + documents)
|
|
241
|
+
context:
|
|
242
|
+
provider: file
|
|
243
|
+
config:
|
|
244
|
+
dir: ./.workflow/${{ workflow.name }}/${{ workflow.tag }}/ # Ephemeral
|
|
245
|
+
# OR
|
|
246
|
+
bind: ./data/${{ workflow.tag }}/ # Persistent (survives shutdown)
|
|
247
|
+
|
|
248
|
+
# Setup commands (run before kickoff)
|
|
249
|
+
setup:
|
|
250
|
+
- shell: git log --oneline -10
|
|
251
|
+
as: recent_commits # Store output as variable
|
|
252
|
+
|
|
253
|
+
- shell: git diff main...HEAD
|
|
254
|
+
as: changes
|
|
255
|
+
|
|
256
|
+
# Kickoff message (starts the workflow)
|
|
257
|
+
kickoff: |
|
|
258
|
+
@alice Review these changes:
|
|
259
|
+
|
|
260
|
+
Recent commits:
|
|
261
|
+
${{ recent_commits }}
|
|
262
|
+
|
|
263
|
+
Diff:
|
|
264
|
+
${{ changes }}
|
|
265
|
+
|
|
266
|
+
@bob Stand by for implementation tasks.
|
|
267
|
+
```
|
|
168
268
|
|
|
169
|
-
|
|
170
|
-
- `.agents/skills/` - Project-level skills (all backends)
|
|
171
|
-
- `.claude/skills/` - Claude Code project skills
|
|
172
|
-
- `.cursor/skills/` - Cursor project skills
|
|
173
|
-
- `~/.agents/skills/` - User-level global skills (all backends)
|
|
174
|
-
- `~/.claude/skills/` - User-level Claude skills
|
|
175
|
-
- `~/.codex/skills/` - User-level Codex skills
|
|
269
|
+
### Workflow Commands
|
|
176
270
|
|
|
177
|
-
|
|
271
|
+
```bash
|
|
272
|
+
# Execution (workflow name inferred from YAML)
|
|
273
|
+
agent-worker run <file> [--tag tag] [--json] # Run once
|
|
274
|
+
agent-worker start <file> [--tag tag] # Keep alive
|
|
275
|
+
agent-worker start <file> --background # Daemon mode
|
|
276
|
+
agent-worker stop @<workflow:tag> # Stop workflow
|
|
277
|
+
|
|
278
|
+
# Monitoring
|
|
279
|
+
agent-worker ls @<workflow:tag> # List agents in workflow
|
|
280
|
+
agent-worker peek @<workflow:tag> # View channel messages
|
|
281
|
+
agent-worker doc read @<workflow:tag> # Read shared document
|
|
282
|
+
|
|
283
|
+
# Debug
|
|
284
|
+
agent-worker run <file> --debug # Show internal logs
|
|
285
|
+
agent-worker run <file> --feedback # Enable observation tool
|
|
286
|
+
```
|
|
178
287
|
|
|
179
|
-
|
|
288
|
+
### Variable Interpolation
|
|
180
289
|
|
|
181
|
-
|
|
182
|
-
// List available skills
|
|
183
|
-
Skills({ operation: 'list' })
|
|
290
|
+
Templates support `${{ variable }}` syntax:
|
|
184
291
|
|
|
185
|
-
|
|
186
|
-
|
|
292
|
+
```yaml
|
|
293
|
+
setup:
|
|
294
|
+
- shell: echo "pr-${{ env.PR_NUMBER }}"
|
|
295
|
+
as: branch_name
|
|
187
296
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
filePath: 'references/search-strategies.md'
|
|
193
|
-
})
|
|
297
|
+
kickoff: |
|
|
298
|
+
Workflow: ${{ workflow.name }}
|
|
299
|
+
Tag: ${{ workflow.tag }}
|
|
300
|
+
Branch: ${{ branch_name }}
|
|
194
301
|
```
|
|
195
302
|
|
|
196
|
-
|
|
303
|
+
Available variables:
|
|
304
|
+
- `${{ workflow.name }}` - Workflow name
|
|
305
|
+
- `${{ workflow.tag }}` - Instance tag
|
|
306
|
+
- `${{ env.VAR }}` - Environment variable
|
|
307
|
+
- `${{ task_output }}` - Setup task output (via `as:` field)
|
|
197
308
|
|
|
198
|
-
|
|
309
|
+
### Coordination Patterns
|
|
199
310
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
311
|
+
**Sequential handoff:**
|
|
312
|
+
```yaml
|
|
313
|
+
kickoff: |
|
|
314
|
+
@alice Start the task.
|
|
315
|
+
```
|
|
316
|
+
Alice's message: "Done! @bob your turn"
|
|
203
317
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
318
|
+
**Parallel broadcast:**
|
|
319
|
+
```yaml
|
|
320
|
+
kickoff: |
|
|
321
|
+
@alice @bob @charlie All review this code.
|
|
207
322
|
```
|
|
208
323
|
|
|
209
|
-
|
|
324
|
+
**Document-based:**
|
|
325
|
+
```yaml
|
|
326
|
+
agents:
|
|
327
|
+
writer:
|
|
328
|
+
system_prompt: Write analysis to the shared document.
|
|
210
329
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
agent-worker backends
|
|
330
|
+
reviewer:
|
|
331
|
+
system_prompt: Read the document and provide feedback.
|
|
214
332
|
|
|
215
|
-
|
|
216
|
-
|
|
333
|
+
context:
|
|
334
|
+
provider: file
|
|
335
|
+
config:
|
|
336
|
+
bind: ./results/ # Persistent across runs
|
|
217
337
|
```
|
|
218
338
|
|
|
219
|
-
|
|
220
|
-
|---------|---------|----------|
|
|
221
|
-
| SDK (default) | `session new -m provider/model` | Full control, tool injection, mocking |
|
|
222
|
-
| Claude CLI | `session new -b claude` | Use existing Claude installation |
|
|
223
|
-
| Codex | `session new -b codex` | OpenAI Codex workflows |
|
|
224
|
-
| Cursor | `session new -b cursor` | Cursor Agent integration |
|
|
339
|
+
### Examples
|
|
225
340
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
341
|
+
**PR Review Workflow:**
|
|
342
|
+
```yaml
|
|
343
|
+
# review.yaml
|
|
344
|
+
agents:
|
|
345
|
+
reviewer:
|
|
346
|
+
backend: claude
|
|
347
|
+
system_prompt: Review code for bugs, style, performance.
|
|
232
348
|
|
|
233
|
-
|
|
349
|
+
setup:
|
|
350
|
+
- shell: gh pr diff ${{ env.PR_NUMBER }}
|
|
351
|
+
as: diff
|
|
234
352
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
353
|
+
kickoff: |
|
|
354
|
+
@reviewer Review this PR:
|
|
355
|
+
|
|
356
|
+
${{ diff }}
|
|
357
|
+
```
|
|
239
358
|
|
|
240
|
-
|
|
241
|
-
agent-worker
|
|
242
|
-
|
|
359
|
+
```bash
|
|
360
|
+
PR_NUMBER=123 agent-worker run review.yaml --tag pr-123
|
|
361
|
+
```
|
|
243
362
|
|
|
244
|
-
|
|
245
|
-
|
|
363
|
+
**Research & Summarize:**
|
|
364
|
+
```yaml
|
|
365
|
+
# research.yaml
|
|
366
|
+
agents:
|
|
367
|
+
researcher:
|
|
368
|
+
backend: sdk
|
|
369
|
+
model: anthropic/claude-sonnet-4-5
|
|
370
|
+
system_prompt: Research topics and write findings to document.
|
|
371
|
+
|
|
372
|
+
summarizer:
|
|
373
|
+
backend: sdk
|
|
374
|
+
model: anthropic/claude-haiku-4-5
|
|
375
|
+
system_prompt: Read document and create concise summary.
|
|
376
|
+
|
|
377
|
+
context:
|
|
378
|
+
provider: file
|
|
379
|
+
config:
|
|
380
|
+
bind: ./research-output/
|
|
381
|
+
|
|
382
|
+
kickoff: |
|
|
383
|
+
@researcher Research "${{ env.TOPIC }}" and document findings.
|
|
384
|
+
@summarizer Wait for research to complete, then summarize.
|
|
246
385
|
```
|
|
247
386
|
|
|
248
|
-
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## 🔧 SDK Usage
|
|
249
390
|
|
|
250
|
-
|
|
391
|
+
For programmatic control (TypeScript/JavaScript):
|
|
251
392
|
|
|
252
393
|
```typescript
|
|
253
394
|
import { AgentSession } from 'agent-worker'
|
|
@@ -269,123 +410,77 @@ for await (const chunk of session.sendStream('Tell me a story')) {
|
|
|
269
410
|
process.stdout.write(chunk)
|
|
270
411
|
}
|
|
271
412
|
|
|
272
|
-
//
|
|
413
|
+
// State management
|
|
273
414
|
const state = session.getState()
|
|
415
|
+
// Later: restore from state
|
|
274
416
|
```
|
|
275
417
|
|
|
276
418
|
### With Skills
|
|
277
419
|
|
|
278
420
|
```typescript
|
|
279
|
-
import {
|
|
280
|
-
AgentSession,
|
|
281
|
-
SkillsProvider,
|
|
282
|
-
createSkillsTool
|
|
283
|
-
} from 'agent-worker'
|
|
421
|
+
import { AgentSession, SkillsProvider, createSkillsTool } from 'agent-worker'
|
|
284
422
|
|
|
285
|
-
// Setup skills
|
|
286
423
|
const skillsProvider = new SkillsProvider()
|
|
287
424
|
await skillsProvider.scanDirectory('.agents/skills')
|
|
288
|
-
await skillsProvider.scanDirectory('~/my-skills')
|
|
289
425
|
|
|
290
|
-
// Or add individual skills
|
|
291
|
-
await skillsProvider.addSkill('./custom-skills/my-skill')
|
|
292
|
-
|
|
293
|
-
// Create session with Skills tool
|
|
294
426
|
const session = new AgentSession({
|
|
295
427
|
model: 'anthropic/claude-sonnet-4-5',
|
|
296
428
|
system: 'You are a helpful assistant.',
|
|
297
|
-
tools: [
|
|
298
|
-
createSkillsTool(skillsProvider),
|
|
299
|
-
// ... other tools
|
|
300
|
-
]
|
|
429
|
+
tools: [createSkillsTool(skillsProvider)]
|
|
301
430
|
})
|
|
302
|
-
|
|
303
|
-
// Agent can now access skills
|
|
304
|
-
const response = await session.send(
|
|
305
|
-
'What skills are available? Use the dive skill to analyze this codebase.'
|
|
306
|
-
)
|
|
307
431
|
```
|
|
308
432
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
```typescript
|
|
312
|
-
import {
|
|
313
|
-
AgentSession,
|
|
314
|
-
SkillsProvider,
|
|
315
|
-
SkillImporter,
|
|
316
|
-
createSkillsTool
|
|
317
|
-
} from 'agent-worker'
|
|
318
|
-
|
|
319
|
-
// Setup skills provider
|
|
320
|
-
const skillsProvider = new SkillsProvider()
|
|
433
|
+
---
|
|
321
434
|
|
|
322
|
-
|
|
323
|
-
const sessionId = 'my-session-123'
|
|
324
|
-
const importer = new SkillImporter(sessionId)
|
|
435
|
+
## 📊 Comparison: Agent vs Workflow
|
|
325
436
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
437
|
+
| Feature | Agent Mode | Workflow Mode |
|
|
438
|
+
|---------|------------|---------------|
|
|
439
|
+
| **Definition** | CLI commands | YAML file |
|
|
440
|
+
| **Agents** | One at a time | Multiple (orchestrated) |
|
|
441
|
+
| **Coordination** | Manual (via commands) | Automatic (@mentions) |
|
|
442
|
+
| **Context** | Shared channel + docs | Shared channel + docs |
|
|
443
|
+
| **Isolation** | workflow:tag namespace | workflow:tag namespace |
|
|
444
|
+
| **Setup** | Start agents manually | Declarative setup tasks |
|
|
445
|
+
| **Best For** | Interactive tasks, testing | Structured workflows, automation |
|
|
329
446
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
// Add imported skills to provider
|
|
337
|
-
await skillsProvider.addImportedSkills(importer)
|
|
338
|
-
|
|
339
|
-
// Create session
|
|
340
|
-
const session = new AgentSession({
|
|
341
|
-
model: 'anthropic/claude-sonnet-4-5',
|
|
342
|
-
system: 'You are a helpful assistant.',
|
|
343
|
-
tools: [createSkillsTool(skillsProvider)]
|
|
344
|
-
})
|
|
345
|
-
|
|
346
|
-
// Don't forget cleanup when done
|
|
347
|
-
process.on('exit', async () => {
|
|
348
|
-
await importer.cleanup()
|
|
349
|
-
})
|
|
447
|
+
Both modes share the same underlying context system:
|
|
448
|
+
```
|
|
449
|
+
.workflow/
|
|
450
|
+
├── global/main/ # Standalone agents (default)
|
|
451
|
+
├── review/main/ # review workflow, main tag
|
|
452
|
+
└── review/pr-123/ # review workflow, pr-123 tag
|
|
350
453
|
```
|
|
351
454
|
|
|
352
|
-
|
|
455
|
+
---
|
|
353
456
|
|
|
354
|
-
|
|
457
|
+
## 🎯 Model Formats
|
|
355
458
|
|
|
356
459
|
```bash
|
|
357
|
-
agent-worker
|
|
358
|
-
agent-worker
|
|
359
|
-
agent-worker
|
|
360
|
-
agent-worker history --to test
|
|
361
|
-
agent-worker session end test
|
|
460
|
+
agent-worker new -m anthropic/claude-sonnet-4-5 # Gateway (recommended)
|
|
461
|
+
agent-worker new -m anthropic # Provider-only (frontier)
|
|
462
|
+
agent-worker new -m deepseek:deepseek-chat # Direct format
|
|
362
463
|
```
|
|
363
464
|
|
|
364
|
-
|
|
465
|
+
---
|
|
365
466
|
|
|
366
|
-
|
|
367
|
-
agent-worker session new -n dev
|
|
368
|
-
agent-worker tool add my_api -d "Call my API" -p "endpoint:string"
|
|
369
|
-
agent-worker tool mock my_api '{"status": "ok"}'
|
|
370
|
-
agent-worker send "Call my API at /users"
|
|
371
|
-
# Update mock, test error handling
|
|
372
|
-
agent-worker tool mock my_api '{"status": "error", "code": 500}'
|
|
373
|
-
agent-worker send "Call my API at /users"
|
|
374
|
-
```
|
|
467
|
+
## 📚 Documentation
|
|
375
468
|
|
|
376
|
-
|
|
469
|
+
| Doc | Description |
|
|
470
|
+
|-----|-------------|
|
|
471
|
+
| [ARCHITECTURE.md](./ARCHITECTURE.md) | System architecture and modules |
|
|
472
|
+
| [docs/backends.md](./docs/backends.md) | Backend feature matrix |
|
|
473
|
+
| [docs/workflow/](./docs/workflow/) | Workflow system design |
|
|
474
|
+
| [TEST-ARCHITECTURE.md](./TEST-ARCHITECTURE.md) | Testing strategy |
|
|
377
475
|
|
|
378
|
-
|
|
379
|
-
agent-worker session new -m anthropic/claude-sonnet-4-5 -n claude
|
|
380
|
-
agent-worker session new -m openai/gpt-5.2 -n gpt
|
|
381
|
-
agent-worker send "Explain recursion" --to claude
|
|
382
|
-
agent-worker send "Explain recursion" --to gpt
|
|
383
|
-
```
|
|
476
|
+
---
|
|
384
477
|
|
|
385
478
|
## Requirements
|
|
386
479
|
|
|
387
480
|
- Node.js 18+ or Bun
|
|
388
|
-
- API key for chosen provider (e.g., `ANTHROPIC_API_KEY
|
|
481
|
+
- API key for chosen provider (e.g., `ANTHROPIC_API_KEY`)
|
|
482
|
+
|
|
483
|
+
---
|
|
389
484
|
|
|
390
485
|
## License
|
|
391
486
|
|