DEV Community

Cover image for USHER-Know before you watch
Anuj Jain
Anuj Jain

Posted on

USHER-Know before you watch

Sanity Challenge Path One Submission

This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content

What I Built

USHER is a statutory and medical compliance gatekeeper for films and TV series.

A streaming catalog's age rating tells you who a title is legally suitable for. It doesn't tell you that a "U" rated family film contains a flashing-screen sequence that can trigger seizures. Disney issued theatrical seizure notices for Incredibles 2 in 2018 over exactly this. Real viewers also don't ask single-field questions. They say things like:

"I'm 14, have photosensitive epilepsy and auditory hyperacusis, and want a thriller."

USHER doesn't just fetch rows. Once the Sanity graph is loaded, the agent:

  • Resolves multiple constraints at once. Age, medical hazards, and genre are checked together. In this example it disqualifies Oppenheimer and Euphoria on statutory age (CBFC A, 18+). It disqualifies Inception because, although it is UA 13+, its 18-24Hz strobe sequence violates ITU-R BT.1702 photic limits. It recommends The Dark Knight, which is UA 13+ compliant with no photic warnings on record.
  • Overrides misleading ratings with clinical evidence. Incredibles 2 is rated U (all ages), but the retrieved trigger data records the 6Hz Screenslaver sequence, so the verdict moves from safe to PROHIBITED for photosensitive viewers.
  • Turns clinical data into practical directives. Instead of "118.5 dB surge at 20ms transition," the viewer gets a plain instruction with exact runtime windows, such as mute or look away between 01:54:30 and 01:56:00.
  • Cites its legal and clinical authority. Verdicts reference the Cinematograph Act 1952, CBFC Guidelines 2023, ITU-R BT.1702-2, and the WHO 85 dB listening standard, and resolve to one of [SAFE], [RESTRICTED], [PROHIBITED], or [DATA UNAVAILABLE].
  • Refuses to guess. If a title or hazard isn't certified in Sanity, USHER returns [VERDICT: DATA UNAVAILABLE] and advises withholding viewing until it's certified, instead of improvising safety advice from model memory.

The catalog covers 42 titles across 8 genres, with a dual-theme UI (Space Black & Metallic Slate, or Warm Coffee & Mocha Beige).

Data transparency: While film classifications and hazard designations reflect real statutory records and documented public media advisories (e.g., Disney's theatrical seizure notices for Incredibles 2), specific scene timestamps and decibel measurements are curated demonstration models created for this challenge rather than laboratory-certified clinical datasets. USHER is a demonstration of the architecture, not medical advice.

Demo

Code

GitHub repository: https://github.com/An16og/usher

  • studio/: Sanity Studio schemas and the seeding script
  • web/: Next.js app, /api/chat route, and the Sanity query client (mcp-client.ts)

How I Used Sanity

Sanity is the only source of truth for every safety claim USHER makes. I modeled compliance data as typed, connected documents:

  • Movie: the title being audited (42)
  • CBFC Rating: its statutory classification (5)
  • Trigger Warning: hazard, severity (Mild / Severe / Critical), clinical description, timestamps, and affected demographics (13)
  • Accessibility Rule: governing standards, with restriction level and trigger condition (7)

Retrieval. I used GROQ over the Sanity Content Lake HTTP Query API as the primary retrieval engine, exposed to the model as a custom Vercel AI SDK tool named search_knowledge_base. One query dereferences the full relational path, Movie → CBFC Rating → Trigger Warnings → Accessibility Rules, in a single round trip:

*[_type == "movie"]{
  _id, title, releaseYear, synopsis,
  cbfcRating->{ ratingCode, minimumAge, description },
  triggerWarnings[]->{
    hazard, severity, category, clinicalDescription,
    timestamps, affectedDemographics
  },
  "applicableRules": *[_type == "accessibilityRule"
    && references(^.triggerWarnings[]._ref)]{
    ruleCode, title, targetDemographic, restrictionLevel,
    triggerCondition, restrictionDetails, source
  }
}
Enter fullscreen mode Exit fullscreen mode

I chose structured GROQ traversal over vector search deliberately. Embeddings are known to blur negation ("contains strobe" vs. "does not contain strobe"), which is unacceptable for a safety use case. GROQ returns verified, typed entities with exact timestamps and statutory clauses, with no chunking or similarity guesswork.

What the agent does with the content. The retrieved graph is the only context the model reasons over. It performs the constraint resolution, rating-versus-clinical-evidence overrides, scene-skip directives, and verdict synthesis described above. If nothing certified comes back, it refuses.

Sanity Context MCP. The codebase also includes a JSON-RPC 2.0 adapter (callSanityContextMcp) for Sanity's MCP endpoint, kept behind a fallback condition. The live app currently retrieves through the direct GROQ path.

Reliability. The gateway uses Gemini with multi-key failover, plus a deterministic fallback engine, so users still get a grounded answer from Sanity data if the model is unavailable.

Sanity Project Details

  • Project ID: ntxlr356
  • Dataset: production

Contains 42 titles, 13 trigger warnings, 7 accessibility rules, and 5 CBFC ratings.

Agent Session

USHER was built iteratively in Google Antigravity as the AI-native development environment, covering schema design, the seeding script, the GROQ query layer, the agent's guardrails, and the UI. A transcript isn't included because Antigravity isn't currently supported by the DEV Agent Sessions uploader.

Top comments (0)