Build Your First AI SEO Agent for Keyword Research + Topic Clustering (With Guardrails for Quality)
Mika Sandgrove | | 4 min read

Introduction: what you’re building and why it works
An “AI SEO agent” here is a repeatable workflow with explicit inputs and outputs—not a one-off chat you can’t reproduce. You run the same steps to turn seed topics into a normalized keyword set, label intent and page type, then cluster topics and stop bad output before it becomes a content plan.
The promise: faster keyword research plus clusters you can actually brief, because generic, duplicate, mixed-intent, or off-scope items get rejected early.
Inputs: seed topics, audience/market, business goal, exclusions, banned patterns. Outputs: a deduped list with canonical forms, intent + page archetype, cluster assignments, and a review queue (status + rejection reasons) for human approval.
Minimal agent workflow: the 6-step architecture (inputs → outputs)
Run this step-by-step (don’t cram it into one mega-prompt). Each step produces an output you can re-run without breaking the rest.
- Collect seed topics + constraints
Input: 5–10 seeds + audience, market, business goal, exclusions, banned patterns. Output: a reusable run config.
- Expand keywords by diversification
Generate different angles (use cases, comparisons, problems, roles), not synonym-spinning.
- Normalize + dedupe
Create canonical forms (plural/singular, word order, near-duplicates) while keeping originals for traceability.
- Classify intent + suggest page type/archetype
Map each query to what would rank: definition, how-to, comparison, alternatives, category, tool page, template.
- Cluster into topics
Starter rule: cluster by shared intent + shared “core object” (what the page is about). Embeddings are optional later.
- Output a cluster brief
Per cluster: primary keyword, supporting terms, notes, confidence, and status.
Micro example: Seed “keyword cannibalization.” Expanded keywords include “keyword cannibalization audit,” “how to fix keyword cannibalization,” and “find keyword cannibalization in Google Search Console.” Normalize variants into a single canonical form, then cluster as Keyword cannibalization audit & fixes with how to fix keyword cannibalization as primary and 2–3 supporting terms.
Quality guardrails: checks that prevent bad clusters
Without guardrails, AI output looks “complete” but fails in execution: duplicates, wrong SERP intent, off-brand topics. Treat guardrails as rules plus required fields that force explainable decisions.
- Guardrail A: specificity/uniqueness rules
Reject generic head terms, templated variants (“best X” repeated), and duplicates/near-duplicates.
- Guardrail B: evidence fields per keyword/cluster
Require a short note: why it belongs, why that intent/page type, plus confidence (high/med/low).
- Guardrail C: SERP-likeness sanity check
Cluster items should imply one content type. If half want a tool page and half want a definition, split.
- Guardrail D: brand + exclusion compliance
Hard-filter disallowed markets/products/topics; label violations.
- Guardrail E: human-in-the-loop approvals
Before planning, a human approves: cluster name, primary keyword, intent/page type, and exclusion compliance.
Make it operational with a status field: pending_review, approved_locked, rejected.
Guardrail example: keyword “SEO” → reject as a generic head term (too broad; unclear SERP intent), set status to rejected, and note the banned-pattern violation so it doesn’t re-enter the plan.
Implementation: copy-paste prompts + a simple sheet template
Use one sheet (or CSV) as the system of record. Run prompts stepwise so you can re-run only the failing step.
Sheet columns: keyword, canonical_keyword, intent, page_type, cluster_name, primary_or_supporting, notes/evidence, confidence, status.
Prompt 1 (expand): Given seeds + audience/market + exclusions + banned patterns, generate 8–15 diversified keywords per seed (no synonym-spinning) and output seed_topic | keyword.
Prompt 2 (normalize/dedupe): Normalize into canonical_keyword, group near-duplicates, and output what to keep/drop with a drop reason.
Prompt 3 (intent/page type): For each canonical keyword, assign intent, page_type, 1-sentence rationale, and confidence.
Prompt 4 (cluster): Cluster only when intent matches and page type is compatible; name clusters in 2–6 words; pick one primary keyword and mark the rest supporting.
Validate results in 20 minutes: rubric + quick fix loop
When I ran this workflow for weekly planning, the quickest wins came from small-batch validation, not debating the entire list. Use 20 minutes to decide what’s safe to brief and what needs a re-run.
Rubric (score each cluster 1–3): coherence (same “thing”), SERP intent fit (one dominant page type), coverage (supporting terms add subtopics), actionability (a writer can draft without guessing).
Sampling: review 5 clusters (the 3 largest + 2 random). In each, check the primary plus 3 supporting keywords.
Failure modes → fixes:
- Synonym clusters: tighten diversification constraints and re-run expansion.
- Mixed intent/page type: split the cluster and enforce the “same page_type” rule.
- Overbroad cluster names: rename to match the likely page title.
Lock what’s good by setting status to approved_locked so re-runs don’t overwrite accepted clusters. Anything questionable stays pending_review.
Conclusion
Pilot this with 5–10 seeds in one market and audience. Keep the sheet as the source of truth, run the steps in order, and enforce guardrails so weak items never become briefs. In practice, the workflow becomes trustworthy when every cluster has an intent/page-type rationale and a clear status: approved stays locked, rejected keeps reasons, and you only re-run the step that failed. Add embeddings or automation later, after the weekly run is stable and auditable.
Sources
Article author
Mika Sandgrove
Mika Sandgrove is an SEO writer and independent SEO consultant with more than three years of experience creating and optimizing content for search. He runs his own SEO practice, helping businesses improve their organic visibility through SEO strategy, content optimization, and technical and on-page SEO services. Much of his work comes through freelance marketplaces and online client platforms, where he works with businesses across different industries and markets. Mika primarily writes about SEO, search visibility, and practical optimization strategies, and is increasingly exploring Answer Engine Optimization (AEO) and how businesses can adapt their content for AI-powered search experiences.

