agent-worker 0.3.0 → 0.5.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
@@ -1,6 +1,6 @@
1
1
  # agent-worker
2
2
 
3
- CLI and SDK for creating and managing AI agent sessions with multiple backends.
3
+ CLI and SDK for running AI agents from standalone instances to collaborative workflows.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,300 +10,385 @@ npm install -g agent-worker
10
10
  bun add -g agent-worker
11
11
  ```
12
12
 
13
- ## CLI Usage
13
+ ## Two Modes of Operation
14
14
 
15
- ### Session Management
15
+ agent-worker supports two distinct usage patterns:
16
16
 
17
- ```bash
18
- # Create a session (SDK backend, default)
19
- agent-worker session new -m anthropic/claude-sonnet-4-5
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
- # Create with system prompt from file
25
- agent-worker session new -f ./prompts/reviewer.txt
22
+ ---
26
23
 
27
- # Create named session
28
- agent-worker session new -n my-session
24
+ ## 🤖 Agent Mode
29
25
 
30
- # Create with Claude CLI backend
31
- agent-worker session new -b claude
26
+ **Run individual AI agents as standalone instances.**
32
27
 
33
- # List all sessions
34
- agent-worker session list
28
+ Perfect for: testing, prototyping, interactive Q&A, code assistance.
35
29
 
36
- # Switch default session
37
- agent-worker session use my-session
30
+ ### Quick Start
38
31
 
39
- # Check session status
40
- agent-worker session status
32
+ ```bash
33
+ # Start an agent
34
+ agent-worker new alice -m anthropic/claude-sonnet-4-5
41
35
 
42
- # End session
43
- agent-worker session end
36
+ # Send a message
37
+ agent-worker send alice "Analyze this codebase"
44
38
 
45
- # End specific session
46
- agent-worker session end my-session
39
+ # View conversation
40
+ agent-worker peek
47
41
 
48
- # End all sessions
49
- agent-worker session end --all
42
+ # Check status
43
+ agent-worker status alice
50
44
  ```
51
45
 
52
- ### Sending Messages
53
-
54
- ```bash
55
- # Send to current session (async by default - returns immediately)
56
- agent-worker send "Analyze this codebase"
46
+ ### Organizing Agents
57
47
 
58
- # Send to specific session
59
- agent-worker send "Explain recursion" --to my-session
48
+ Agents can be grouped into **workflows** by defining them in YAML:
60
49
 
61
- # Send and wait for response (synchronous mode)
62
- agent-worker send "What is 2+2?" --wait
50
+ ```yaml
51
+ # review.yaml
52
+ agents:
53
+ reviewer:
54
+ backend: claude
55
+ system_prompt: You are a code reviewer.
63
56
 
64
- # Send with debug logging (useful for troubleshooting)
65
- agent-worker send "Debug this" --debug
66
-
67
- # View conversation messages
68
- agent-worker peek # Show last 10 messages (default)
69
- agent-worker peek --last 5 # Show last 5 messages
70
- agent-worker peek --all # Show all messages
71
- agent-worker peek --find "error" # Search messages containing "error"
72
-
73
- # View token usage
74
- agent-worker stats
57
+ coder:
58
+ backend: cursor
59
+ system_prompt: You are a code implementer.
60
+ ```
75
61
 
76
- # Export transcript
77
- agent-worker export > transcript.json
62
+ ```bash
63
+ # Run workflow agents (workflow name from YAML)
64
+ agent-worker run review.yaml
78
65
 
79
- # Clear messages (keep session)
80
- agent-worker clear
66
+ # Send to specific agent in workflow
67
+ agent-worker send reviewer@review "Check this code"
81
68
  ```
82
69
 
83
- **Understanding Message Flow:**
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).
84
71
 
85
- The CLI supports two modes for sending messages:
72
+ ### Multiple Instances (workflow:tag)
86
73
 
87
- 1. **Asynchronous (default)**: The command returns immediately after sending. The agent processes in the background. Use `peek` to view the response.
88
- ```bash
89
- # Send message (returns immediately)
90
- agent-worker send "Analyze this large codebase"
91
- # Output: "Message sent. Use 'peek' command to view response."
74
+ Run multiple isolated instances of the same workflow using **tags**:
92
75
 
