Commit 330b728
Add workflow-level agent field for sub-agent delegation (#239)
* Add optional workflow-level `agent` field for sub-agent delegation
When a workflow's `agent` field is set in job.yml, the `get_workflows`
MCP response includes a `how_to_invoke` field instructing callers to
delegate the entire workflow to a sub-agent of that type via the Task
tool. This is distinct from the existing step-level `agent` field —
this delegates the whole workflow, not individual steps.
Changes:
- Schema: added optional `agent` to `$defs/workflow`
- Parser: `Workflow.agent` field + `from_dict` update
- MCP: `WorkflowInfo.how_to_invoke` populated from `wf.agent`
- Docs: updated mcp_interface.md with new field + changelog
- Tests: 7 new tests across parser, validation, schemas, tools
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update flake.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review findings: specs, traceability, docs, lint fixes
- Add JOBS-REQ-002.8.8 for optional workflow `agent` field
- Add JOBS-REQ-001.2.6-8 for `how_to_invoke` in get_workflows response
- Add traceability comments to all new tests
- Update doc/architecture.md with workflow agent/how_to_invoke docs
- Fix pre-existing mypy issues in test files (lint review)
- Reformat f-string quoting in tools.py (ruff format)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Always populate how_to_invoke with invocation instructions
Instead of returning null when no agent is set, how_to_invoke now
always contains instructions: either to delegate via Task tool (when
agent is set) or to call start_workflow MCP tool directly (default).
Updated specs, docs, and tests to reflect the non-nullable field.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Use full MCP tool name in how_to_invoke instructions
Reference mcp__plugin_deepwork_deepwork__start_workflow instead of
generic "start_workflow DeepWork MCP tool" so agents can find the
exact tool to call.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent b36f34f commit 330b728
14 files changed
Lines changed: 309 additions & 28 deletions
File tree
- doc
- specs/deepwork/jobs
- src/deepwork/jobs
- mcp
- tests
- fixtures/jobs/concurrent_steps_job
- unit
- jobs
- mcp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
963 | 963 | | |
964 | 964 | | |
965 | 965 | | |
966 | | - | |
| 966 | + | |
967 | 967 | | |
968 | 968 | | |
969 | 969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
397 | 398 | | |
398 | 399 | | |
399 | 400 | | |
| 401 | + | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
104 | 122 | | |
105 | | - | |
106 | | - | |
107 | 123 | | |
108 | 124 | | |
109 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
243 | 247 | | |
244 | 248 | | |
245 | 249 | | |
| |||
270 | 274 | | |
271 | 275 | | |
272 | 276 | | |
| 277 | + | |
273 | 278 | | |
274 | 279 | | |
275 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
0 commit comments