See AI content operations in action at Braze. Join the live session April 14th
Compute + AI

Colocated logic for content changes

Write once, use everywhere

Package functions as reusable modules to maintain consistent results and reduce code duplication. This approach allows you to build a library of tested, reliable functions that can be applied wherever needed.

Create. Invoke. Deploy.

Instantly create new functions from the CLI, test locally with the included development environment and deploy to production.

Press publish and watch the magic

Use Functions to automatically translate new fields and documents, validate with AI, or invalidate the cache of your front-end.


The content automation toolkit

Respond in real time

Event-driven content workflows

import {defineBlueprint, defineDocumentFunction} from '@sanity/blueprints';

export default defineBlueprint({
  resources: [
    defineDocumentFunction({
      name: "text-to-speech",
      event: {
        on: ["update"],
        filter: "_type == 'event'",
        projection: "{title, content}",
      },
    })
  ]
});
Complete context

Runs inside the Content Lake

a grid of nodes with a line connecting some of them
Workflow automation

Connects content to content operations

import { textToSpeech } from "./text-to-speech";

export const handler = documentEventHandler(async ({ context, event }) => {
  const audio = await textToSpeech(event.doc.content);

  const client = createClient({
    ...context.clientOptions,
    apiVersion: "2025-05-08",
  });

  await client.assets.upload("file", audio, {
    filename: `${event.doc.title}.mp3`,
    contentType: "audio/mpeg",
  });

  console.log("Audio generated and uploaded successfully");
});
FUNTIONS + AGENT ACTIONS

Trigger AI workflows on content changes

Explore Agent Actions
functions
G2 badge: momentum leader, spring 2025G2 badge: spring 2025 users most likely to recommend mid-marketG2 badge: grid leader enterpriseG2 badge: spring 2025 high performer mid-market

Developers love Sanity

All G2 reviews

It's incredibly easy to push data into Sanity Content Lake from outbound systems. With the Sanity API, I'm not making 10,000 calls to update 10,000 items. I'm making one API call and the whole dataset is updated.

A portrait of Kevin Harwood
Kevin Harwood
CTO

Ready to build? Let's make it real.

Sign up for Sanity for free and start crafting your first project.

Get Started