Cover Image for Build Fast, Governed Knowledge Agents with Sanity Context
Cover Image for Build Fast, Governed Knowledge Agents with Sanity Context
Avatar for Mastra
Presented by
Mastra
The open-source TypeScript framework for building AI agents
2 Going

Build Fast, Governed Knowledge Agents with Sanity Context

Register to See Address
Registration
Welcome! To join the event, please register below.
About Event

​Most agents that answer from company knowledge run into the same problems. The facts live in a CMS, a marketing site, PDFs and internal wikis, and some of them contradict each other. The agent spends seconds deciding where to look, repeats whatever it finds first, and has no clear boundary on what each audience is allowed to see. A longer system prompt doesn't fix any of this. What fixes it is a knowledge layer that controls what each agent can reach and how quickly it finds the right answer.

​In this workshop, we'll build Mastra agents on top of Sanity Context. Its Knowledge Bases extract facts from your Sanity content, websites and uploaded files, then organize them into topic entries with an index built for agent lookup. We'll connect several agents to the same knowledge through Model Context Protocol (MCP) servers, give each agent its own scope, and move routing decisions out of the LLM and into a fast classifier. Sanity used this pattern to build a docs agent that returns a full answer in about half a second at the median.

​We'll cover:

  • ​Compiling knowledge once. You'll turn scattered content into a single Knowledge Base so every agent reads the same entry, and you'll fix contradictions in the content itself instead of patching them in the prompt.

  • ​Scoping access per agent. You'll use Mastra's MCP client with static tools for shared agents and runtime toolsets for per-user or per-request credentials, so a public support agent and an internal agent see different knowledge.

  • ​Deciding before generating. You'll use Mastra's Classifier to pick the right Knowledge Base entry and retrieval source in one call, and you'll use its probabilities to decide when a question needs a second entry.

  • ​Routing to the right model. You'll use ModelSelectionProcessor to send simple lookups to a smaller model while keeping code and multi-step reasoning on a more capable one, and you'll measure whether the savings hold up on your own traffic.

​Join us for a live demo and real code you can fork. You'll also have time to ask questions directly to the team behind these features.

​Hosted by:
Brandon Barros, Founding Product Advocate @ Mastra
Anne Prins, Tech Partnerships Lead @ Sanity
John Siciliano, Senior Technical Product Marketing Manager @ Sanity

Avatar for Mastra
Presented by
Mastra
The open-source TypeScript framework for building AI agents
2 Going