agent-worker 0.11.0 → 0.13.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 +163 -341
- package/dist/backends-BWzhErjT.mjs +3 -0
- package/dist/{backends-DLaP0rMW.mjs → backends-CziIqKRg.mjs} +287 -100
- package/dist/cli/index.mjs +345 -142
- package/dist/{context-CKL-RY7a.mjs → context-BqEyt2SF.mjs} +1 -1
- package/dist/index.d.mts +51 -7
- package/dist/index.mjs +2 -2
- package/dist/{workflow-CfITD7TN.mjs → runner-CnxROIev.mjs} +16 -247
- package/dist/{worker-CJ5_b2_q.mjs → worker-DBJ8136Q.mjs} +4 -2
- package/dist/workflow-CIE3WPNx.mjs +272 -0
- package/package.json +9 -2
- package/dist/backends-DG5igQii.mjs +0 -3
- /package/dist/{display-pretty-BsCsnPqs.mjs → display-pretty-BCJq5v9d.mjs} +0 -0
- /package/dist/{logger-CCFaMMV7.mjs → logger-Bfdo83xL.mjs} +0 -0
- /package/dist/{memory-provider-CBlKMdbJ.mjs → memory-provider-BtLYtdQH.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,418 +1,255 @@
|
|
|
1
1
|
# agent-worker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
3
|
+
Run AI agents from the terminal. One agent or many, talking to each other.
|
|
6
4
|
|
|
7
5
|
```bash
|
|
8
6
|
npm install -g agent-worker
|
|
9
|
-
# or
|
|
10
|
-
bun add -g agent-worker
|
|
11
7
|
```
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
```bash
|
|
10
|
+
# Start an agent, send it a task
|
|
11
|
+
agent-worker new alice -m anthropic/claude-sonnet-4-5
|
|
12
|
+
agent-worker send alice "Refactor the auth module"
|
|
13
|
+
|
|
14
|
+
# Or define a team in YAML and let them collaborate
|
|
15
|
+
agent-worker run review.yaml
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Why agent-worker?
|
|
19
|
+
|
|
20
|
+
Most agent frameworks lock you into a single provider and a single execution model.
|
|
21
|
+
agent-worker gives you **one CLI** that works across backends (Claude CLI, Cursor, Codex, or raw SDK)
|
|
22
|
+
and scales from a single assistant to a team of agents coordinating via @mentions.
|
|
23
|
+
|
|
24
|
+
- **Multi-backend** — Same commands whether your agent runs on Claude CLI, Cursor, Codex, or the Vercel AI SDK
|
|
25
|
+
- **Single & multi-agent** — Start one agent interactively, or define a team workflow in YAML
|
|
26
|
+
- **@mention coordination** — Agents talk to each other naturally: `@reviewer check this`, `@coder fix it`
|
|
27
|
+
- **Shared context** — Channel (messages), documents (workspace), resources (large content) — all agents see the same state
|
|
28
|
+
- **Instance isolation** — Run the same workflow for different PRs/tasks with `--tag`, fully isolated
|
|
29
|
+
- **SDK included** — Use programmatically from TypeScript when the CLI isn't enough
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
## Design Philosophy
|
|
16
32
|
|
|
17
|
-
|
|
18
|
-
|------|----------|-------------|--------------|
|
|
19
|
-
| **Agent** | Single AI assistant | CLI commands | Direct interaction |
|
|
20
|
-
| **Workflow** | Multi-agent collaboration | YAML workflow file | @mention-based |
|
|
33
|
+
The central question we're exploring: **how do you make a system of short-lived agents accumulate progress over time?**
|
|
21
34
|
|
|
22
|
-
|
|
35
|
+
One approach is to give each agent a persistent memory — recall past conversations, learn preferences, build a model of the world. But for engineering work, the value of making an agent more "human-like" is limited. An agent that remembers everything it did last week doesn't necessarily write better code today.
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
So we start from a different assumption: **an agent's lifetime is one tool loop.** It starts, it works, it's gone. No memory, no continuity, no identity.
|
|
25
38
|
|
|
26
|
-
**
|
|
39
|
+
The question then becomes: if each agent is ephemeral, where does the continuity live? Our answer is **collective memory** — not stored in any individual agent, but in the shared artifacts they produce. Channels capture the conversation. Documents hold the evolving workspace. Event logs record what happened. The next agent reads these artifacts, picks up where the last one left off, and pushes forward.
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
This has a property we find compelling: **it scales with the context window.** As models can process more context, agents naturally absorb more of the shared history and make better decisions — without changing a line of code. Contrast this with approaches that program around individual agent limitations (elaborate prompts, rule systems, retrieval hacks). Those techniques solve today's constraints but become dead weight as models improve.
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
We're not building smarter agents. We're building a better environment for agents to work in.
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
### Single Agent
|
|
31
48
|
|
|
32
49
|
```bash
|
|
33
|
-
#
|
|
50
|
+
# Create and interact
|
|
34
51
|
agent-worker new alice -m anthropic/claude-sonnet-4-5
|
|
35
|
-
|
|
36
|
-
# Send a message
|
|
37
52
|
agent-worker send alice "Analyze this codebase"
|
|
53
|
+
agent-worker peek # View conversation
|
|
38
54
|
|
|
39
|
-
#
|
|
40
|
-
agent-worker
|
|
41
|
-
|
|
42
|
-
# Check status
|
|
43
|
-
agent-worker status alice
|
|
55
|
+
# Try without API keys
|
|
56
|
+
agent-worker new -b mock
|
|
57
|
+
agent-worker send a0 "Hello"
|
|
44
58
|
```
|
|
45
59
|
|
|
46
|
-
###
|
|
47
|
-
|
|
48
|
-
Agents can be grouped into **workflows** by defining them in YAML:
|
|
60
|
+
### Multi-Agent Workflow
|
|
49
61
|
|
|
50
62
|
```yaml
|
|
51
63
|
# review.yaml
|
|
52
64
|
agents:
|
|
53
65
|
reviewer:
|
|
54
|
-
|
|
55
|
-
system_prompt:
|
|
66
|
+
model: anthropic/claude-sonnet-4-5
|
|
67
|
+
system_prompt: |
|
|
68
|
+
You are a code reviewer. When you find issues, @coder to fix them.
|
|
56
69
|
|
|
57
70
|
coder:
|
|
58
|
-
|
|
59
|
-
system_prompt:
|
|
71
|
+
model: anthropic/claude-sonnet-4-5
|
|
72
|
+
system_prompt: |
|
|
73
|
+
You are a coder. Fix issues found by the reviewer.
|
|
74
|
+
After fixing, @reviewer to verify.
|
|
75
|
+
|
|
76
|
+
setup:
|
|
77
|
+
- shell: git diff HEAD~1
|
|
78
|
+
as: diff
|
|
79
|
+
|
|
80
|
+
kickoff: |
|
|
81
|
+
PR diff:
|
|
82
|
+
${{ diff }}
|
|
83
|
+
|
|
84
|
+
@reviewer please review these changes.
|
|
60
85
|
```
|
|
61
86
|
|
|
62
87
|
```bash
|
|
63
|
-
# Run workflow agents (workflow name from YAML)
|
|
64
88
|
agent-worker run review.yaml
|
|
65
|
-
|
|
66
|
-
# Send to specific agent in workflow
|
|
67
|
-
agent-worker send reviewer@review "Check this code"
|
|
68
89
|
```
|
|
69
90
|
|
|
70
|
-
|
|
91
|
+
That's it. The reviewer reads the diff, finds issues, @mentions the coder. The coder fixes them, @mentions back. They iterate until done.
|
|
71
92
|
|
|
72
|
-
|
|
93
|
+
## CLI Reference
|
|
73
94
|
|
|
74
|
-
|
|
95
|
+
### Agent Lifecycle
|
|
75
96
|
|
|
76
97
|
```bash
|
|
77
|
-
|
|
78
|
-
agent-worker
|
|
79
|
-
agent-worker
|
|
80
|
-
|
|
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
|
|
98
|
+
agent-worker new <name> [options] # Create agent
|
|
99
|
+
agent-worker stop <target> # Stop agent or workflow
|
|
100
|
+
agent-worker ls [target] # List agents (--all for everything)
|
|
101
|
+
agent-worker status <target> # Agent status
|
|
84
102
|
```
|
|
85
103
|
|
|
86
|
-
|
|
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
|
|
104
|
+
### Communication
|
|
94
105
|
|
|
95
106
|
```bash
|
|
96
|
-
#
|
|
97
|
-
agent-worker
|
|
98
|
-
agent-worker
|
|
99
|
-
|
|
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
|
|
107
|
+
agent-worker send <target> <message> # Send message
|
|
108
|
+
agent-worker send @review "Status?" # Broadcast to workflow
|
|
109
|
+
agent-worker peek [target] # View messages
|
|
110
|
+
```
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
### Shared Documents
|
|
113
|
+
|
|
114
|
+
```bash
|
|
113
115
|
agent-worker doc read <target>
|
|
114
116
|
agent-worker doc write <target> --content "..."
|
|
115
117
|
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
118
|
```
|
|
121
119
|
|
|
122
|
-
###
|
|
120
|
+
### Scheduling
|
|
123
121
|
|
|
124
122
|
```bash
|
|
125
|
-
agent-worker
|
|
126
|
-
agent-worker
|
|
127
|
-
agent-worker
|
|
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
|
|
123
|
+
agent-worker schedule <target> set 30s --prompt "Check CI status"
|
|
124
|
+
agent-worker schedule <target> get
|
|
125
|
+
agent-worker schedule <target> clear
|
|
133
126
|
```
|
|
134
127
|
|
|
135
|
-
###
|
|
128
|
+
### Workflows
|
|
136
129
|
|
|
137
|
-
**Quick testing without API keys:**
|
|
138
130
|
```bash
|
|
139
|
-
agent-worker
|
|
140
|
-
agent-worker
|
|
131
|
+
agent-worker run <file> [--tag tag] # Run once, exit when done
|
|
132
|
+
agent-worker start <file> [--tag tag] # Keep alive after kickoff
|
|
133
|
+
agent-worker start <file> --background # Daemon mode
|
|
141
134
|
```
|
|
142
135
|
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Standalone agent with wakeup schedule
|
|
146
|
-
agent-worker new monitor --wakeup 30s --prompt "Check CI status"
|
|
136
|
+
## Target Syntax
|
|
147
137
|
|
|
148
|
-
|
|
149
|
-
agent-worker schedule monitor set 30s --prompt "Check CI status"
|
|
150
|
-
```
|
|
138
|
+
Agents live in workflows. Standalone agents go into a default `global` workflow.
|
|
151
139
|
|
|
152
|
-
**Send to workflow (broadcast or @mention):**
|
|
153
|
-
```bash
|
|
154
|
-
# Broadcast to entire workflow
|
|
155
|
-
agent-worker send @review "Status update"
|
|
156
|
-
|
|
157
|
-
# @mention specific agents in workflow
|
|
158
|
-
agent-worker send @review "@alice @bob discuss this"
|
|
159
140
|
```
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
141
|
+
alice → alice@global:main (standalone agent)
|
|
142
|
+
alice@review → alice@review:main (agent in "review" workflow)
|
|
143
|
+
alice@review:pr-123 → alice@review:pr-123 (specific instance)
|
|
144
|
+
@review → review workflow (broadcast)
|
|
145
|
+
@review:pr-123 → specific instance
|
|
164
146
|
```
|
|
165
147
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
## 📋 Workflow Mode
|
|
169
|
-
|
|
170
|
-
**Define multi-agent collaboration through YAML workflows.**
|
|
171
|
-
|
|
172
|
-
Perfect for: structured tasks, agent orchestration, reproducible pipelines.
|
|
173
|
-
|
|
174
|
-
### Quick Start
|
|
175
|
-
|
|
176
|
-
```yaml
|
|
177
|
-
# review.yaml
|
|
178
|
-
agents:
|
|
179
|
-
reviewer:
|
|
180
|
-
backend: claude
|
|
181
|
-
system_prompt: You are a code reviewer. Provide constructive feedback.
|
|
182
|
-
|
|
183
|
-
coder:
|
|
184
|
-
backend: cursor
|
|
185
|
-
model: sonnet-4.5
|
|
186
|
-
system_prompt: You implement code changes based on feedback.
|
|
187
|
-
|
|
188
|
-
kickoff: |
|
|
189
|
-
@reviewer Review the recent changes and provide feedback.
|
|
190
|
-
@coder Implement the suggested improvements.
|
|
191
|
-
```
|
|
148
|
+
Use `--tag` to run isolated instances of the same workflow:
|
|
192
149
|
|
|
193
150
|
```bash
|
|
194
|
-
|
|
195
|
-
agent-worker run review.yaml
|
|
196
|
-
|
|
197
|
-
# Run and keep agents alive
|
|
198
|
-
agent-worker start review.yaml
|
|
199
|
-
|
|
200
|
-
# Run in background
|
|
201
|
-
agent-worker start review.yaml --background
|
|
151
|
+
agent-worker run review.yaml --tag pr-123
|
|
152
|
+
agent-worker run review.yaml --tag pr-456 # Completely independent
|
|
202
153
|
```
|
|
203
154
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
Run the same workflow definition with different contexts:
|
|
155
|
+
## Backends
|
|
207
156
|
|
|
208
157
|
```bash
|
|
209
|
-
|
|
210
|
-
agent-worker
|
|
211
|
-
agent-worker
|
|
212
|
-
|
|
213
|
-
#
|
|
214
|
-
├── .workflow/
|
|
215
|
-
│ └── review/
|
|
216
|
-
│ ├── pr-123/ # Independent channel + documents
|
|
217
|
-
│ └── pr-456/ # Independent channel + documents
|
|
158
|
+
agent-worker new alice -m anthropic/claude-sonnet-4-5 # Vercel AI SDK (default)
|
|
159
|
+
agent-worker new alice -b claude # Claude CLI
|
|
160
|
+
agent-worker new alice -b cursor # Cursor Agent
|
|
161
|
+
agent-worker new alice -b codex # OpenAI Codex
|
|
162
|
+
agent-worker new alice -b mock # No API calls (testing)
|
|
218
163
|
```
|
|
219
164
|
|
|
220
|
-
|
|
165
|
+
| Capability | SDK | Claude CLI | Cursor | Codex | Mock |
|
|
166
|
+
|------------|-----|-----------|--------|-------|------|
|
|
167
|
+
| Custom tools | Yes | Via MCP | No | No | Yes |
|
|
168
|
+
| Streaming | Yes | Yes | Yes | Yes | No |
|
|
169
|
+
| Token tracking | Yes | Partial | No | No | Yes |
|
|
170
|
+
| Skills import | Yes | Filesystem | Filesystem | Filesystem | Yes |
|
|
171
|
+
|
|
172
|
+
## Workflow YAML
|
|
173
|
+
|
|
174
|
+
### Full Structure
|
|
221
175
|
|
|
222
176
|
```yaml
|
|
223
|
-
#
|
|
224
|
-
name: code-review # Optional, defaults to filename
|
|
177
|
+
name: my-workflow # Optional, defaults to filename
|
|
225
178
|
|
|
226
179
|
agents:
|
|
227
180
|
alice:
|
|
228
|
-
backend: sdk | claude | cursor | codex | mock
|
|
229
|
-
model: anthropic/claude-sonnet-4-5
|
|
230
|
-
system_prompt:
|
|
231
|
-
|
|
232
|
-
tools: [bash, read, write]
|
|
181
|
+
backend: sdk # sdk | claude | cursor | codex | mock
|
|
182
|
+
model: anthropic/claude-sonnet-4-5 # Required for SDK backend
|
|
183
|
+
system_prompt: You are Alice.
|
|
184
|
+
system_prompt_file: ./prompts/alice.txt # Or load from file
|
|
185
|
+
tools: [bash, read, write] # CLI backend tool names
|
|
233
186
|
max_tokens: 8000
|
|
234
187
|
max_steps: 20
|
|
235
188
|
|
|
236
|
-
bob:
|
|
237
|
-
backend: claude
|
|
238
|
-
system_prompt_file: ./prompts/bob.txt # Load from file
|
|
239
|
-
|
|
240
|
-
# Context configuration (shared channel + documents)
|
|
241
189
|
context:
|
|
242
190
|
provider: file
|
|
243
191
|
config:
|
|
244
192
|
dir: ./.workflow/${{ workflow.name }}/${{ workflow.tag }}/ # Ephemeral
|
|
245
|
-
#
|
|
246
|
-
bind: ./data/${{ workflow.tag }}/ # Persistent (survives shutdown)
|
|
193
|
+
bind: ./data/ # Persistent
|
|
247
194
|
|
|
248
|
-
# Setup commands (run before kickoff)
|
|
249
195
|
setup:
|
|
250
|
-
- shell: git log --oneline -10
|
|
251
|
-
as: recent_commits # Store output as variable
|
|
252
|
-
|
|
253
196
|
- shell: git diff main...HEAD
|
|
254
|
-
as: changes
|
|
197
|
+
as: changes # Store output as variable
|
|
198
|
+
- shell: echo "$PR_NUMBER"
|
|
199
|
+
as: pr_num
|
|
255
200
|
|
|
256
|
-
# Kickoff message (starts the workflow)
|
|
257
201
|
kickoff: |
|
|
258
|
-
@alice Review these changes:
|
|
259
|
-
|
|
260
|
-
Recent commits:
|
|
261
|
-
${{ recent_commits }}
|
|
262
|
-
|
|
263
|
-
Diff:
|
|
264
202
|
${{ changes }}
|
|
265
|
-
|
|
266
|
-
@bob Stand by for implementation tasks.
|
|
203
|
+
@alice Review this. @bob Stand by.
|
|
267
204
|
```
|
|
268
205
|
|
|
269
|
-
###
|
|
270
|
-
|
|
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
|
-
```
|
|
287
|
-
|
|
288
|
-
### Variable Interpolation
|
|
289
|
-
|
|
290
|
-
Templates support `${{ variable }}` syntax:
|
|
291
|
-
|
|
292
|
-
```yaml
|
|
293
|
-
setup:
|
|
294
|
-
- shell: echo "pr-${{ env.PR_NUMBER }}"
|
|
295
|
-
as: branch_name
|
|
296
|
-
|
|
297
|
-
kickoff: |
|
|
298
|
-
Workflow: ${{ workflow.name }}
|
|
299
|
-
Tag: ${{ workflow.tag }}
|
|
300
|
-
Branch: ${{ branch_name }}
|
|
301
|
-
```
|
|
206
|
+
### Variables
|
|
302
207
|
|
|
303
|
-
|
|
304
|
-
- `${{ workflow.
|
|
305
|
-
- `${{
|
|
306
|
-
- `${{
|
|
307
|
-
- `${{ task_output }}` - Setup task output (via `as:` field)
|
|
208
|
+
- `${{ workflow.name }}` — Workflow name
|
|
209
|
+
- `${{ workflow.tag }}` — Instance tag
|
|
210
|
+
- `${{ env.VAR }}` — Environment variable
|
|
211
|
+
- `${{ task_output }}` — Setup task output (via `as:` field)
|
|
308
212
|
|
|
309
213
|
### Coordination Patterns
|
|
310
214
|
|
|
311
|
-
**Sequential
|
|
215
|
+
**Sequential** — One agent finishes, @mentions the next:
|
|
312
216
|
```yaml
|
|
313
|
-
kickoff:
|
|
314
|
-
|
|
217
|
+
kickoff: "@alice Start the analysis."
|
|
218
|
+
# Alice: "Done! @bob your turn to implement."
|
|
315
219
|
```
|
|
316
|
-
Alice's message: "Done! @bob your turn"
|
|
317
220
|
|
|
318
|
-
**Parallel
|
|
221
|
+
**Parallel** — Multiple agents work simultaneously:
|
|
319
222
|
```yaml
|
|
320
|
-
kickoff:
|
|
321
|
-
@alice @bob @charlie All review this code.
|
|
223
|
+
kickoff: "@alice @bob @charlie All review this code."
|
|
322
224
|
```
|
|
323
225
|
|
|
324
|
-
**Document-based
|
|
226
|
+
**Document-based** — Agents collaborate through shared documents:
|
|
325
227
|
```yaml
|
|
326
|
-
agents:
|
|
327
|
-
writer:
|
|
328
|
-
system_prompt: Write analysis to the shared document.
|
|
329
|
-
|
|
330
|
-
reviewer:
|
|
331
|
-
system_prompt: Read the document and provide feedback.
|
|
332
|
-
|
|
333
228
|
context:
|
|
334
229
|
provider: file
|
|
335
230
|
config:
|
|
336
|
-
bind: ./results/
|
|
231
|
+
bind: ./results/ # Persistent across runs
|
|
337
232
|
```
|
|
338
233
|
|
|
339
|
-
|
|
340
|
-
|
|
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.
|
|
348
|
-
|
|
349
|
-
setup:
|
|
350
|
-
- shell: gh pr diff ${{ env.PR_NUMBER }}
|
|
351
|
-
as: diff
|
|
352
|
-
|
|
353
|
-
kickoff: |
|
|
354
|
-
@reviewer Review this PR:
|
|
355
|
-
|
|
356
|
-
${{ diff }}
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
```bash
|
|
360
|
-
PR_NUMBER=123 agent-worker run review.yaml --tag pr-123
|
|
361
|
-
```
|
|
362
|
-
|
|
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.
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
---
|
|
388
|
-
|
|
389
|
-
## 🔧 SDK Usage
|
|
390
|
-
|
|
391
|
-
For programmatic control (TypeScript/JavaScript):
|
|
234
|
+
## SDK Usage
|
|
392
235
|
|
|
393
236
|
```typescript
|
|
394
237
|
import { AgentWorker } from 'agent-worker'
|
|
395
238
|
|
|
396
|
-
const
|
|
239
|
+
const agent = new AgentWorker({
|
|
397
240
|
model: 'anthropic/claude-sonnet-4-5',
|
|
398
241
|
system: 'You are a helpful assistant.',
|
|
399
|
-
tools: [/* your tools */]
|
|
242
|
+
tools: [/* your tools */],
|
|
400
243
|
})
|
|
401
244
|
|
|
402
|
-
//
|
|
403
|
-
const response = await
|
|
245
|
+
// Request-response
|
|
246
|
+
const response = await agent.send('Hello')
|
|
404
247
|
console.log(response.content)
|
|
405
|
-
console.log(response.toolCalls)
|
|
406
|
-
console.log(response.usage)
|
|
407
248
|
|
|
408
|
-
//
|
|
409
|
-
for await (const chunk of
|
|
249
|
+
// Streaming
|
|
250
|
+
for await (const chunk of agent.sendStream('Tell me a story')) {
|
|
410
251
|
process.stdout.write(chunk)
|
|
411
252
|
}
|
|
412
|
-
|
|
413
|
-
// State management
|
|
414
|
-
const state = session.getState()
|
|
415
|
-
// Later: restore from state
|
|
416
253
|
```
|
|
417
254
|
|
|
418
255
|
### With Skills
|
|
@@ -420,67 +257,52 @@ const state = session.getState()
|
|
|
420
257
|
```typescript
|
|
421
258
|
import { AgentWorker, SkillsProvider, createSkillsTool } from 'agent-worker'
|
|
422
259
|
|
|
423
|
-
const
|
|
424
|
-
await
|
|
260
|
+
const skills = new SkillsProvider()
|
|
261
|
+
await skills.scanDirectory('.agents/skills')
|
|
425
262
|
|
|
426
|
-
const
|
|
263
|
+
const agent = new AgentWorker({
|
|
427
264
|
model: 'anthropic/claude-sonnet-4-5',
|
|
428
265
|
system: 'You are a helpful assistant.',
|
|
429
|
-
tools: [createSkillsTool(
|
|
266
|
+
tools: [createSkillsTool(skills)],
|
|
430
267
|
})
|
|
431
268
|
```
|
|
432
269
|
|
|
433
|
-
|
|
270
|
+
### Programmatic Workflows
|
|
434
271
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
| **Best For** | Interactive tasks, testing | Structured workflows, automation |
|
|
272
|
+
```typescript
|
|
273
|
+
import { parseWorkflowFile, runWorkflowWithControllers } from 'agent-worker'
|
|
274
|
+
|
|
275
|
+
const workflow = await parseWorkflowFile('review.yaml', { tag: 'pr-123' })
|
|
276
|
+
const result = await runWorkflowWithControllers({
|
|
277
|
+
workflow,
|
|
278
|
+
workflowName: 'review',
|
|
279
|
+
tag: 'pr-123',
|
|
280
|
+
mode: 'run',
|
|
281
|
+
})
|
|
446
282
|
|
|
447
|
-
|
|
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
|
|
283
|
+
console.log(result.success, result.duration)
|
|
453
284
|
```
|
|
454
285
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
## 🎯 Model Formats
|
|
286
|
+
## Model Formats
|
|
458
287
|
|
|
459
288
|
```bash
|
|
460
|
-
agent-worker new -m anthropic/claude-sonnet-4-5
|
|
461
|
-
agent-worker new -m anthropic
|
|
462
|
-
agent-worker new -m deepseek:deepseek-chat
|
|
289
|
+
agent-worker new -m anthropic/claude-sonnet-4-5 # Gateway format (recommended)
|
|
290
|
+
agent-worker new -m anthropic # Provider shorthand (uses frontier)
|
|
291
|
+
agent-worker new -m deepseek:deepseek-chat # Direct provider format
|
|
463
292
|
```
|
|
464
293
|
|
|
465
|
-
---
|
|
466
|
-
|
|
467
|
-
## 📚 Documentation
|
|
468
|
-
|
|
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 |
|
|
475
|
-
|
|
476
|
-
---
|
|
477
|
-
|
|
478
294
|
## Requirements
|
|
479
295
|
|
|
480
296
|
- Node.js 18+ or Bun
|
|
481
|
-
- API key for chosen provider (e.g., `ANTHROPIC_API_KEY`)
|
|
297
|
+
- API key for your chosen provider (e.g., `ANTHROPIC_API_KEY`)
|
|
298
|
+
|
|
299
|
+
## Documentation
|
|
482
300
|
|
|
483
|
-
|
|
301
|
+
- [ARCHITECTURE.md](./ARCHITECTURE.md) — System architecture
|
|
302
|
+
- [docs/backends.md](./docs/backends.md) — Backend comparison
|
|
303
|
+
- [docs/workflow/](./docs/workflow/) — Workflow system design
|
|
304
|
+
- [TEST-ARCHITECTURE.md](./TEST-ARCHITECTURE.md) — Testing strategy
|
|
305
|
+
- [examples/](./examples/) — Example workflows
|
|
484
306
|
|
|
485
307
|
## License
|
|
486
308
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { C as CLAUDE_MODEL_MAP, D as SDK_MODEL_ALIASES, E as OPENCODE_MODEL_MAP, O as getModelForBackend, S as BACKEND_DEFAULT_MODELS, T as CURSOR_MODEL_MAP, _ as extractCodexResult, a as createMockBackend, b as execWithIdleTimeout, c as extractOpenCodeResult, d as CodexBackend, f as ClaudeCodeBackend, g as extractClaudeResult, h as createStreamParser, i as MockAIBackend, k as normalizeBackendType, l as opencodeAdapter, m as codexAdapter, n as createBackend, o as SdkBackend, p as claudeAdapter, r as listBackends, s as OpenCodeBackend, t as checkBackends, u as CursorBackend, v as formatEvent, w as CODEX_MODEL_MAP, x as DEFAULT_IDLE_TIMEOUT, y as IdleTimeoutError } from "./backends-CziIqKRg.mjs";
|
|
2
|
+
|
|
3
|
+
export { listBackends };
|