93
- # View response later
94
- agent-worker peek --last 2
95
- ```
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
96
80
 
97
- 2. **Synchronous (`--wait`)**: The command waits for the agent to fully process the message and return a response. This is best for quick questions when you need immediate results.
98
- ```bash
99
- agent-worker send "What is 2+2?" --wait
100
- # Waits for response, then prints: 4
101
- ```
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
84
+ ```
102
85
 
103
- **Troubleshooting:**
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
104
92
 
105
- If `send` appears stuck or times out, use `--debug` to see what's happening:
93
+ ### Agent Commands
106
94
 
107
95
  ```bash
108
- agent-worker send "test message" --debug
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
109
120
  ```
110
121
 
111
- Debug output shows:
112
- - Session lookup and connection status
113
- - Socket communication
114
- - Request/response timing
115
- - Error details
116
-
117
- **Backend Limitations:**
118
-
119
- The CLI supports two backend types:
120
-
121
- 1. **SDK Backend (default)**: Full-featured, works in all environments. Requires `ANTHROPIC_API_KEY` environment variable.
122
-
123
- 2. **Claude CLI Backend (`-b claude`)**: Uses `claude -p` for non-interactive mode.
124
- - **Known limitation**: May not work properly within Claude Code environment itself due to command interception
125
- - **Timeout**: Async requests timeout after 60 seconds to prevent indefinite hangs
126
- - **Recommended use**: Normal terminal environments outside Claude Code
127
- - **For testing**: Use SDK backend instead when developing within Claude Code
128
-
129
- If you see messages stuck in `(processing...)` state for more than 60 seconds, it indicates a backend issue. The message will automatically update to show a timeout error.
130
-
131
- ### Tool Management (SDK Backend Only)
122
+ ### Backend Options
132
123
 
133
124
  ```bash
134
- # Add a tool
135
- agent-worker tool add get_weather \
136
- -d "Get weather for a location" \
137
- -p "location:string:City name"
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
+ ```
138
134
 
139
- # Add tool requiring approval
140
- agent-worker tool add delete_file \
141
- -d "Delete a file" \
142
- -p "path:string:File path" \
143
- --needs-approval
135
+ ### Examples
144
136
 
145
- # Import tools from file
146
- agent-worker tool import ./my-tools.ts
137
+ **Quick testing without API keys:**
138
+ ```bash
139
+ agent-worker new -b mock
140
+ agent-worker send a0 "Hello"
141
+ ```
147
142
 
148
- # Mock tool response (for testing)
149
- agent-worker tool mock get_weather '{"temp": 72, "condition": "sunny"}'
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"
150
147
 
151
- # List registered tools
152
- agent-worker tool list
148
+ # Or schedule existing agent
149
+ agent-worker schedule monitor set 30s --prompt "Check CI status"
153
150
  ```
154
151
 
155
- ### Approval Workflow
156
-
152
+ **Send to workflow (broadcast or @mention):**
157
153
  ```bash
158
- # Check pending approvals
159
- agent-worker pending
154
+ # Broadcast to entire workflow
155
+ agent-worker send @review "Status update"
160
156
 
161
- # Approve a tool call
162
- agent-worker approve <approval-id>
157
+ # @mention specific agents in workflow
158
+ agent-worker send @review "@alice @bob discuss this"
159
+ ```
163
160
 
164
- # Deny with reason
165
- agent-worker deny <approval-id> -r "Path not allowed"
161
+ **Feedback-enabled agent (reports observations):**
162
+ ```bash
163
+ agent-worker new -m anthropic/claude-sonnet-4-5 --feedback
166
164
  ```
167
165
 
168
- ### Agent Skills
166
+ ---
169
167
 
170
- Agent skills provide reusable instructions and methodologies that agents can access on demand. Compatible with the [Agent Skills](https://agentskills.io) ecosystem.
168
+ ## 📋 Workflow Mode
171
169
 
172
- ```bash
173
- # Load skills from default directories (.agents/skills, .claude/skills, ~/.agents/skills)
174
- agent-worker session new
170
+ **Define multi-agent collaboration through YAML workflows.**
175
171
 
176
- # Add a specific skill directory
177
- agent-worker session new --skill ./my-skills/custom-skill
172
+ Perfect for: structured tasks, agent orchestration, reproducible pipelines.
178
173
 
179
- # Scan additional directories for skills
180
- agent-worker session new --skill-dir ./team-skills --skill-dir ~/shared-skills
174
+ ### Quick Start
181
175
 
