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 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 | 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 |
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 # Optional, defaults to filename
177
+ name: my-workflow # Optional, defaults to filename
178
178
 
179
179
  agents:
180
180
  alice:
181
- backend: sdk # sdk | claude | cursor | codex | mock
182
- model: anthropic/claude-sonnet-4-5 # Required for SDK backend
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 # Or load from file
185
- tools: [bash, read, write] # CLI backend tool names
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 }}/ # Ephemeral
193
- bind: ./data/ # Persistent
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 # Store output as variable
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/ # Persistent across runs
234
+ bind: ./results/ # Persistent across runs
232
235
  ```
233
236
 
234
237
  ## SDK Usage
235
238
 
236
239
  ```typescript
237
- import { AgentWorker } from 'agent-worker'
240
+ import { AgentWorker } from "agent-worker";
238
241
 
239
242
  const agent = new AgentWorker({
240
- model: 'anthropic/claude-sonnet-4-5',
241
- system: 'You are a helpful assistant.',
242
- tools: [/* your 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('Hello')
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('Tell me a story')) {
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, SkillsProvider, createSkillsTool } from 'agent-worker'
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
- const skills = new SkillsProvider()
261
- await skills.scanDirectory('.agents/skills')
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: 'anthropic/claude-sonnet-4-5',
265
- system: 'You are a helpful assistant.',
266
- tools: [createSkillsTool(skills)],
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 'agent-worker'
284
+ import { parseWorkflowFile, runWorkflowWithLoops } from "agent-worker";
274
285
 
275
- const workflow = await parseWorkflowFile('review.yaml', { tag: 'pr-123' })
286
+ const workflow = await parseWorkflowFile("review.yaml", { tag: "pr-123" });
276
287
  const result = await runWorkflowWithLoops({
277
288
  workflow,
278
- workflowName: 'review',
279
- tag: 'pr-123',
280
- mode: 'run',
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