top of page
< Back

Multi-Agent Blog Writer

Multi-Agent Blog Writer

As promised, here's the json file: Click here to watch the video

This uses a multi-agent approach with specialised sub-agents.

Main Agent: Blog Writer Agent

Model: Claude Sonnet 4

Memory: 20-message buffer window

Job: Orchestrates the entire process, makes decisions about what to research/write next

Sub-Agent 1: Research Agent

Model: GPT-4.1 Mini (cheap but effective for research)

Tools: Tavily API + Perplexity

Job: Digs up relevant info and sources for content sections

Sub-Agent 2: Title & Structure Agent

Model: GPT-4.1 Mini

Tools: Perplexity

Job: Creates engaging titles and logical H2/H3 outline

Sub-Agent 3: Section Writer

Model: GPT-4.1 Mini

Job: Takes research data and writes actual blog sections

Sub-Agent 4: Image Generator

Model: GPT-4.1 Nano (just for prompt crafting)

Tools: Replicate API (Flux-Schnell model)

Job: Creates relevant hero images

Step-by-Step Breakdown

1. Trigger Setup

Node: Chat Trigger

2. Main Orchestration

Blog Writer Agent receives your keyword

Has a detailed system prompt that defines the workflow:

Generate title/structure → confirm with user

Write intro

Research and write each section iteratively

Generate image

Compile final HTML blog post

3. Structure Generation

Title & Structure Tool creates the skeleton

Uses Perplexity for competitive analysis

Outputs clean title + H2/H3 hierarchy + conclusion

4. Research Phase

Research Agent gets activated when main agent needs info

Hits both Tavily and Perplexity APIs

Tavily config: 3 results, 3 chunks per source, includes raw content

Returns compiled research + sources

5. Content Writing

Write Section Tool takes research data

Writes each section with proper sourcing

Links out to references (actually useful content)

6. Image Generation

Generate Image Tool creates prompts for the topic

Calls Replicate API (Flux-Schnell model)

Check Status tool polls until image is ready

Returns final image URL

7. Final Compilation

Main agent assembles everything into clean HTML

Proper formatting with <h1>, <h2>, <h3>, <p> tags

Ready to copy-paste into any CMS

The Cool Parts

Multi-API Research: Combines Tavily (fast, broad) + Perplexity (deep, current) for better coverage than either alone.

Async Image Generation: Starts the image generation, then polls status until complete. No timeouts or failed runs.

Iterative Writing: Doesn't try to write everything at once. Researches → writes → moves to next section. More reliable than "write 2000 words in one go."

Source Attribution: Actually includes and formats source links properly. Your content won't be generic AI slop.

Required APIs/Credentials

Anthropic API (for Claude Sonnet 4)

OpenAI API (for GPT models)

Tavily API (research)

Perplexity API (research)

Replicate API (image generation)

Performance Notes

Runtime: ~3-5 minutes for a complete blog post

Cost: ~$0.50-1.00 per post (depending on length/research depth)

Quality: Actually readable content, not AI word salad

Why This Approach Works

Instead of one massive prompt trying to do everything, this breaks it into specialized agents. Each agent is good at one thing. The main agent coordinates and makes decisions about what to do next.

Result: More reliable, higher quality, and way less likely to go off the rails.

Possible Improvements

Add fact-checking agent

Include competitor analysis

Auto-publish to WordPress/Ghost

Generate social media snippets

Add SEO score analysis

Hope that made sense! But fair warning: this is just level one... it only gets deeper from here 🕳️🐇

bottom of page