惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cisco Blogs
L
LINUX DO - 热门话题
S
Schneier on Security
NISL@THU
NISL@THU
T
Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
量子位
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
月光博客
月光博客
Cyberwarzone
Cyberwarzone
B
Blog
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Microsoft Security Blog
Microsoft Security Blog
Vercel News
Vercel News
小众软件
小众软件
M
MIT News - Artificial intelligence
I
InfoQ
aimingoo的专栏
aimingoo的专栏
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
美团技术团队
Google DeepMind News
Google DeepMind News
T
The Blog of Author Tim Ferriss
Help Net Security
Help Net Security
WordPress大学
WordPress大学
V
Vulnerabilities – Threatpost
T
Tenable Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
Blog — PlanetScale
Blog — PlanetScale
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
D
Docker
MongoDB | Blog
MongoDB | Blog
Forbes - Security
Forbes - Security
H
Hacker News: Front Page
A
About on SuperTechFans
L
LINUX DO - 最新话题
B
Blog RSS Feed
D
DataBreaches.Net
博客园 - 司徒正美
Recorded Future
Recorded Future
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog

Sanity.io

Build a prototype with Claude Code that your whole team can edit | Sanity What’s New - May 2026 | Sanity I built a London pub guide with v0 and the Sanity MCP in six hours. Here's what I learned. | Sanity Build a conference concierge with Agent Context and Anthropic | Sanity Build a content-aware Telegram agent with Vercel AI SDK and Chat SDK | Sanity How I used Agent API to generate photos for my family’s recipes | Sanity What’s New April - 2026 | Sanity Better context, better matches: An AI love story (for dogs) | Sanity How to write for an agent | Sanity Content Agent, meet Slack: AI content operations in your workflow | Sanity Structure powers intelligence | Sanity Your agent needs better content. Here's how to give it. | Sanity How to serve content to agents (a field guide) | Sanity Sanity TypeGen GA: Automatic TypeScript types for content and GROQ | Sanity Sanity is now available on the Vercel Marketplace | Sanity The logo soup problem (and how to solve it) | Sanity Content Releases: From scattered updates to coordinated publishing | Sanity What's New - February 2026 | Sanity How we solved the agent memory problem | Sanity v0 Builder Challenge: The winners | Sanity Introducing: Sanity Agent Skills | Sanity Content Agent: Days of work in one conversation | Sanity Our Sanity Values | Sanity Open Source Pledge 2025: Stepping up when it matters | Sanity v0 builder challenge: $3000 in prizes | Sanity Why AI Breaks Without Structured Content Operations | Sanity What’s New January - 2026 | Sanity BFCM 2025: What teams built when infrastructure stopped being the problem | Sanity How AI shaped holiday shopping and what it means for content in 2026 | Sanity Sanity Studio v5: Embracing React 19 | Sanity You’ll need a CMS eventually. Let your agent set it up. | Sanity “You should never build a CMS” | Sanity AI Content Operations: A 30-Day Implementation Guide | Sanity What’s New December - 2025 | Sanity Scheduled Drafts: Stop manually publishing content at midnight | Sanity What’s New November - 2025 | Sanity Everything *[NYC] 2025 recap: A day of AI, Content Operations, and Culture | Sanity Clankers and content operations | Sanity Content Agent: AI that understands your structured content is here | Sanity Why design-driven content modeling creates technical debt, not velocity | Sanity What's New October - 2025 | Sanity From studio to inbox: How Kevin Green eliminated email campaign friction | Sanity The content editor's guide to content operations [E-commerce edition] | Sanity styled-components maintenance mode: A 40% faster fork | Sanity From zero code to a live website in 7 hours (thanks, Cursor!) | Sanity First attempt will be 95% garbage: A staff engineer's 6-week journey with Claude Code | Sanity Internationalization is more than translating words | Sanity What's New - September 2025 | Sanity We just deleted our 35k-member community Slack | Sanity What's New - August 2025 | Sanity The engineer's guide to content operations [E-commerce edition] | Sanity SEO for AI: Evolving from Web Pages to the Content Lake | Sanity What's New - July 2025 | Sanity Sanity Studio v4: A major version bump for a minor reason | Sanity What's New - June 2025 | Sanity Dashboard and Insights: Your New Content HQ | Sanity Canvas: AI-accelerated, context-aware, freeform authoring | Sanity Agent Actions: AI building blocks for structured content | Sanity Functions: Life beyond pressing publish | Sanity A new era for content applications with Sanity App SDK | Sanity The end of CMS era and our $85M Series C. | Sanity What's New – May 2025 | Sanity Introducing the Sanity Model Context Protocol (MCP) server | Sanity What's New – April 2025 | Sanity Pushing all the envelopes with ambitious content | Sanity Self-hosting is only free if your time is worth nothing | Sanity Content that lasts: Scaling beyond your frontend | Sanity The Live Content API is now Generally Available | Sanity The future beyond AI chat bots | Sanity Learning the new skill of working with AI | Sanity What's New - March 2025 | Sanity Give it in plain text: Making your content AI-Ready | Sanity No More 'DO NOT PUBLISH': Introducing Content Releases | Sanity React in 2025, what's next? | Sanity The final boss of front-end: block editors | Sanity Introducing Sanity for Startups | Sanity A block content editor that loves you back | Sanity A Black Friday Snooze Fest: Massive Traffic, No Drama | Sanity How to make a recipe site that scales well | Sanity The Sanity Winter Release 2024 | Sanity AVIF Arrives, Sanity’s Promise Fulfilled | Sanity Sanity joins the Open Source Pledge | Sanity Your content is now Live by default | Sanity Begin Team to Join Sanity | Sanity Sanity Digest - September '24 Edition | Sanity Sanity partners with Google. Now live on the Google Cloud Marketplace. | Sanity Sanity Digest - August ‘24 Edition | Sanity Now playing: the latest Mux Video Input plugin for Sanity | Sanity Community Digest - June ‘24 Edition | Sanity Community Digest - May ‘24 Edition | Sanity Guide to Sanity's newest product announcements | Sanity AI and Content Creation: A Leader's Guide | Sanity Of course, you should be able to type your content quickly! | Sanity New to AI Assist: translation, reference suggestions, image generation | Sanity Speak the language of your editors: Sanity Studio UI localization | Sanity Introducing the new Sanity Growth plan to serve collaborative teams | Sanity Presentation: Work faster than ever with structured content | Sanity Goodbye Feedback Frenzy, Hello Sanity Studio Comments! | Sanity Easing into the App Router with the Sanity Toolkit for Next.js | Sanity Making website updates easier with structured content | Sanity
A Board Game agent built using Sanity Context and Vercel's AI SDK | Sanity
Jarod Reyes · 2026-05-27 · via Sanity.io

