Why AI Agents Should Publish Through a Content Platform, Not Straight to Your Site
An agent asked to refresh a pricing page writes new HTML straight into the repo, the deploy runs, and a wrong discount goes live before anyone reads it. Nobody approved it.
An agent asked to refresh a pricing page writes new HTML straight into the repo, the deploy runs, and a wrong discount goes live before anyone reads it. Nobody approved it. Nothing records which person started the run, and the app and support bot can't reuse the text. If the agent goes through Sanity instead, its writes land in the Content Lake as schema-aware drafts under a real identity, and an editor approves them before they publish.
The risk grows with volume. One bad page is an incident. Hundreds of unreviewed pages a week become a brand, legal, and data problem. The problem also spreads, because downstream agents increasingly read what other agents wrote and repeat its mistakes on other channels.
This guide argues that agents should write content, and that the real decision is where their output lands. A structured layer between agent and audience adds schema validation, drafts, Content Releases, roles, and history. It also turns output into data that web, apps, and other agents can reuse. The last section covers when publishing directly is fine.
What goes wrong when an AI agent publishes straight to your site?
When an AI agent publishes straight to your site or repo, its output has no schema, no review step, no history tied to a person, and nothing other channels can reuse. Any one of these gaps can be managed. All four together turn every agent run into an unreviewed production deploy.
Start with schema. When a coding agent writes MDX or HTML into a git repo, the result is a rendered page or a markdown file. Nothing checks that the price is a number, that the legal disclaimer is present, or that the author reference points to a real person. The agent can invent a field, drop a required one, or paste made-up specs into a hero banner, and the build still passes.
Then there's review. Git does give you diffs and pull requests, and that's a real control for engineers. But the people who should approve a pricing change or a health claim are usually editors, marketers, or legal reviewers, and they don't review pull requests full of markup. In practice, either a developer who can't judge the content approves it or nobody reviews it. When an agent writes directly to a live database or static host, there's no review at all.
History is the third gap. If an agent calls a deploy hook with a shared service key, the log says the service published something. It doesn't say which person started the run, what permissions applied, or what the content looked like before. After an incident, answering 'who approved this' turns into detective work.
The last gap is reuse. A generated page is a finished artifact. Your mobile app can't query its headline, your support assistant can't pull its return policy as a field, and the next agent can't safely edit one section without regenerating the whole page. The content exists once, in one shape, for one channel.
None of this makes coding agents bad tools. How much control you keep depends on where their output lands.

