Skip to main content
Multi-agent blog writing system using LangGraph workflow.

Code

Create main.py with the code below, or save it directly from your editor.

Additional Files

Create these supporting files in the same directory:

graph.py

schemas.py

Skill Configuration

Create skills/blog_writing_agent/skill.yaml:

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
Map-Reduce Pattern
  • 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
State Management
  • topic: User input for blog topic
  • plan: Structured outline with sections and requirements
  • sections: Individual written sections from workers
  • final: Completed markdown article
Execution Flow
  1. Orchestrator breaks topic into detailed plan
  2. Workers write sections in parallel
  3. Reducer aggregates and formats final article
  4. Returns cohesive blog post

Dependencies

Environment Setup

Create .env file:

Run

Examples:
  • “How does Retrieval-Augmented Generation (RAG) work?”
  • “Design a production-ready microservices architecture”
  • “Deep dive into Kubernetes scheduling”

Example API Calls

Frontend Setup

Open http://localhost:5173 and try to chat with the LangGraph blog writing agent