I love board games. They are a very good excuse to entice my kids away from their books and spend some time with the parents. Plus I think I read somewhere that they increase neuroplasticity and I could use plenty more of that.

I decided to use Sanity Context to build an agent that recommends games based on my interests. Sanity Context is an MCP server. MCP (Model Context Protocol) is an open standard for connecting AI agents to external data and tools. Any agent that supports MCP can connect to it: Claude, GPT-4o, whatever you're building with for your next project. In this tutorial I'll walk through the key steps so you can follow along or use your favorite coding assistant to build something similar.

If you'd like to follow along with the full code files checkout this repo:

What we're actually building

Before we dive in any further let's see this thing in action:

I asked the agent, using GPT-4o, to recommend a new cooperative board game for my family that uses narrative story telling and city-building. When I tried this same query with OpenAI's latest GPT 5.5 model it was not able to find me a board game made later than 2023. Instead my agent recommended a top-rated game from this year called Cozy Stickerville.

Notice that my agent didn't guess. Behind the scenes it ran a GROQ query (GROQ is Sanity's open-source query language) against our Content Lake and returned a game that was released in 2026, has both mechanics tagged in their records, directly from BoardGameGeek's (BGG) API. Rad, let's build it.

The recipe

By the end of this tutorial you'll have:

  • A Sanity project with a boardGame schema, populated from BGG's XML API
  • A configured Context plugin for Sanity Studio that scopes an AI agent to your board game data
  • A rather robust agent module that answers natural-language questions by running real GROQ queries against your own Content Lake (this is where you should spend the most time customizing).