182
- # Combine multiple options
183
- agent-worker session new \
184
- --skill ./my-skills/dive \
185
- --skill-dir ~/company-skills
176
+ ```yaml
177
+ # review.yaml
178
+ agents:
179
+ reviewer:
180
+ backend: claude
181
+ system_prompt: You are a code reviewer. Provide constructive feedback.
186
182
 
187
- # Import skills from Git repositories (temporary, session-scoped)
188
- agent-worker session new --import-skill vercel-labs/agent-skills:dive
189
- agent-worker session new --import-skill lidessen/skills:{memory,orientation}
190
- agent-worker session new --import-skill gitlab:myorg/skills@v1.0.0:custom
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
191
  ```
192
192
 
193
- **Import Skill Spec Format:**
193
+ ```bash
194
+ # Run once and exit
195
+ agent-worker run review.yaml
194
196
 
195
- The `--import-skill` option supports temporary skill imports from Git repositories. Skills are cloned to a session-specific temp directory and cleaned up when the session ends.
197
+ # Run and keep agents alive
198
+ agent-worker start review.yaml
196
199
 
200
+ # Run in background
201
+ agent-worker start review.yaml --background
197
202
  ```
198
- [provider:]owner/repo[@ref]:{skill1,skill2,...}
199
- ```
200
-
201
- Examples:
202
- - `vercel-labs/agent-skills` - Import all skills from GitHub main branch
203
- - `vercel-labs/agent-skills:dive` - Import single skill
204
- - `vercel-labs/agent-skills:{dive,memory}` - Import multiple skills (brace expansion)
205
- - `vercel-labs/agent-skills@v1.0.0:dive` - Import from specific tag/branch
206
- - `gitlab:myorg/skills:custom` - Import from GitLab
207
- - `gitee:org/repo@dev:{a,b}` - Import from Gitee dev branch
208
203
 
209
- Supported providers: `github` (default), `gitlab`, `gitee`
204
+ ### Workflow Instances (Tags)
210
205
 
211
- **Skills Support by Backend:**
206
+ Run the same workflow definition with different contexts:
212
207
 
213
- | Backend | Skills Support | How It Works | `--import-skill` |
214
- |---------|----------------|--------------|------------------|
215
- | **SDK** (default) | ✅ Full | Skills loaded as a tool that agents can call | ✅ Supported |
216
- | **Claude CLI** | ✅ Full | Loads from `.claude/skills/` and `~/.claude/skills/` | ⚠️ Manual install required |
217
- | **Codex CLI** | ✅ Full | Loads from `.agents/skills/`, `~/.codex/skills/`, `~/.agents/skills/` | ⚠️ Manual install required |
218
- | **Cursor CLI** | ✅ Full | Loads from `.agents/skills/` and `~/.cursor/skills/` | ⚠️ Manual install required |
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
+ ```
219
219
 
220
- **Notes:**
221
- - **SDK Backend**: Skills work through the Skills tool, allowing dynamic file reading. `--import-skill` is fully supported.
222
- - **CLI Backends** (claude, codex, cursor): Skills are loaded from filesystem locations by the CLI tool itself. To use `--import-skill` with these backends, install skills manually using `npx skills add <repo> --global`.
223
- - If you specify `--import-skill` with a CLI backend, agent-worker will show a warning and suggest using SDK backend or manual installation.
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
+ ```
224
268
 
225
- **Default Skill Directories:**
226
- - `.agents/skills/` - Project-level skills (all backends)
227
- - `.claude/skills/` - Claude Code project skills
228
- - `.cursor/skills/` - Cursor project skills
229
- - `~/.agents/skills/` - User-level global skills (all backends)
230
- - `~/.claude/skills/` - User-level Claude skills
231
- - `~/.codex/skills/` - User-level Codex skills
269
+ ### Workflow Commands
232
270
 
233
- **Using Skills in Sessions:**
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
+ ```
234
287
 
235
- Once loaded, agents can interact with skills via the `Skills` tool:
288
+ ### Variable Interpolation
236
289
 
237
- ```typescript
238
- // List available skills
239
- Skills({ operation: 'list' })
290
+ Templates support `${{ variable }}` syntax:
240
291
 
241
- // View a skill's complete instructions
242
- Skills({ operation: 'view', skillName: 'dive' })
292
+ ```yaml
293
+ setup:
294
+ - shell: echo "pr-${{ env.PR_NUMBER }}"
295
+ as: branch_name
243
296
 