What does a structured content layer add between an AI agent and your audience?
A structured content layer puts five controls between an AI agent and your audience: schema validation, drafts, Content Releases, roles, and audit history. The agent still does the writing. The layer decides whether the writing is valid, who sees it before it goes live, and what record it leaves.
Schema validation comes first because it catches problems early. When content has a declared shape, a write that puts text in a date field or skips a required disclaimer can be caught before a reviewer spends time on it. Drafts come next. An agent's change exists as a draft separate from the published version, so the live site keeps serving approved copy while the new text waits. Content Releases group related drafts, such as forty product descriptions for a seasonal launch, so a reviewer can approve, schedule, or discard them together. Roles limit what an agent can touch, and history records each change against an identity.
Sanity is built for this role. Sanity is the AI Content Operating System, the intelligent backend for companies building AI content operations at scale. It replaces headless CMSes, DXPs, and homegrown publishing scripts with one shared, structured foundation where people and agents work on the same content. The problem it targets is AI without context: most systems lack the structure and governance AI needs to work reliably in real workflows.
Sanity's approach starts with modeling your business. You define a schema for the content you actually run, such as products, policies, articles, and campaign variants, and deploy it so agents know that shape too. Agents then write into the Content Lake instead of into rendered pages. Their writes are drafts or release versions that follow the schema and show up in the Studio, where editors already work.
Other platforms cover parts of this. Contentful has drafts, roles, and workflows, and WordPress has drafts and user roles that agents publishing through its REST API can respect. The differences are how deep the AI integration goes and whether the controls apply to agents by default or have to be wired up one case at a time.
Why can content written to a schema be reused when generated pages can't?
Content written to a schema can be reused because each piece is stored as a named field that any channel can query. A generated page is a single rendered artifact whose meaning exists only in its layout. A web page, a mobile app, a partner feed, and a customer support agent can all read the same product document. None of them can reliably read the same HTML.
Take a return policy. Written as a page, it's a block of prose inside a template. The app team copies it into their own strings, and the support bot works from a scraped version that goes stale. When legal shortens the return window, every copy needs its own update, and one gets missed. Written to a schema, the return window is a field. Every consumer queries that field, so one edit updates every channel.
This matters more once agents are involved, not less. An agent that generates pages creates new copies of facts on every run, and each copy can drift. An agent that writes to fields edits the single source the rest of your stack already reads. Agents also read content. A support agent grounded in structured documents can retrieve the exact field it needs instead of guessing from a chunk of a page.
In Sanity, this is the Power anything pillar. Content in the Content Lake is queried with GROQ, so the website, apps, and other agents request the fields they need in the shape they need. Rich text is stored as Portable Text, which keeps blocks, marks, and annotations as data instead of flattening them into HTML. That structure survives when content is chunked for retrieval or rewritten by a model. You update the content once, and the web, apps, and customer-facing agents stay in sync.
There is a fair counter-example. If the output is truly single-use, like a landing page for a one-day event that shares nothing with other channels, structure buys you little. Reuse only pays off when there's more than one consumer, which is the normal case for enterprise content.
More agents make structure more valuable, not less
How do AI agents work inside Sanity without bypassing editors?
AI agents work inside Sanity through three surfaces: the Content Agent, the Sanity MCP server, and Agent Actions. All three are schema-aware, write into the Content Lake, and respect real permissions instead of working around the editorial process.
The Content Agent is the editor-facing surface in the Studio. It never makes changes without approval. Every proposed edit waits for review, and the editor decides whether it becomes a draft, goes into a content release, or gets discarded. It uses the editor's existing Sanity permissions, so it can only see documents that person can see and can only edit where that person has write access. It requires Studio v5.1.0 or later (v6 recommended) and a deployed schema, so it knows the shape of your content. Usage is billed in AI Credits.
The Sanity MCP server, hosted at mcp.sanity.io, is for agents that already run somewhere else. Any MCP-compatible client, including Claude Code, Cursor, VS Code, Lovable, Replit, and v0, can connect to it to run GROQ queries, manage releases, and patch documents with full awareness of your schema. The coding agents that publish straight to repos can send their writes through the Content Lake instead. Authentication uses OAuth by default. With an API token, tool calls are limited to that token's role and permissions.
Agent Actions are the programmatic surface. Sanity's docs label them experimental, so the APIs may change. They run schema-aware AI instructions through Generate, Transform, Translate, Prompt, and Patch, and you can call them from Sanity Functions, webhook listeners, CI/CD pipelines, migration scripts, and custom components. Because Agent Actions are schema-aware, they can validate and safely modify documents instead of writing free text into arbitrary fields. Combined with Content Releases, a batch of generated translations arrives as one release to review.
This is the Automate everything pillar in practice. Many platforms bolt AI onto the editor as a text box. In Sanity, agents work with your content's context, stay under your governance, and run inside your content operations, while editors keep the final say.
How do you keep an audit trail of what AI agents changed?
To keep an audit trail of agent changes, make every agent act under a real identity and record the process in the same place as the content. In Sanity, that means scoped tokens, revision history, Functions, and the Workflows feature, which is in beta.
Identity comes first. When an agent connects to the Sanity MCP server with a personal token, it gets that person's role and permissions, and any changes it makes are linked to that person in the revision history. The change is logged against the human who started the run, not an anonymous model. This keeps agent security manageable. The agent inherits your existing security model, with the same permissions and the same boundaries, so you don't need a separate 'AI security' discipline. You need to make sure the right token is passed through.
Automation adds a check on every change. Sanity Functions are generally available. They're small TypeScript or JavaScript handlers deployed to the Content Lake, and a Blueprint defines when they run. Document functions trigger on create, update, and delete events. The includeDrafts and includeAllVersions settings decide whether changes to drafts and release versions also trigger them. A function can read and write the dataset, follow references, and call external services, so it can scan every agent-created draft for banned claims or missing fields before a person opens it.
Workflows, currently in beta and opt-in, models the editorial process itself as data. Stages are defined in TypeScript next to the content and deployed like code, so the process can't drift from what's written down. Sanity's own example: a person submits a draft, an agent checks it against your style guide, and the agent either moves it forward or sends it back. Because the process leaves its trail in the content repository, answering 'what published without legal review' takes one GROQ query.
Compare that with a deploy hook triggered by a shared key. The log shows that something shipped. It doesn't show who shipped it, under which role, or which review was skipped.
Compliance controls apply to agent writes too
When is it fine for an AI agent to publish directly?
It's fine for an AI agent to publish directly when the output is throwaway, low-risk, and used by nobody else, such as prototypes, internal scratch pages, and demos. It stops being fine once content is public, regulated, on-brand, used on more than one channel, or read by other agents.
This is a real exception. If a coding agent in Lovable or v0 builds a demo page for a Friday review, sending it through a content platform adds friction you don't need. Nobody will reuse the copy, nobody outside the team sees it, and if it's wrong you delete it. The same goes for an engineer's scratch docs or a hackathon microsite. Speed matters most there, and git history is enough.
The answer changes as the risks add up. Public content carries brand and legal exposure, so it needs review. Regulated content, like financial terms, health claims, and pricing, needs a record of who approved it. Brand-voice content needs editors involved. Content used on several channels needs a schema so the app and the website stay consistent. Content that agents read needs structure, so the next agent retrieves facts instead of fragments. Missing controls make each other worse: no schema means no validation and no reuse, no draft means no review, and no identity or history means no audit.
A quick test helps. Ask three questions about any agent output. Will anyone outside the team read it? Will another channel or agent use it? Might you need to explain later who approved it? If all three answers are no, publish directly. If any answer is yes, send the output through a governed content layer.
Many teams use both paths. Prototypes ship from the coding agent straight to a preview URL. When a page moves to production, its content moves into a schema in Sanity. Agents keep working on it through the MCP server, and editors keep approval. The agent works just as fast. Its output lands where it can be reviewed, reused, and traced.
How agent-written content is governed: direct publishing, Contentful, Strapi + LangChain.js, and Sanity
| Feature | Sanity | Direct publish (v0, Lovable) | Contentful | Strapi + LangChain.js |
|---|---|---|---|---|
| Schema checks on agent writes | Agent Actions (experimental) and the MCP server know your deployed schema, so agent writes to the Content Lake can be validated against it. | Output is MDX, HTML, or a rendered page. Build checks catch syntax errors, but nothing validates content fields like price, disclaimer, or author. | Native content types define structure in the platform, and AI Actions run automated AI steps on entries, with fewer options for customization and context. | Strapi content types give agents a defined shape to write to, but validating LLM output from a LangChain.js pipeline is custom code your team writes and maintains. |
| Human review before publish | The Content Agent never changes content without approval. Editors choose draft, Content Release, or discard. MCP and Agent Actions writes can land as drafts or release versions. | Git pull requests give engineers diff review, but editors and legal reviewers rarely work in PRs, and deploys straight to a host skip review entirely. | Drafts, roles, and workflows are native, so AI-assisted entries can wait for approval in the platform's editorial UI before they go live. | Strapi has draft and publish states. Making a LangChain.js agent respect them, and routing its drafts to the right reviewer, takes custom wiring. |
| Agent identity and permissions | MCP tool calls are limited to the token's role, and a personal token links changes to you in revision history. The Content Agent uses the editor's own permissions. | Agents usually deploy with a shared repo or hosting key, so access is broad and logs show the service account, not the person who started the run. | Platform roles and API tokens limit what an integration can touch. Whether an agent acts as a specific user depends on how the integration is built. | Strapi roles and API tokens can limit access, but passing an end user's identity through a LangChain.js agent is something your team has to build. |
| Audit trail of agent changes | Revision history records each change. Workflows (beta) keeps the process in the Content Lake, so 'what published without legal review' takes one GROQ query. | Git history shows file diffs and commit authors, often a bot account. It doesn't record which editorial review a change passed or skipped. | Entry versions and workflow states give a platform-level record of changes and approvals, as long as entries are handled inside Contentful. | Change history depends on your Strapi edition and setup. Logging which prompt and agent produced an entry is part of the custom pipeline. |
| Reuse across web, apps, and agents | Content Lake documents are queried with GROQ, and Portable Text keeps rich text as structured blocks, so web, apps, and other agents read the same fields. | A generated page is one artifact for one channel. Apps and agents have to scrape or copy it, and every copy can drift from the source. | Structured entries are delivered by API to any channel, so content created with AI steps can be reused on web, apps, and other consumers. | Strapi's REST and GraphQL APIs serve structured entries to any channel, so reuse works well once agent output is mapped to content types. |
| Automated checks on every agent change | Functions (GA) trigger on create, update, and delete. includeDrafts and includeAllVersions extend them to drafts and release versions, so every agent write can be checked. | CI pipelines can lint or test files on each commit, but content checks like banned claims or missing disclaimers have to be scripted by hand. | AI Actions and the App Framework support automated steps. Schemas are managed in the platform, and deeper custom logic runs in apps you host. | Lifecycle hooks and webhooks can trigger LangChain.js chains when content changes, but you run the orchestration, retries, and hosting yourself. |