A Harness for Every Task: Putting a Team of Claudes on One Job
Summary
Anthropic's Dynamic Workflows in Claude Code address the limitations of single-agent context windows and common AI failure modes like agentic laziness, self-preferential bias, and goal drift on long-horizon tasks. This approach, enabled by Opus 4.8, involves Claude dynamically generating a JavaScript "harness" to orchestrate multiple sub-agents. The harness splits complex jobs into independent pieces, assigns them to fresh-context Claude instances, and then synthesizes the final results. This method supports six composition patterns, including "fan-out-and-synthesize" and "adversarial verification," allowing for robust task completion, such as porting 750,000 lines of Zig to Rust in 11 days with 99.8% test suite passing. While effective, Dynamic Workflows are token-intensive, necessitating strategic model selection, using Opus for orchestration and cheaper models like Sonnet or Haiku for worker agents, to balance cost and performance.
Key takeaway
For AI Engineers tackling complex, long-horizon tasks or encountering single-agent AI limitations like goal drift, Dynamic Workflows provide a robust solution. You should adopt this approach for critical projects requiring high accuracy or extensive context, leveraging Opus 4.8 to orchestrate specialized sub-agents. Be mindful of token consumption; strategically use cheaper models like Sonnet or Haiku for worker agents while reserving Opus for orchestration and final synthesis to optimize cost-efficiency without sacrificing quality.
Key insights
Dynamic Workflows overcome single-agent limitations by orchestrating fresh-context sub-agents via a code-based plan.
Principles
- Distribute complex tasks across independent, fresh-context agents to prevent coherence loss.
- Externalize the task plan into code to ensure persistence and prevent AI "forgetting."
- Use adversarial verification to improve output quality and reduce self-preferential bias.
Method
Trigger a workflow via prompt or `ultracode` with Opus 4.8. Claude generates a JavaScript harness to split tasks, assign agents, and synthesize results. Sub-agents execute parts, with outputs stored in variables.
In practice
- Use "fan-out-and-synthesize" for parallel processing and result merging.
- Implement "adversarial verification" for critical tasks requiring high accuracy.
- Save effective workflows for reuse; share as a skill for team adoption.
Topics
- Dynamic Workflows
- AI Agent Orchestration
- Claude Code
- LLM Context Management
- Adversarial Verification
- Token Cost Optimization
Best for: AI Engineer, Machine Learning Engineer, MLOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Towards Data Science.