Give the agent a topic and it researches, writes, generates a cover image, and publishes a draft to your Sanity content lake. Your team reviews in Sanity Studio and hits publish. What used to take half a day now takes minutes.
Research topic and create outline
You provide a topic or target keyword. The agent researches the subject, looks at search intent, and identifies what to cover. It builds an outline with a title, meta description, and heading structure.
Write the full blog post
Using the outline, the agent writes the complete post. Introduction, body sections with examples, transitions, and a conclusion with a call-to-action. Keywords are woven in naturally.
Generate cover image
The agent generates a cover image based on the topic. The image matches your configured style guidelines and is sized correctly for your Sanity schema.
Create draft in Sanity
The post and image are created as a draft document in Sanity. Content is stored as Portable Text, properly structured for your schema. All metadata is populated.
Publish to Sanity
After your team reviews in Sanity Studio, the agent can publish the document. It goes live in your content lake and is available to your frontend.
How it works with Sanity
This workflow connects directly to your Sanity project. You provide a topic, and the agent handles research, writing, image generation, and publishing to your content lake.
Content is created as Portable Text, Sanity's structured content format. This means proper heading hierarchy, formatted paragraphs, and content that works across any frontend.
Why Sanity for automated content
Sanity's structured content approach makes it ideal for AI-generated posts:
Real-time collaboration. Your team can edit drafts in Sanity Studio while the agent works on new posts. No conflicts, no overwriting.
Revision history built in. Every change is tracked. If you need to roll back an AI draft or compare versions, it's all there.
Schema validation. The agent creates content that matches your exact schema. Required fields, references, custom types. If your schema requires a category or author reference, the agent handles it.
Works with any frontend. Next.js, Gatsby, Remix, Astro, or a custom build. The content is structured data, so it renders correctly everywhere.
Setting up the Sanity connection
You need:
- A Sanity project with a blog post document type
- An API token with write access
- Your project ID and dataset name
During setup, you map the agent's output to your schema fields. Title goes to your title field, body content to your Portable Text field, image to your image asset field.
If your schema has custom fields like reading time, category, or author, you can configure defaults or let the agent populate them based on the content.
Content quality and editing
The agent creates a first draft. Your job is to add what AI cannot: your unique perspective, proprietary data, specific examples from your business.
Best results come from:
- Clear, specific topics (not vague keywords)
- Brand voice guidelines in your agent settings
- A quick review pass before publishing
All content is created as drafts. Nothing goes live until your team approves it in Sanity Studio.
Portable Text output
Content is structured as Portable Text, not raw HTML or Markdown. This gives you:
- Clean heading hierarchy (h2, h3, h4)
- Proper paragraph breaks
- Inline formatting (bold, italic, links)
- The ability to add custom block types later
If you need to add callouts, code blocks, or embedded content, you can extend the schema and the agent will adapt.
FAQ
Does this work with any Sanity schema?
Yes. During setup, you map the output fields to your schema. Common patterns like title, slug, body, and image work immediately. Custom fields can be mapped or given default values.
How does it handle Portable Text?
The agent outputs structured Portable Text that matches Sanity's format. Headings, paragraphs, lists, and inline marks are all properly structured. Your frontend's Portable Text renderer will display it correctly.
Can I use this with Sanity's preview feature?
Yes. Drafts created by the agent appear in Sanity Studio like any other draft. You can preview them with your frontend's preview mode before publishing.
What about image assets?
Cover images are uploaded to Sanity's asset pipeline and attached to the document. They follow the same CDN and transformation rules as manually uploaded images.
Can I schedule posts for later?
If your schema has a publish date field, the agent can set it. Combine this with your frontend's date-based filtering to schedule posts.
Related Templates
AI Blog Writer for WordPress
Publish AI-written blog posts with featured images directly to WordPress. From topic to draft in minutes. Works with any theme.
AI Blog Writer for Contentful
Publish AI-written blog posts with cover images to Contentful. Structured content that works across web, mobile, and any channel.
Generate SEO blog posts automatically with AI and Ahrefs
Turn keywords into full blog posts with AI. Automate research, writing, and SEO optimization. Publish directly to WordPress or Notion.