You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(dynamic-workflow): run subagents on a chosen model (#30)
## Related Issue
No issue — problem described below.
## Problem
Every subagent in a Dynamic Workflow ran on whatever model the calling
agent
was using. A workflow that fans 128 children out over mechanical work —
reading
files, applying a mechanical edit, running a check — paid the
orchestrator's
model for all of it, and there was no way to say "plan here, implement
there"
without editing an agent profile up front.
The provider layer already supported this: a model alias resolves to its
own
provider per agent, and `configureChild` already honoured
`profile.model` /
`profile.effort` (kept across resume by #28). The routing decision just
had no
way to reach a single run.
## What changed
`DynamicWorkflow` accepts `model` and `effort`. Both apply to every
subagent in
the call and travel on `QueuedSubagentTask` through `SubagentBatch` into
`RunSubagentOptions`, where the existing option → profile → parent
precedence
resolves them, so the choice also survives resume and retry. An alias
the
provider cannot resolve falls back to the calling agent's model instead
of
failing at generate time.
`/workflow model <alias>` stores the choice for the session; `/workflow
model`
reports it and `/workflow model off` clears it. The alias reaches the
run as an
instruction on the task prompt rather than a hard override, so the agent
can
still pick something else when the work plainly calls for it — the same
shape
as the existing Dynamic Workflow mode reminders.
/workflow model deepseek-v4
/workflow audit every route handler under src/routes/ for missing auth
→ orchestrator stays on the session model, all 128 children run on
deepseek-v4
## Checklist
- [x] I have read the CONTRIBUTING document.
- [x] I have linked a related issue, or explained the problem above.
- [x] I have added tests that prove my feature works.
- [x] Ran `gen-changesets` skill, or this PR needs no changeset.
- [x] Ran `gen-docs` skill, or this PR needs no doc update.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Configure a model and reasoning effort for all Dynamic Workflow
subagents.
* Use `/workflow model <alias>` to view, select, or clear the session’s
subagent model.
* Added autocomplete support for the new workflow model command.
* **Documentation**
* Updated Dynamic Workflow and slash-command documentation with model
and effort configuration details.
* **Bug Fixes**
* Ensured selected model and reasoning settings apply consistently to
spawned and resumed workflow tasks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Let a Dynamic Workflow run its subagents on a different model than the agent orchestrating them. `DynamicWorkflow` accepts `model` and `effort` for every subagent in the call, and `/workflow model <alias>` sets that model for the session so an expensive orchestrator can hand mechanical work to a cheaper or faster one.
Copy file name to clipboardExpand all lines: docs/reference/slash-commands.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@ Some commands are only available in the idle state. Executing these commands whi
51
51
|`/fast [on\|off\|status]`| — | Toggle provider-native Fast mode for the current session, or show its status. Without arguments, flips the current state | Status only |
52
52
|`/workflow [on\|off]`| — | Toggle Dynamic Workflow mode without sending a prompt. Without arguments, flips the current state; explicitly passing `on`/`off` forces the setting. | No |
53
53
|`/workflow <task>`| — | Turn Dynamic Workflow mode on, then send `<task>` as a normal prompt. If the turn completes normally, Dynamic Workflow mode turns off automatically. In `manual` permission mode, Pythinker Code asks whether to switch to `auto` or `yolo` before starting. | No |
54
+
|`/workflow model [alias\|off]`| — | Ask Dynamic Workflow subagents to run on `alias` instead of the session model, so workers can use a cheaper or faster model than the agent orchestrating them. Without arguments, shows the current setting; `off` clears it. Lasts for the session. | No |
54
55
|`/goal [...]`| — | Start or manage an autonomous goal | See below |
Copy file name to clipboardExpand all lines: docs/reference/tools.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ Collaboration tools handle inter-Agent coordination, user interaction, and Skill
91
91
92
92
**`Agent`** delegates a subtask to a sub-Agent. Required parameters: `prompt` (complete task description) and `description` (a 3–5 word short summary). Optional parameters: `subagent_type` (defaults to `coder`), `resume` (ID of an existing Agent to resume; mutually exclusive with `subagent_type`), and `run_in_background` (defaults to false). Agent tasks have a fixed 30-minute timeout. In foreground mode the parent Agent waits for the sub-Agent to complete before continuing; in background mode a task ID is returned immediately and the result is automatically delivered back to the main Agent via a synthetic User message when done. When several foreground `Agent` calls run in the same step, the TUI groups them and shows each subagent's running, waiting, completed, or failed status with elapsed time. See [Agent & Sub-Agents](../customization/agents.md) for details.
93
93
94
-
**`DynamicWorkflow`** launches several independent subagents in parallel, resumes existing subagents through `resume_agent_ids`, or combines both in one call. It always requires `description`, a short summary of the whole workflow. Each entry in `items` launches one new subagent: without `prompt_template`, every entry is a complete prompt on its own; with `prompt_template`, the template must contain the `{{item}}` placeholder and each entry replaces it. Item prompts must be distinct — duplicates are rejected. Pass `subagent_type` to choose the profile used by every spawned subagent, or omit it to use `coder`. Without `resume_agent_ids`, the tool requires at least 2 items; with `resume_agent_ids`, it can resume one or more existing subagents. The tool supports up to 128 total subagents, waits for all of them to finish, and returns an aggregated report. Workflow subagents have no automatic timeout; they run until completion, failure, or user cancellation. If a model response calls `DynamicWorkflow`, that call must be the only tool call in the response; to run several workflows, call one `DynamicWorkflow`, wait for its result, then call the next, or combine the work into a single workflow. In `manual` permission mode, `DynamicWorkflow` calls outside active Dynamic Workflow mode request approval unless a permission rule allows them; while Dynamic Workflow mode is active, `DynamicWorkflow` itself is auto-approved. Permission rules match `DynamicWorkflow` by tool name only — argument patterns such as `DynamicWorkflow(workflow)` are not supported.
94
+
**`DynamicWorkflow`** launches several independent subagents in parallel, resumes existing subagents through `resume_agent_ids`, or combines both in one call. It always requires `description`, a short summary of the whole workflow. Each entry in `items` launches one new subagent: without `prompt_template`, every entry is a complete prompt on its own; with `prompt_template`, the template must contain the `{{item}}` placeholder and each entry replaces it. Item prompts must be distinct — duplicates are rejected. Pass `subagent_type` to choose the profile used by every spawned subagent, or omit it to use `coder`. Pass `model` and `effort` to run this workflow's subagents on a different model than the agent orchestrating them — a cheaper or faster model for mechanical work, for example; both apply to every subagent in the call, and omitting them falls back to the subagent profile's own settings and then to the calling agent's. A `model` the provider cannot resolve falls back to the calling agent's model rather than failing the run. Without `resume_agent_ids`, the tool requires at least 2 items; with `resume_agent_ids`, it can resume one or more existing subagents. The tool supports up to 128 total subagents, waits for all of them to finish, and returns an aggregated report. Workflow subagents have no automatic timeout; they run until completion, failure, or user cancellation. If a model response calls `DynamicWorkflow`, that call must be the only tool call in the response; to run several workflows, call one `DynamicWorkflow`, wait for its result, then call the next, or combine the work into a single workflow. In `manual` permission mode, `DynamicWorkflow` calls outside active Dynamic Workflow mode request approval unless a permission rule allows them; while Dynamic Workflow mode is active, `DynamicWorkflow` itself is auto-approved. Permission rules match `DynamicWorkflow` by tool name only — argument patterns such as `DynamicWorkflow(workflow)` are not supported.
95
95
96
96
In the TUI, a foreground workflow shows a live framed mission-control panel with a coral title. The panel lists one row per subagent with a compact progress cube, state, task, current work, and elapsed time, followed by a recent-activity log. Each cube advances only through observed execution milestones such as startup, model output, tool use, and finalization; it does not predict time remaining. The summary reports only factual completion, failure, and cancellation counts plus elapsed time, without an estimated aggregate percentage or progress bar. In a narrow terminal the per-agent cubes are dropped before subagent identity or state; when vertical space runs out, rows are clipped in workflow-index order and the remainder is summarized as `+ N more agents`.
Copy file name to clipboardExpand all lines: packages/agent-core/src/tools/builtin/collaboration/dynamic-workflow.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@ Use DynamicWorkflow when several independent subagents should run in parallel. W
4
4
5
5
Use `resume_agent_ids` to continue subagents that already exist from earlier work, such as ones that failed: map each agent id to the prompt for that resumed subagent (usually `continue` if no extra information is needed). You may combine `resume_agent_ids` with `items` in the same call to resume existing subagents and launch new ones. Do not duplicate resumed work in `items`.
6
6
7
+
Use `model` and `effort` to run this workflow's subagents on a different model than the one orchestrating them, such as a cheaper or faster model for mechanical work while the orchestration stays on the current model. Both apply to every subagent in the call. Omitting either falls back to the subagent type's own setting, and then to your current setting. A `model` that is not a configured alias also falls back to your current model rather than failing the workflow.
8
+
7
9
Use enough subagents to keep the work focused and parallel. DynamicWorkflow supports up to 128 subagents, and launches are queued automatically, so it is safe to split large tasks into many clear, independent items. Workflow subagents have no automatic timeout; they run until completion, failure, or user cancellation.
8
10
9
11
If `DynamicWorkflow` is called, that call must be the only tool call in the response.
0 commit comments