Problem
The agent() global accepts a model option, and phase metadata accepts a model field — but neither actually switches the model the subagent runs on. Today, buildAgentInstructions in src/workflow.ts just stringifies it into the prompt:
if (options.model) lines.push(`Requested model: ${options.model}`);
So it's a hint to the subagent, not a real model switch. All subagents end up on whatever model WorkflowAgent was constructed with (inherited from the parent session).
Proposal
Thread options.model from AgentRunOptions into the createAgentSession({ model }) call in WorkflowAgent.run (src/agent.ts). Roughly:
const { session } = await createAgentSession({
cwd: this.cwd,
agentDir: getAgentDir(),
sessionManager: SessionManager.inMemory(),
settingsManager: SettingsManager.inMemory({ compaction: { enabled: false } }),
customTools,
...this.sessionOptions,
...(options.model ? { model: options.model } : {}),
});
And drop the "Requested model: ..." line from buildAgentInstructions — it becomes redundant once the real switch works.
Why
Lets a workflow pick a cheap/fast model for fan-out scans and a stronger model for synthesis, e.g.:
const findings = await parallel(files.map(f => () =>
agent(`Audit ${f}`, { model: 'haiku', label: f })
))
const summary = await agent(
'Synthesize these findings:\n' + JSON.stringify(findings),
{ model: 'sonnet', label: 'synthesis' },
)
Out of scope
Per-phase defaults and workflow-level model config — separate issue if wanted.
Problem
The
agent()global accepts amodeloption, and phase metadata accepts amodelfield — but neither actually switches the model the subagent runs on. Today,buildAgentInstructionsinsrc/workflow.tsjust stringifies it into the prompt:So it's a hint to the subagent, not a real model switch. All subagents end up on whatever model
WorkflowAgentwas constructed with (inherited from the parent session).Proposal
Thread
options.modelfromAgentRunOptionsinto thecreateAgentSession({ model })call inWorkflowAgent.run(src/agent.ts). Roughly:And drop the
"Requested model: ..."line frombuildAgentInstructions— it becomes redundant once the real switch works.Why
Lets a workflow pick a cheap/fast model for fan-out scans and a stronger model for synthesis, e.g.:
Out of scope
Per-phase defaults and workflow-level model config — separate issue if wanted.