Nebula Agent: An AI That Surfaces Contradictions in Structured Content
This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content What I Built A Sanity-powered AI agent that answers questions about a fictional board game called Nebula and, crucially, surfaces contradictions between sources . The agent doesn't just search for keywords. It writes its own GROQ queries(Graph Relational Object Queries) against a Sanity Content Lake…
This submission for the Sanity Challenge creates an AI agent that queries structured content in a Sanity Content Lake to answer questions and identify contradictions between sources. The agent, built for the fictional board game Nebula, doesn't simply search for keywords. Instead, it writes GROQ queries against Sanity in real time, reads the retrieved structured articles, and presents any conflicting information side by side with their source URLs.
The core question posed is: According to the Nebula rulebook and errata, how many energy tokens do players start with? The agent's answer reveals a contradiction - the rulebook states players start with 5 energy tokens, while the official errata corrects this to 8 tokens. A keyword search would have retrieved both articles but would not have known which was authoritative or that the errata corrected the rulebook.
The agent's functionality stems from the structured content model defined in Sanity Studio using TypeScript. It includes a single document type called "article" with fields for title, slug, body, and source. The agent populates this dataset with three documents, deliberately creating a contradiction between the Nebula Core Rulebook and the Nebula Official Errata.
To run the agent, users need to install dependencies, set up API keys for Gemini and Sanity, and then query the agent using a command-line interface. The agent's core functionality relies on function calling with Gemini, using a primary tool that runs GROQ queries against the Sanity dataset. It returns JSON results and uses the provided source URLs to present any contradictions it uncovers.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.