Build an AI Agent That Writes and Publishes SEO Articles on WordPress with n8n
A good SEO article takes many steps: researching keywords, analyzing what competitors publish, finding a title, writing the content, creating an image, adding internal links, then filling in the SEO fields before publishing. It takes time, and that's often why a company blog stops after a few posts.
I built a system of AI agents in n8n that handles this entire chain, from the topic to the article published on WordPress.
Why several agents instead of one?
You could ask a single AI model to write the whole article. In practice, though, an agent that has to do everything produces less precise results. By splitting the work, each agent has a clear mission and short instructions:
- results are more reliable;
- each step can be tested and improved separately;
- you can switch the model for one task without touching the rest.
The system architecture
1. The "Blog Manager", the orchestrator agent
It's an AI agent (n8n's AI Agent node) that receives the article topic. It doesn't write anything itself: it calls the other agents, which are connected to it as tools, and gathers their answers in a structured format.
2. The specialized agents
- Keyword research: identifies the main keyword and related terms.
- Competitor analysis: uses Perplexity to study the articles already ranking on the topic.
- Title generator and meta description generator.
- Internal links: looks at the articles already published on the WordPress site to suggest relevant links.
- Image agent: prepares the featured image with Gemini, along with its optimized alt text, caption and file name.
3. The "Article Writer"
A second agent writes the full article from everything the Blog Manager gathered. It returns a structured result: title, content, excerpt and slug.
4. Publishing on WordPress
The workflow generates the image, uploads it to the WordPress media library via the REST API, creates the post with the featured image, then fills in the Rank Math fields: SEO title, meta description and focus keyword.
Tools used
- n8n
- AI Agents (LangChain)
- OpenRouter
- Perplexity
- Gemini
- WordPress REST API
- Rank Math
Things to watch out for
- Quality over quantity: Google penalizes mass-produced content with no added value. This system is meant to produce good articles faster, not to flood a site with pages.
- Human review: I recommend publishing as a draft first, checking facts and adjusting the tone before going live.
- Rank Math and the API: Rank Math's SEO fields must be exposed to the WordPress REST API (with a small code snippet or a plugin).
- Costs: each article calls several AI models. Your choice of models lets you adjust the cost per article.
What this system brings
- A complete, repeatable writing process, from research to publishing.
- Articles that are already SEO-optimized, with an image, internal links and Rank Math fields filled in.
- More time for editing and content strategy.
This system suits businesses and agencies that want to publish regularly on their WordPress blog without spending entire days on it.