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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
S
Securelist
V
Vulnerabilities – Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
Simon Willison's Weblog
Simon Willison's Weblog
Hacker News - Newest:
Hacker News - Newest: "LLM"
P
Palo Alto Networks Blog
T
Troy Hunt's Blog
SecWiki News
SecWiki News
Security Archives - TechRepublic
Security Archives - TechRepublic
T
The Blog of Author Tim Ferriss
Project Zero
Project Zero
Microsoft Security Blog
Microsoft Security Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
F
Full Disclosure
阮一峰的网络日志
阮一峰的网络日志
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Attack and Defense Labs
Attack and Defense Labs
Know Your Adversary
Know Your Adversary
WordPress大学
WordPress大学
PCI Perspectives
PCI Perspectives
N
News | PayPal Newsroom
The Last Watchdog
The Last Watchdog
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
CERT Recently Published Vulnerability Notes
H
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
云风的 BLOG
云风的 BLOG
月光博客
月光博客
T
The Exploit Database - CXSecurity.com
I
InfoQ
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
腾讯CDC
小众软件
小众软件
V2EX - 技术
V2EX - 技术
罗磊的独立博客
Cloudbric
Cloudbric
Recorded Future
Recorded Future
IT之家
IT之家
Google DeepMind News
Google DeepMind News
C
CXSECURITY Database RSS Feed - CXSecurity.com

Sanity.io

A Board Game agent built using Sanity Context and Vercel's AI SDK | Sanity 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 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
How I used Agent API to generate photos for my family’s recipes | Sanity
Jarod Reyes · 2026-04-09 · via Sanity.io

Hi folks, Jarod here. I recently joined Sanity as Head of Developer Experience and Community and as part of my onboarding I wanted to play around with some of the newer AI features released inside of Sanity. This post came from that exploration.

I’ve been on a meal plan since earlier this winter, created by my nutritional coach. It’s been great, I’ve lost 25 lbs, but it’s also been complex because I’m the one who cooks and it can be hard to shape a strict meal plan for a family. I wanted an app that could take the PDFs my coach sends, turn them into structured content in Sanity, and support workflows like scaled ingredients for my wife and kids, calculated weights, and search (we use Sanity + Algolia for that).

One thing was missing: pictures. When my family picked dinner or the kids chose a weekend breakfast, there was nothing to look at. So when I learned that Sanity shipped an Agent API action for generating images, one that reads your schema and uses your actual content to drive the prompt, I decided I needed to give it a spin. It did a phenomenal job. Here’s how to do it on an existing schema, with code and a couple of gotchas.

Prerequisites

  • A Sanity project (which you can spin up here) with a document type that has an image (or image array) field.

Note on cost: Each generate call uses about 2 AI credits. Every Sanity org gets 100 free credits per month, so a batch of 50 recipes will use most of your free allotment. Check usage in Manage → Settings.

Generating an image with Sanity Agent API in Typescript

Here's the complete script, ready to copy and run. It uses getCliClient(), which pulls your project config from sanity.cli.ts and your local authenticated session so there's no manual token management or hardcoded project IDs. To run it:

A few things worth knowing before you run it:

  • It targets drafts only. The Agent API writes to the draft version of a document. You'll need to publish after (more on that below).
  • It uses async: true, which means the script queues the generation and returns immediately — it doesn't wait for the image to be ready. Check Studio after a minute or two to see results.
  • It's safe to re-run. The GROQ filter images == null means it only processes recipes without images, so running it again won't duplicate or overwrite anything.

Don't forget to publish

Generated images land in drafts so they won't appear on your site until the document is published. This is intentional: Sanity keeps AI-generated content in draft so a human can review before anything goes live. For a personal meal planner, that's probably fine - just open Studio, eyeball the pancakes, and hit publish.

If you'd rather skip the review step entirely and publish programmatically, you can fire a publish action from the client right after generation:

Add that after the generate call (drop async: true, or wait a beat for the image to be ready) and the whole pipeline runs end to end without touching Studio.

Before: Recipes Without Images

MacroMeals app displaying a 'Coconut and oat pancakes with blueberries' recipe, with ingredients, nutrition, and serving customization.

Without real photos, even the tastiest recipes didn’t look nearly as appealing, and it was tough for family members (especially the kids) to pick what they wanted.

After: Recipes With AI-Generated Food Photos

Stack of coconut and oat pancakes topped with blueberries and syrup, displayed on a plate.

“Wow, I want pancakes!

Summary

So that’s how I wired up AI-generated recipe images in my Sanity meal planner, no schema changes needed, just a patch to pop in the image slot and then Generate does its thing, using the recipe’s title to make sure every photo matches the dish.

Generating appetizing images instantly made the whole meal planner feel polished and so much more fun to use. It’s a great example of how integrating AI into your content operations can speed things along and improve the whole feeling of the app.

Now, when my kids flip through the recipes, they can actually see the coconut pancakes (and everything else) before they put in their “order.” Way more appetizing for everyone- especially the picky eaters!

Taking this further at work

If you're doing something like this in a professional context and backfilling images across thousands of documents in a production dataset, you'd want to reach for Sanity's content migration tooling rather than a one-off script. The CLI migration runner handles batching, dry runs, and rollback-safe execution out of the box, which matters a lot when you're touching production content at scale. The Handling schema changes confidently course on Sanity Learn is a solid place to start if you want to get comfortable with that workflow.

If you want to take a spin through the meal-planning app you can check it out on Github. If you build something with the Agent API, we'd love to see it. Come share it on Discord in the #showcase channel.

Bonus: Alt text

This is how you generate alt text for those generated images as well. The only caveat is that you can’t stick them into the script with async: true since the image might not exist when this code runs. It will work if you async: false but then each iteration of the loop will wait for the image gen to be done. Also requires there to be an alt text field on the image.

Now we will use agent.transform to perform an AI operation on the document with a set of instructions on how to transform it.