Scaling AI Agents with Claude Code’s Dynamic Workflows: From Subagents to 1,000 Agents
Claude Code’s Dynamic Workflows move the AI programming assistant from a single‑round subagent model to a JavaScript‑driven orchestration that can run up to 1,000 agents in the background, offering non‑blocking execution, adversarial quality checks, and reusable scripts while highlighting token costs and practical limits.
Problem
In Claude Code the Subagent mode sends a separate agent for each task and forces every agent’s report back into Claude’s context window. When auditing an entire project’s API security or performing a large‑scale migration, the context quickly fills, limiting the number of files that can be processed.
Dynamic Workflows Architecture
Dynamic Workflows replace the Subagent round‑trip with a JavaScript script that describes the whole orchestration. A dedicated runtime executes the script, stores intermediate results in script variables (outside Claude’s context), and returns only the final aggregated result. This design allows up to 16 agents to run concurrently and up to 1,000 agents in a single run.
Core Features
Orchestration as code : Workflows are generated JavaScript scripts supporting loops, conditionals, and parallel control.
Background execution : The workflow runs in the background; progress can be inspected, paused, resumed, or stopped with the /workflows command.
Built‑in quality mode : Multiple agents can adversarially review each other (e.g., one finds bugs, another validates them).
Save and reuse : Press s to save a workflow as a command in .claude/workflows/ (project‑level) or ~/.claude/workflows/ (personal‑level) and invoke it later with /your‑command.
Comparison with Subagent, Skill, and Agent Team
Nature : Subagent – temporary worker; Skill – predefined instruction; Workflow – runtime‑executed script; Agent Team – multiple independent Claude sessions.
Decision maker : Subagent – Claude decides each round; Skill – Claude follows the instruction; Workflow – script controls flow; Agent Team – shared task list with communication.
Result storage : Subagent/Skill – Claude’s context window; Workflow – script variables; Agent Team – each agent’s own context.
Scale : Subagent – a few per round; Skill – same as Subagent; Workflow – dozens to hundreds of agents (up to 1,000 total); Agent Team – 3‑5 collaborators.
Interrupt‑resume : Subagent/Skill – cannot; Workflow – can resume within the same session; Agent Team – limited support.
Trigger Methods
Keyword trigger : Include the word workflow in the prompt. Example:
Run a workflow to audit every API endpoint under src/routes/ for missing auth checksClaude highlights the keyword and generates the script. Press alt+w to ignore.
Ultracode mode : Enter /effort ultracode. Claude uses the high‑level xhigh reasoning model to decide which tasks need a workflow and arranges them automatically. Switch back with /effort high.
Built‑in command : /deep-research runs a multi‑angle search, cross‑verification, voting, and returns a cited report. Example:
/deep-research What changed in the Node.js permission model between v20 and v22?Running a Workflow
After starting, the workflow runs in the background. Use /workflows to view progress, where each phase shows agent count, token usage, and duration. Common shortcuts:
↑ / ↓ – select phase or agent
Enter or → – drill into phase details or view an agent’s prompt, tool calls, and result
p – pause/resume
x – stop selected agent or the entire workflow
r – restart selected agent
s – save the script as a reusable command
Permission Model
Agents run in acceptEdits mode, automatically approving file edits. Shell commands, WebFetch, or MCP tools not on the whitelist still prompt for permission. Add required commands to the whitelist before long runs.
Saving and Reusing
Press s after a successful run to save the script.
Project‑level: save to .claude/workflows/ (shared via repository).
Personal‑level: save to ~/.claude/workflows/ (available across projects).
The saved script becomes a command, e.g., /security-audit, which can be invoked directly. If a project‑level and personal‑level command share a name, the project‑level command takes precedence.
Interrupt and Resume
Paused agents keep their results; resuming continues from the last completed phase without re‑running completed agents. Resume works only within the same Claude Code session; closing the session discards the state.
Constraints and Limits
No interactive input during execution (except permission prompts). Split into multiple workflows for staged confirmation.
Scripts cannot directly manipulate the file system; agents perform I/O.
Maximum 16 concurrent agents (fewer on low‑CPU machines).
Maximum 1,000 agents per run to prevent runaway loops.
Cost Considerations
Dynamic Workflows consume many tokens—often many times a normal conversation.
Check the current model with /model and downgrade non‑critical stages from Opus to Sonnet or Haiku.
Specify the model per stage in the task description (e.g., Haiku for exploration, Opus for final verification).
Stop runs from the /workflows UI; completed work is retained.
Applicable Scenarios
Strongly recommended :
Full‑codebase security audits or bug scans where Subagent cannot fit all files.
Large‑scale code migrations (e.g., framework upgrades across hundreds of files).
Research requiring cross‑validation from multiple angles.
Design reviews where multiple agents generate and score proposals.
Not needed :
Small function edits or bug fixes (overkill).
Iterative development that needs frequent human interaction (Workflow lacks mid‑run input).
Team discussion tasks better suited to Agent Team.
Disabling Dynamic Workflows
Run /config and turn off the Dynamic Workflows switch.
Add "disableWorkflows": true to ~/.claude/settings.json.
Set environment variable CLAUDE_CODE_DISABLE_WORKFLOWS=1.
Enterprise admins can disable it organization‑wide via managed settings.
Conclusion
Dynamic Workflows shift Claude Code from an “AI coding assistant” to an “AI coding commander” by moving orchestration out of Claude’s limited context into executable scripts. This enables thousands of agents, reusable scripts, adversarial validation, background execution, and checkpoint resume.
Pros : large scale, reusable, adversarial quality checks, non‑blocking, checkpoint resume.
Cons : high token cost, no mid‑run interaction, session‑bound resume, still in Research Preview.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Old Zhang's AI Learning
AI practitioner specializing in large-model evaluation and on-premise deployment, agents, AI programming, Vibe Coding, general AI, and broader tech trends, with daily original technical articles.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
