Technical SEO often feels like a thankless job. You spend hours digging through site audits, fixing broken links, optimizing crawl budgets, and ensuring every piece of structured data is pixel-perfect. It’s crucial work, but it’s also repetitive and prone to human error, especially when you’re dealing with a large, dynamic website. I’ve shipped enough AI agents to know the promise of automation often clashes with the messy reality of production. So, when the task of scaling schema markup for a sprawling e-commerce client landed on my desk, my first thought wasn’t ‘manual labor.’ It was: how to use AI for technical SEO to make this less painful?
The Schema Headache: Why Manual Isn’t an Option Anymore
Imagine a site with thousands of product pages, hundreds of articles, and a constantly evolving FAQ section. Each of these content types demands specific schema markup: Product, Article, FAQPage, BreadcrumbList, and more. Google’s guidelines are strict, and a single misplaced comma or an incorrect property can invalidate the entire block, making it useless for rich results. Manually generating and validating this for every new page, every product update, or every content refresh is a full-time job for a small army. It’s not just about writing the JSON-LD; it’s about ensuring it accurately reflects the page content, adheres to Schema.org standards, and passes Google’s Rich Results Test. This is where the idea of an AI agent started to look less like a pipe dream and more like a necessity.
Building an Agent to Tame the Beast
My goal was simple: an agent that could read a page’s content, identify the appropriate schema type(s), generate the JSON-LD, and then validate it. I wanted something that could handle the initial grunt work, freeing up my team for more strategic tasks. I started with
LangGraph for orchestration. It felt like the right choice for managing the stateful, multi-step process an agent would need: fetch content, analyze, generate, validate, correct. I used the Vercel AI SDK for the underlying LLM calls, keeping the API interactions straightforward. The agent’s workflow looked something like this:
- Content Ingestion: Take a URL or raw HTML content as input.
- Content Analysis: Use an LLM to understand the page’s primary purpose and identify key entities (product name, price, author, questions, answers).
- Schema Type Proposal: Based on the analysis, suggest one or more relevant Schema.org types.
- JSON-LD Generation: Generate the raw JSON-LD markup using the identified entities and schema types.
- Validation Attempt: Submit the generated schema to a validation endpoint (initially, I used a custom Python script that checked against common Schema.org patterns and a few Google-specific rules).
- Correction Loop: If validation failed, feed the errors back to the LLM and ask it to revise the schema.
- Output: Deliver the validated schema or flag it for human review if the agent couldn’t resolve the issues after a few attempts.
On paper, it looked elegant. In practice, it was a different story.
Where It All Fell Apart (and What Actually Worked)
Building agents for production is a lesson in humility. My schema agent, while promising, hit several walls.
The Failures
- Silent Failures and Debugging Pain: The agent would often just stop. No error message, no clear indication of why. Debugging LangGraph’s state transitions when the LLM decided not to call a tool, or called it incorrectly, was a nightmare. I’d see the initial prompt go out, but then nothing. LangSmith helped me trace the calls, but interpreting why the LLM made a specific, incorrect decision often came down to trial-and-error prompt adjustments. It wasn’t a clean stack trace; it was a fuzzy logic problem. I spent more time trying to understand the LLM’s ‘reasoning’ than I did writing the initial code.
- Cost Overruns: Initial testing on a few pages was cheap. Scaling to hundreds or thousands of pages? The token count exploded. A single validation loop, especially when the agent got stuck trying to fix a persistent error, could cost cents. Those cents add up fast. I found myself constantly optimizing prompts to reduce tokens, which, yes, is annoying. It felt like I was paying for the agent to think, and sometimes it thought too much.
- Hallucinations and Compliance Headaches: The LLM would invent properties or values. It’d generate
productIDfor anArticleschema, or make up review counts and ratings for a brand new product with no reviews. This is a direct violation of Google’s guidelines and a quick path to manual action. For client sites, I couldn’t just feed raw content into public LLMs without careful redaction, adding a significant pre-processing step and another layer of potential failure. Every single output required human verification, defeating the purpose of full automation. - Validation Loop Hell: Getting the agent to self-correct based on validation errors was harder than I thought. It often got stuck in loops, trying the same incorrect fix repeatedly. I tried using AutoGen for more complex conversational agents, thinking a multi-agent approach might be better at self-correction, but the overhead for this specific task felt like overkill. The agent would fix one error, introduce another, and then struggle to resolve the new one.
My concrete gripe? The lack of robust, built-in, and *cheap* validation tools within agent frameworks. You’re always bolting on external APIs or writing custom regex, which adds to the complexity and cost. It’s a fundamental piece of the puzzle for any production agent touching structured data, and it’s often an afterthought.
What Actually Worked
- Initial Drafts: For new product pages or articles with straightforward content, the agent could generate a solid first draft of the schema. This saved about 60-70% of the manual effort for simple cases. It’s like having a junior dev who understands schema basics, even if they need constant supervision.
- Identifying Missing Schema: It was surprisingly good at flagging pages that should have schema but didn’t. A quick audit tool, essentially. I’d feed it a list of URLs, and it would tell me which ones were missing key structured data.
- Hybrid Workflow with n8n: I ended up using n8n to orchestrate the *human* validation and deployment steps. The agent would generate the schema, n8n would then send the output to a human for review, and only after approval would it push the validated JSON-LD to the CMS. This hybrid approach worked far better than trying for full autonomy. It acknowledged the LLM’s limitations and put a human where they were most needed.
My concrete love? The ability to quickly prototype schema for new content types. When a client launched a new ‘recipe’ section, the agent helped me quickly define and generate the initial Recipe schema for a few examples, which then served as a template for the rest of the content team.