For this demo specifically I wanted to focus on the build patterns of building an agent with Context and show that agents can live in different interfaces - which means there is no frontend. It's a CLI, ya' dig?

Prerequisites

  • Node.js 20+nodejs.org. Run node --version to confirm.
  • A Sanity account — free at sanity.io
    You can create an account using npm create sanity@latest as shown below
  • A BoardGameGeek XML API token — registration is required. Create an application at boardgamegeek.com/applications, then create a token and send it as Authorization: Bearer … on every API request. See Using the XML API.
  • An OpenAI API key — the agent script uses GPT-4o by default. You can swap in any Vercel AI SDK provider.
  • A deployed Sanity Studio — studio is where you configure Context for the agent.

Create a Sanity project

Follow the prompts. When asked to install the MCP server, choose yes, it allows you and your agent to interact with Sanity's docs and tools directly.

Expected output:

Your project ID will now be in will now be in sanity.config.ts. Keep it handy, we'll need to add this to the .env file.

Or clone from GitHub: Clone the repo, run npm install, then run:

This will walk you through logging in and selecting (or creating) a project, and automatically write your projectId and dataset to a .env file. Then copy any remaining variables from .env.example and update sanity.config.ts and sanity.cli.ts to match.

Define the board game schema

In Sanity, a schema is a TypeScript definition that describes the shape of your documents, what fields they have, what types those fields are, and how they're validated. It's the contract between your content and everything that reads it: Studio uses it to render the right editing form, your frontend uses it to know what to expect, and Context uses it to expose your data structure to the AI agent.

The default Studio template includes a placeholder schemaTypes/index.ts with a sample type. We're going to replace that with the actual boardGame document type and split it into its own file while we're at it, which is the convention for maintainable Sanity projects.

Create a new file at schemaTypes/documents/board-game.ts:

Then update schemaTypes/index.ts to import from it:

The mechanics and categories arrays are what make the GROQ queries genuinely useful later - they let the agent filter by structured tags rather than approximate text matching.

Next we need to deploy the schema to Content Lake so the Sanity Context server knows your data shape, we'll use the following sanity deploy command which has the added benefit of deploying our studio as well.

Pull board game data into Content Lake

Install the XML parsing package:

Create ingest.mjs at the project root. This is not the full file, but gives you the shape. You can see my version here: https://github.com/jarodreyes/boardgame-sanity-cli/blob/main/ingest.mjs

Create a .env file at the project root. For Sanity, go to sanity.io/manage, open your project, click API → Tokens, and create one with Editor permissions. For BGG, use the bearer token from Applications → Tokens for your registered app.

Run the ingestion:

Why we use getCliClient()

`getCliClient()` picks up your projectId, dataset, and apiVersion directly from sanity.config.ts — no duplication. The `--with-user-tokenflag` passes your active sanity login session to the script, so you don't need a separate SANITY_API_TOKEN environment variable for local ingestion runs. You only need an API token when running in a non-interactive environment like CI.

Expected output:

BGG's thing endpoint accepts at most 20 IDs per request; the script batches automatically and waits 2 seconds between batches.

Start the Studio (npm run dev, then open localhost:3333). After the default small ingest you should see on the order of ~60 board games; each with ratings, complexity weights, mechanics, categories, player counts, playtime ranges, and designer credits from BGG.

