> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Functions

Sanity Functions enable you to execute custom logic whenever changes occur in your content—all without requiring your own infrastructure.



#### Create your first function

[Create a Document Function](https://www.sanity.io/docs/functions/function-quickstart)
Start building with Functions by deploying a new function to Sanity's infrastructure.

[Create a Media Library Asset Function](https://www.sanity.io/docs/functions/asset-function-quickstart)
Start building a function that reacts to changes to a Media Library asset.

[Official recipes](https://www.sanity.io/recipes)
Get started with pre-built functions for popular use cases

#### Core concepts and guides

[Introduction](https://www.sanity.io/docs/functions/functions-introduction)
Learn how to take advantage of Functions in your Sanity projects.

[Testing functions locally](https://www.sanity.io/docs/functions/functions-local-testing)
Simulate Functions locally with real data and an interactive playground.

[Configure @sanity/client in Functions](https://www.sanity.io/docs/functions/functions-js-client)
Learn to use the JavaScript client in a Sanity Function.

[Add environment variables to functions](https://www.sanity.io/docs/functions/function-env-vars)
Learn to add environment variables to your functions.

[Functions cheat sheet](https://www.sanity.io/docs/functions/functions-cheatsheet)
Common patterns and techniques for creating Functions.

