agent-worker 0.17.0 → 0.19.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 +49 -38
- package/dist/cli/index.mjs +208 -4320
- package/dist/client-DAKkzdOn.mjs +171 -0
- package/dist/daemon-CwaHgxs6.mjs +1071 -0
- package/dist/index.d.mts +249 -849
- package/dist/index.mjs +27 -1102
- package/dist/output-B0mwPqjv.mjs +20 -0
- package/dist/rolldown-runtime-wcPFST8Q.mjs +13 -0
- package/dist/target-9yiBRXxa.mjs +105 -0
- package/package.json +25 -37
- package/dist/backends-D7DT0uox.mjs +0 -1484
- package/dist/backends-DUvcm-ce.mjs +0 -3
- package/dist/context-CoRTddGx.mjs +0 -4
- package/dist/create-tool-gcUuI1FD.mjs +0 -32
- package/dist/display-pretty-Kyd40DEF.mjs +0 -190
- package/dist/memory-provider-Z9D8NdwS.mjs +0 -75
- package/dist/runner-BmT0Y8MD.mjs +0 -690
- package/dist/workflow-LOZUlaDo.mjs +0 -744
package/README.md
CHANGED
|
@@ -162,39 +162,39 @@ agent-worker new alice -b codex # OpenAI Codex
|
|
|
162
162
|
agent-worker new alice -b mock # No API calls (testing)
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
| Capability
|
|
166
|
-
|
|
167
|
-
| Custom tools
|
|
168
|
-
| Streaming
|
|
169
|
-
| Token tracking | Yes | Partial
|
|
170
|
-
| Skills import
|
|
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
171
|
|
|
172
172
|
## Workflow YAML
|
|
173
173
|
|
|
174
174
|
### Full Structure
|
|
175
175
|
|
|
176
176
|
```yaml
|
|
177
|
-
name: my-workflow
|
|
177
|
+
name: my-workflow # Optional, defaults to filename
|
|
178
178
|
|
|
179
179
|
agents:
|
|
180
180
|
alice:
|
|
181
|
-
backend: sdk
|
|
182
|
-
model: anthropic/claude-sonnet-4-5
|
|
181
|
+
backend: sdk # sdk | claude | cursor | codex | mock
|
|
182
|
+
model: anthropic/claude-sonnet-4-5 # Required for SDK backend
|
|
183
183
|
system_prompt: You are Alice.
|
|
184
|
-
system_prompt_file: ./prompts/alice.txt
|
|
185
|
-
tools: [bash, read, write]
|
|
184
|
+
system_prompt_file: ./prompts/alice.txt # Or load from file
|
|
185
|
+
tools: [bash, read, write] # CLI backend tool names
|
|
186
186
|
max_tokens: 8000
|
|
187
187
|
max_steps: 20
|
|
188
188
|
|
|
189
189
|
context:
|
|
190
190
|
provider: file
|
|
191
191
|
config:
|
|
192
|
-
dir: ./.workflow/${{ workflow.name }}/${{ workflow.tag }}/
|
|
193
|
-
bind: ./data/
|
|
192
|
+
dir: ./.workflow/${{ workflow.name }}/${{ workflow.tag }}/ # Ephemeral
|
|
193
|
+
bind: ./data/ # Persistent
|
|
194
194
|
|
|
195
195
|
setup:
|
|
196
196
|
- shell: git diff main...HEAD
|
|
197
|
-
as: changes
|
|
197
|
+
as: changes # Store output as variable
|
|
198
198
|
- shell: echo "$PR_NUMBER"
|
|
199
199
|
as: pr_num
|
|
200
200
|
|
|
@@ -213,74 +213,85 @@ kickoff: |
|
|
|
213
213
|
### Coordination Patterns
|
|
214
214
|
|
|
215
215
|
**Sequential** — One agent finishes, @mentions the next:
|
|
216
|
+
|
|
216
217
|
```yaml
|
|
217
218
|
kickoff: "@alice Start the analysis."
|
|
218
219
|
# Alice: "Done! @bob your turn to implement."
|
|
219
220
|
```
|
|
220
221
|
|
|
221
222
|
**Parallel** — Multiple agents work simultaneously:
|
|
223
|
+
|
|
222
224
|
```yaml
|
|
223
225
|
kickoff: "@alice @bob @charlie All review this code."
|
|
224
226
|
```
|
|
225
227
|
|
|
226
228
|
**Document-based** — Agents collaborate through shared documents:
|
|
229
|
+
|
|
227
230
|
```yaml
|
|
228
231
|
context:
|
|
229
232
|
provider: file
|
|
230
233
|
config:
|
|
231
|
-
bind: ./results/
|
|
234
|
+
bind: ./results/ # Persistent across runs
|
|
232
235
|
```
|
|
233
236
|
|
|
234
237
|
## SDK Usage
|
|
235
238
|
|
|
236
239
|
```typescript
|
|
237
|
-
import { AgentWorker } from
|
|
240
|
+
import { AgentWorker } from "agent-worker";
|
|
238
241
|
|
|
239
242
|
const agent = new AgentWorker({
|
|
240
|
-
model:
|
|
241
|
-
system:
|
|
242
|
-
tools: [
|
|
243
|
-
|
|
243
|
+
model: "anthropic/claude-sonnet-4-5",
|
|
244
|
+
system: "You are a helpful assistant.",
|
|
245
|
+
tools: [
|
|
246
|
+
/* your tools */
|
|
247
|
+
],
|
|
248
|
+
});
|
|
244
249
|
|
|
245
250
|
// Request-response
|
|
246
|
-
const response = await agent.send(
|
|
247
|
-
console.log(response.content)
|
|
251
|
+
const response = await agent.send("Hello");
|
|
252
|
+
console.log(response.content);
|
|
248
253
|
|
|
249
254
|
// Streaming
|
|
250
|
-
for await (const chunk of agent.sendStream(
|
|
251
|
-
process.stdout.write(chunk)
|
|
255
|
+
for await (const chunk of agent.sendStream("Tell me a story")) {
|
|
256
|
+
process.stdout.write(chunk);
|
|
252
257
|
}
|
|
253
258
|
```
|
|
254
259
|
|
|
255
260
|
### With Skills
|
|
256
261
|
|
|
257
262
|
```typescript
|
|
258
|
-
import { AgentWorker,
|
|
263
|
+
import { AgentWorker, createSkillTool } from "agent-worker";
|
|
264
|
+
import { createBashTool } from "bash-tool";
|
|
265
|
+
|
|
266
|
+
// Discover skills and collect files for bash sandbox
|
|
267
|
+
const { skill, files, instructions } = await createSkillTool({
|
|
268
|
+
skillsDirectory: ".agents/skills",
|
|
269
|
+
});
|
|
259
270
|
|
|
260
|
-
|
|
261
|
-
await
|
|
271
|
+
// Create bash tool with skill files available
|
|
272
|
+
const { tools } = await createBashTool({ files, extraInstructions: instructions });
|
|
262
273
|
|
|
263
274
|
const agent = new AgentWorker({
|
|
264
|
-
model:
|
|
265
|
-
system:
|
|
266
|
-
tools:
|
|
267
|
-
})
|
|
275
|
+
model: "anthropic/claude-sonnet-4-5",
|
|
276
|
+
system: "You are a helpful assistant.",
|
|
277
|
+
tools: { skill, ...tools },
|
|
278
|
+
});
|
|
268
279
|
```
|
|
269
280
|
|
|
270
281
|
### Programmatic Workflows
|
|
271
282
|
|
|
272
283
|
```typescript
|
|
273
|
-
import { parseWorkflowFile, runWorkflowWithLoops } from
|
|
284
|
+
import { parseWorkflowFile, runWorkflowWithLoops } from "agent-worker";
|
|
274
285
|
|
|
275
|
-
const workflow = await parseWorkflowFile(
|
|
286
|
+
const workflow = await parseWorkflowFile("review.yaml", { tag: "pr-123" });
|
|
276
287
|
const result = await runWorkflowWithLoops({
|
|
277
288
|
workflow,
|
|
278
|
-
workflowName:
|
|
279
|
-
tag:
|
|
280
|
-
mode:
|
|
281
|
-
})
|
|
289
|
+
workflowName: "review",
|
|
290
|
+
tag: "pr-123",
|
|
291
|
+
mode: "run",
|
|
292
|
+
});
|
|
282
293
|
|
|
283
|
-
console.log(result.success, result.duration)
|
|
294
|
+
console.log(result.success, result.duration);
|
|
284
295
|
```
|
|
285
296
|
|
|
286
297
|
## Model Formats
|