Install Sanity Context

Sanity Context is an MCP server. Once configured in your Studio, it gives any MCP-compatible agent three tools to work with: initial_context (a compressed overview of your schema and document count), groq_query (live GROQ access to your Content Lake), and schema_explorer (field-level inspection so the agent builds accurate queries without guessing at field names).

Sanity ships a skill that automates the Context configuration. Run it from your coding assistant and it handles the plugin install, Context document creation, and MCP URL setup.

To set it up manually:

Open sanity.config.ts and add the plugin:

Restart the Studio after the config change.

Create the Context document

In the Studio sidebar, you'll see a new Context section. Click it, then Create new Sanity Context. Fill in these fields:

Save the document. The Studio generates an MCP URL (the API path includes a date version, e.g. v2026-04-09 — use exactly what Studio shows, not a guess):

Copy it.

Connect the agent

Create agent.mjs at the project root:

AGENT_SYSTEM_PROMPT

The system prompt is worth understanding because it controls how the agent queries your data. It sets the query strategy (what to try first, how to widen if a query returns zero results), the BGG-specific field conventions (exact tag strings like "Co-operative Play" rather than the casual phrase "co-op"), and the temporal logic (how the agent interprets "new" or "recent" relative to the current date).

The prompt in this repo was written with help from the Sanity Context skill and iterated against real queries. It's detailed because GROQ is precise. A vague "find cooperative games" won't match anything if the agent guesses at a field name. The tradeoff is token cost per call: a longer system prompt means slightly higher cost per query, but it cuts down on the number of follow-up tool calls the model needs to make.

You'll want to customize this for your own data. The field names, array values, and fallback logic are all specific to the BGG dataset. Swap those out for your schema and you have a solid starting point.

The agent script depends on two more packages: the Vercel AI SDK (ai) and an OpenAI provider (@ai-sdk/openai). Install them with npm:

Worth pausing here on what an agent loop actually is. When you call generateText, the model runs in a loop rather than responding once and stopping. The model decides to call a tool, the SDK executes that tool against your MCP server, the result comes back to the model, and the model decides what to do next. That cycle continues until the model has enough information to give a final answer, or until it hits the stopWhen limit.

In this agent, that means the model is running live GROQ queries against your Content Lake mid-conversation, reading real results, and deciding whether it needs more data before responding. The retrieval happens inside the loop, driven by the model.

The OpenAI provider is the adapter that connects generateText to GPT-4o. The Vercel AI SDK supports other providers too, so if you'd rather use Anthropic or Gemini, swap the provider import and you're good.

Add three more variables to .env. Create a Sanity API token with Viewer permissions:

This pattern works for your data too

Now you can start building your own agents on top of your content. Here are a few queries that show just how precise this gets:

The agent runs a GROQ expression against real records, reads the result, and gives you an exact answer. It counts array lengths, finds maximums, traverses references, whatever your schema supports.

Swap out board games for a product catalog, a documentation site, a recipe database, or a content library. The architecture is the same. The agents you build for your users get smarter the more you invest in your content, not because a new model dropped, but because your data got better.

What's happening under the hood

When you ask the agent a question, it reaches the Sanity Context MCP server. The agent doesn't retrieve context and answer from memory. It runs queries, reads the results, and builds its response from live data. The instructions in the Context document guide how it frames and presents those results.

On top of all this, you can wire up any agent, using any AI you want, and have complete control of the experience for you or your end user/customer… all using Javascript/Typescript/language of your choice.

Your Sanity content becomes structured data the agent can query with the precision of a database.

I am proud to say that after the agent recommended Cozy Stickerville, I actually went and bought it, excited to play it with the fam tonight.

If you are building with Sanity Context or want help figuring out how to use it for your work join our Discord. We will be having some live sessions showing off agents built with Sanity and it'll be a great place to ask questions.