244
- // Read skill reference files
245
- Skills({
246
- operation: 'readFile',
247
- skillName: 'dive',
248
- filePath: 'references/search-strategies.md'
249
- })
297
+ kickoff: |
298
+ Workflow: ${{ workflow.name }}
299
+ Tag: ${{ workflow.tag }}
300
+ Branch: ${{ branch_name }}
250
301
  ```
251
302
 
252
- **Installing Skills:**
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)
253
308
 
254
- Use the [skills CLI](https://github.com/vercel-labs/skills) to install skills:
309
+ ### Coordination Patterns
255
310
 
256
- ```bash
257
- # Install from GitHub
258
- npx skills add vercel-labs/agent-skills
311
+ **Sequential handoff:**
312
+ ```yaml
313
+ kickoff: |
314
+ @alice Start the task.
315
+ ```
316
+ Alice's message: "Done! @bob your turn"
259
317
 
260
- # Or use the official skills tool
261
- npm install -g @agentskills/cli
262
- skills add vercel-labs/agent-skills
318
+ **Parallel broadcast:**
319
+ ```yaml
320
+ kickoff: |
321
+ @alice @bob @charlie All review this code.
263
322
  ```
264
323
 
265
- ### Backends
324
+ **Document-based:**
325
+ ```yaml
326
+ agents:
327
+ writer:
328
+ system_prompt: Write analysis to the shared document.
266
329
 
267
- ```bash
268
- # Check available backends
269
- agent-worker backends
330
+ reviewer:
331
+ system_prompt: Read the document and provide feedback.
270
332
 
271
- # Check SDK providers
272
- agent-worker providers
333
+ context:
334
+ provider: file
335
+ config:
336
+ bind: ./results/ # Persistent across runs
273
337
  ```
274
338
 
275
- | Backend | Command | Best For |
276
- |---------|---------|----------|
277
- | SDK (default) | `session new -m provider/model` | Full control, tool injection, mocking |
278
- | Claude CLI | `session new -b claude` | Use existing Claude installation |
279
- | Codex | `session new -b codex` | OpenAI Codex workflows |
280
- | Cursor | `session new -b cursor` | Cursor Agent integration |
339
+ ### Examples
281
340
 
282
- > **⚠️ Important:** Different backends have different capabilities. CLI backends (claude, codex, cursor) don't support:
283
- > - Dynamic tool management (`tool_add`, `tool_mock`, `tool_import`)
284
- > - Approval system (`approve`, `deny`)
285
- > - `--import-skill` (use `npx skills add --global` instead)
286
- >
287
- > See [BACKEND_COMPATIBILITY.md](./BACKEND_COMPATIBILITY.md) for a complete feature comparison.
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.
288
348
 
289
- ### Model Formats (SDK Backend)
349
+ setup:
350
+ - shell: gh pr diff ${{ env.PR_NUMBER }}
351
+ as: diff
290
352
 
291
- ```bash
292
- # Gateway format (recommended)
293
- agent-worker session new -m anthropic/claude-sonnet-4-5
294
- agent-worker session new -m openai/gpt-5.2
353
+ kickoff: |
354
+ @reviewer Review this PR:
295
355
 
296
- # Provider-only (uses frontier model)
297
- agent-worker session new -m anthropic
298
- agent-worker session new -m openai
356
+ ${{ diff }}
357
+ ```
299
358
 
300
- # Direct provider format
301
- agent-worker session new -m deepseek:deepseek-chat
359
+ ```bash
360
+ PR_NUMBER=123 agent-worker run review.yaml --tag pr-123
302
361
  ```
303
362
 
304
- ## SDK Usage
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
+ ---
305
388
 
306
- ### Basic Session
389
+ ## 🔧 SDK Usage
390
+
391
+ For programmatic control (TypeScript/JavaScript):
307
392
 
308
393
  ```typescript
309
394
  import { AgentSession } from 'agent-worker'
@@ -325,123 +410,77 @@ for await (const chunk of session.sendStream('Tell me a story')) {
325
410
  process.stdout.write(chunk)
326
411
  }
327
412
 
328
- // Get state for persistence
413
+ // State management
329
414
  const state = session.getState()
415
+ // Later: restore from state
330
416
  ```
331
417
 
332
418
  ### With Skills
333
419
 
334
420
  ```typescript
