GenAI Unplugged

Build an SEO and AEO agent

An SEO and AEO agent that helps your writing get cited by AI tools, with cost controls and quality gates.

Table of contents

The SEO/AEO research agent is a Claude Code subagent that uses Tavily through MCP to research a topic and return a structured content brief: keyword opportunity, SERP intelligence, AEO citation gaps, competitor gaps, and a recommended format. This lesson shows the four layers and files needed to build it for about $10 a month or less.

What you will be able to do

  • Connect Tavily to Claude Code as an MCP server with the /mcp command
  • Create a memory.md file that records preferences and corrections so the agent stops repeating mistakes
  • Write business-context, content-strategy and competitor-watchlist files that make the research specific to your site
  • Build an agent file with YAML frontmatter and a system prompt that caps Tavily calls and credit use
  • Run the agent on a topic and read a brief covering keyword opportunity, AEO gaps and competitor gaps

Before you start

  • Claude Code installed and working
  • A free Tavily account at tavily.com (1,000 research credits a month)
  • A site or topic area where you can state your real authority, such as post counts and named competitors
  • About 30 to 45 minutes for the one-time setup

Reference

Layer File or tool What it holds or does
Tool Tavily via MCP Live web research. Connect with the /mcp command, then authenticate via SSO
Memory memory.md Three sections: Preferences, Corrections, Learned Patterns
Lens business-context.md Identity and ICP, content authority counts, named competitors
Lens content-strategy.md Voice and format preferences, EEAT signals to lean on, what never to publish
Lens competitor-watchlist.md Specific domains fed into Tavily's include_domains parameter
Brain seo-aeo-researcher.md YAML frontmatter plus a system prompt built on RTF, few-shot examples and chain-of-thought
Frontmatter name, description, tools, model description lets Claude match a plain-language request to the agent. Example model value: sonnet
Limits System prompt rules Exact call counts (3 Tavily calls, not "a few"), about 10 credits per run, explicit output structure

Common errors and fixes

What goes wrong The fix
The agent repeats a mistake in every new session Add the correction to memory.md under Corrections so it persists
Output reads like any generic research brief Write the three context files (business-context, content-strategy, competitor-watchlist) with your real authority and voice
Research wanders across the whole internet List your competitive set in competitor-watchlist.md so those domains go into include_domains
Behaviour changes from run to run Agents are probabilistic. Put exact numeric rules in the system prompt, require source citations for every claim, and correct memory when it is wrong
You expect a direct feed of Google's AI Overview panel Tavily does not scrape it. It researches what AI models already answer for the topic, which still shows citation gaps

Watch it inside the full course

The whole course is also one long video on YouTube, all 8 lessons in order. Lesson 5 starts at 2:42:59.

Read the written version

The Substack article covers the same build step by step, with the prompts and files to copy. Read Lesson 5 on Substack.

More in this section

Continue the course

See all 8 lessons in the Claude Code Full Course: Build AI Systems Without Writing Code.

Dheeraj Sharma

AI Systems Builder
I help founders, creators and tech teams build AI automation systems that grow revenue without growing workload. 20 years of enterprise engineering, now in plain English.

Build your own system with me, live

The Claude Code Builder cohort on Maven is 6 weeks of building with me live. You leave with a working system of your own.

See the Claude Code Builder cohort