Code
How It Works
Agent Roles- Orchestrator: Breaks topic into structured plan with sections and word counts
- Workers: Write individual sections simultaneously with specific technical depth
- Reducer: Aggregates sections into final cohesive markdown article
- Orchestrator creates detailed plan with specific tasks
- Fanout distributes tasks to parallel workers
- Workers write sections simultaneously ensuring constraints
- Reducer combines sections into final article
topic: User input for blog topicplan: Structured outline with sections and requirementssections: Individual written sections from workersfinal: Completed markdown article
- Orchestrator breaks topic into detailed plan
- Workers write sections in parallel
- Reducer aggregates and formats final article
- Returns cohesive blog post
Run
Graph Structure
The agent uses a LangGraph workflow with:orchestratornode for planningworkernodes for parallel section writingreducernode for final aggregation- State management across workflow steps