335
- import {
336
- AgentSession,
337
- SkillsProvider,
338
- createSkillsTool
339
- } from 'agent-worker'
421
+ import { AgentSession, SkillsProvider, createSkillsTool } from 'agent-worker'
340
422
 
341
- // Setup skills
342
423
  const skillsProvider = new SkillsProvider()
343
424
  await skillsProvider.scanDirectory('.agents/skills')
344
- await skillsProvider.scanDirectory('~/my-skills')
345
-
346
- // Or add individual skills
347
- await skillsProvider.addSkill('./custom-skills/my-skill')
348
425
 
349
- // Create session with Skills tool
350
426
  const session = new AgentSession({
351
427
  model: 'anthropic/claude-sonnet-4-5',
352
428
  system: 'You are a helpful assistant.',
353
- tools: [
354
- createSkillsTool(skillsProvider),
355
- // ... other tools
356
- ]
429
+ tools: [createSkillsTool(skillsProvider)]
357
430
  })
358
-
359
- // Agent can now access skills
360
- const response = await session.send(
361
- 'What skills are available? Use the dive skill to analyze this codebase.'
362
- )
363
431
  ```
364
432
 
365
- ### With Imported Skills
433
+ ---
366
434
 
367
- ```typescript
368
- import {
369
- AgentSession,
370
- SkillsProvider,
371
- SkillImporter,
372
- createSkillsTool
373
- } from 'agent-worker'
374
-
375
- // Setup skills provider
376
- const skillsProvider = new SkillsProvider()
435
+ ## 📊 Comparison: Agent vs Workflow
377
436
 
378
- // Import skills from Git repositories
379
- const sessionId = 'my-session-123'
380
- const importer = new SkillImporter(sessionId)
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 |
381
446
 
382
- // Import from GitHub
383
- await importer.import('vercel-labs/agent-skills:dive')
384
- await importer.import('lidessen/skills:{memory,orientation}')
385
-
386
- // Or import multiple specs at once
387
- await importer.importMultiple([
388
- 'vercel-labs/agent-skills:{dive,react}',
389
- 'gitlab:myorg/skills@v1.0.0:custom'
390
- ])
391
-
392
- // Add imported skills to provider
393
- await skillsProvider.addImportedSkills(importer)
394
-
395
- // Create session
396
- const session = new AgentSession({
397
- model: 'anthropic/claude-sonnet-4-5',
398
- system: 'You are a helpful assistant.',
399
- tools: [createSkillsTool(skillsProvider)]
400
- })
401
-
402
- // Don't forget cleanup when done
403
- process.on('exit', async () => {
404
- await importer.cleanup()
405
- })
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
406
453
  ```
407
454
 
408
- ## Common Patterns
455
+ ---
409
456
 
410
- ### Prompt Testing
457
+ ## 🎯 Model Formats
411
458
 
412
459
  ```bash
413
- agent-worker session new -f ./my-prompt.txt -n test
414
- agent-worker send "Test case 1: ..." --to test
415
- agent-worker send "Test case 2: ..." --to test
416
- agent-worker peek --to test
417
- 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
418
463
  ```
419
464
 
420
- ### Tool Development with Mocks
465
+ ---
421
466
 
422
- ```bash
423
- agent-worker session new -n dev
424
- agent-worker tool add my_api -d "Call my API" -p "endpoint:string"
425
- agent-worker tool mock my_api '{"status": "ok"}'
426
- agent-worker send "Call my API at /users"
427
- # Update mock, test error handling
428
- agent-worker tool mock my_api '{"status": "error", "code": 500}'
429
- agent-worker send "Call my API at /users"
430
- ```
467
+ ## 📚 Documentation
431
468
 
432
- ### Multi-Model Comparison
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 |
433
475
 
434
- ```bash
435
- agent-worker session new -m anthropic/claude-sonnet-4-5 -n claude
436
- agent-worker session new -m openai/gpt-5.2 -n gpt
437
- agent-worker send "Explain recursion" --to claude
438
- agent-worker send "Explain recursion" --to gpt
439
- ```
476
+ ---
440
477
 
441
478
  ## Requirements
442
479
 
443
480
  - Node.js 18+ or Bun
444
- - API key for chosen provider (e.g., `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`)
481
+ - API key for chosen provider (e.g., `ANTHROPIC_API_KEY`)
482
+
483
+ ---
445
484
 
446
485
  ## License
447
486