Claude Code Dynamic Workflows
Have Claude write a script that orchestrates dozens to hundreds of subagents in the background — for codebase-scale audits, migrations, and cross-checked research.
What is a dynamic workflow?
A dynamic workflow is a JavaScript script Claude writes for your task. A runtime executes it in the background while your session stays responsive, and only the final answer returns to the conversation.
A script, not a chat loop
Claude writes a JavaScript script that holds the loop, the branching, and the intermediate results. The orchestration itself is what gets repeated — not just the prompt.
Context stays light
Intermediate results live in script variables instead of Claude's context window, so the conversation only holds the final report — not every agent's output.
Built-in quality patterns
A workflow can have independent agents adversarially review each other's findings before reporting, or draft a plan from several angles and weigh them — more trustworthy than a single pass.
Read it, save it, rerun it
Because the plan is code, you can read the script before it runs, resume it after a pause, and save a good run as a /command you reuse on every branch.
Subagents vs Skills vs Workflows
All three run multi-step work. The difference is who holds the plan.
| Aspect | Subagents | Skills | Workflows |
|---|---|---|---|
| What it is | A worker Claude spawns | Instructions Claude follows | A script the runtime executes |
| Who decides what runs next | Claude, turn by turn | Claude, following the prompt | The script |
| Where intermediate results live | Claude's context window | Claude's context window | Script variables |
| Scale | A few delegated tasks per turn | Same as subagents | Dozens to hundreds of agents per run |
Three ways to start one
Available on all paid plans (turn it on in /config on Pro), plus the Claude API, Amazon Bedrock, Vertex AI, and Microsoft Foundry.
1. The workflow keyword
Include the word "workflow" in your prompt and Claude writes one for the task instead of working turn by turn.
Run a workflow to audit every API
route under src/ for missing auth
2. ultracode
Set /effort ultracode and Claude plans a workflow for every substantial task in the session — xhigh reasoning plus automatic orchestration.
/effort ultracode
3. /deep-research
The bundled workflow: it fans out web searches, cross-checks sources, votes on each claim, and returns a cited report.
/deep-research What changed in
the Node permission model v20-v22?
About /deep-research
/deep-research is the built-in workflow that investigates a question across many sources. It fetches and cross-checks what it finds, filters out claims that don't survive cross-checking, and returns one cited report. It needs the WebSearch tool enabled.
When to reach for a workflow
Use one when a task needs more agents than a single conversation can coordinate, or when you want the orchestration codified as a script you can rerun.
Codebase-wide bug sweeps — many finders in parallel, each verified before reporting.
Large migrations — a 500-file framework switch or language port, one agent per site.
Cross-checked research — sources weighed against each other, not a single summary.
Hard plans — drafted from several independent angles, then judged and synthesized.
Case study: rewriting Bun from Zig to Rust
Jarred Sumner used dynamic workflows to port the Bun runtime from Zig to Rust — a scale of change that would normally take a team weeks.
750K
lines of code
11 days
elapsed
99.8%
existing tests kept green
Limits worth knowing
Dynamic workflows are in research preview. The runtime applies a few guardrails.
Up to 16 concurrent agents
Excess agents queue and run as slots free up; fewer run at once on machines with limited CPU cores.
1,000 agents per run
A backstop against runaway loops, set far above any normal workflow.
No mid-run input
Only agent permission prompts can pause a run. For sign-off between stages, run each stage as its own workflow.
Resumable in-session
Completed agents return cached results on resume; the rest run live. Exiting Claude Code restarts the workflow fresh.
Workflows use more tokens — plan for it
A single run can spawn hundreds of agents, so it uses meaningfully more tokens than the same task in conversation, and counts toward your plan's usage and rate limits. Each agent uses your session's model unless the script routes a stage to a cheaper one.
Running big workflows through QCode
Because 1,000-agent runs burn tokens fast, the access tier you run them on matters. QCode provides higher-tier Claude access optimized for low latency in China, so codebase-scale workflows stay practical to run — no foreign card or phone number required.
Start building with Claude Code
Get Claude Code access through QCode and run dynamic workflows, ultracode, and Opus 4.8 with China-optimized latency.