DEV Community

abdul rahman
abdul rahman

Posted on

AutoFix & Compatibility Agent – AI Advisor on Sanity Structured Data

What I Built

AutoFix Knowledge Agent is an intelligent automotive diagnostics and spare parts compatibility advisor powered by Sanity's Structured Content Lake and high-speed LLM reasoning.

In automotive maintenance, a simple keyword search or hallucinated AI response can lead to expensive or hazardous errors (e.g., purchasing a spark plug with the wrong thread pitch, electrode gap, or heat rating for a modern engine).

This agent solves this by using Sanity as the single source of truth, establishing relational integrity between vehicle models, spare parts, and OBD-II diagnostic troubleshooting guides.


Submission Details & Mandatory Identifiers 📌


Why Structured Content Was Crucial

Traditional RAG systems that rely solely on flat, chunked vector search struggle with negative constraints and multi-hop compatibility logic.

With Sanity's TypeScript schemas, we structured:

  1. Vehicles: name, make, year, engineType.
  2. Spare Parts: partNumber, title, specifications, and explicit Reference Arrays (compatibleVehicles[]->name).
  3. Troubleshooting Guides: errorCode (e.g. P0300), symptoms, solutions, and related replacement parts.

When a user asks: "Is SK16R11 compatible with Toyota Camry 2023?", the agent queries the relational graph via GROQ:


groq
{
  "vehicles": *[_type == "vehicle"]{ name, make, year, engineType },
  "parts": *[_type == "part"]{ 
    partNumber, 
    title, 
    specifications, 
    "compatibleVehicles": compatibleVehicles[]->name 
  },
  "troubleshooting": *[_type == "troubleshoot"]{ 
    errorCode, 
    symptoms, 
    solution, 
    "relatedParts": relatedParts[]->{ partNumber, title } 
  }
}
Because the relational reference for SK16R11 strictly points to Toyota Corolla 2020, the AI agent reasons that it is strictly incompatible with the Toyota Camry 2023, preventing user error with 100% accuracy.
Screenshots
Tech Stack
Content Platform: Sanity.io Studio v3 & Content Lake
Query Language: GROQ
Frontend & API: Next.js 15 (App Router, Tailwind CSS, Lucide Icons)
AI Engine: Groq Cloud Llama API / OpenAI-compatible endpoint
Deployment: Vercel
Conclusion & Learnings
Building on Sanity's Content Lake made modeling complex multi-entity relationships effortless. Combining GROQ with AI agents unlocks reliable, zero-hallucination domain experts.

![ ](https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/qrfyxqt974q2i7j238r4.png)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)