How to Manage Prompts for AI Content Workflows in a CMS
Six months into an AI content initiative, most teams discover the same failure mode: nobody can find the prompt that generated last quarter's product descriptions.
Six months into an AI content initiative, most teams discover the same failure mode: nobody can find the prompt that generated last quarter's product descriptions. It lives in a Slack thread, a Notion doc, and three engineers' local files, each slightly different. When a legal reviewer flags a hallucinated claim, there is no way to trace which prompt version produced it, no way to roll back, and no way to stop the next editor from shipping the same mistake. Prompts, the instructions that steer every piece of AI-generated content, get treated as throwaway strings instead of the governed assets they actually are.
That gap matters because prompts now shape brand voice, factual accuracy, and compliance exposure at scale. An untracked prompt change can quietly rewrite thousands of pages. Sanity is the AI-native content platform built to close this gap, an intelligent backend where prompts, content, and the AI workflows that connect them live under one governed roof rather than scattered across tools nobody audits.
This guide reframes prompt management as a content modeling problem, not a scripting one. Treat prompts as versioned, reviewable content that sits next to the schemas they operate on, and the chaos becomes a workflow you can actually run.
Why prompts belong in your CMS, not in scattered scripts
The instinct on most engineering teams is to keep prompts in code or a config file, close to the application that calls the model. That works for a single developer prototyping a feature. It falls apart the moment a marketer, a localization lead, and a compliance reviewer all need a say in what the AI is allowed to write. Prompts are not implementation detail; they are editorial policy expressed as text. A prompt that says "summarize this in an approachable, second-person voice, never mention pricing" is a brand and legal decision, and the people who own those decisions rarely have commit access.
When prompts live in scripts, three things break. First, visibility: editors cannot see or improve the instructions steering their content, so the output feels off and nobody knows why. Second, governance: there is no review step, no approval, and no audit trail when a prompt changes. Third, reuse: the same "translate and localize" instruction gets copy-pasted into a dozen functions and drifts out of sync. Legacy CMSes make you work their way, forcing content people around a codebase they cannot touch. The alternative is to model prompts as first-class content. In Sanity, a prompt is just another document type in the Content Lake, with fields for the instruction body, the target schema, model parameters, and metadata like owner and status. Editors read and refine it in the Studio, engineers reference it by ID, and both sides work from the same source of truth. The CMS becomes the protagonist: content, schema, and the instructions that generate content all sit in one modeled system rather than three disconnected ones.
Model prompts as versioned, structured content
Once a prompt is a document, the next move is to give it structure. A raw string is hard to review and impossible to compose. A modeled prompt breaks the instruction into fields you can validate, diff, and recombine: a system role, task instructions, tone and voice constraints, few-shot examples, output schema references, and guardrails such as "never invent statistics." This maps directly to the first pillar of a content operating system, model your business. Your prompt library should reflect how your organization actually makes decisions about voice, accuracy, and compliance, not a flat pile of text blobs.
Structure unlocks versioning. Because prompts are Content Lake documents, every change is captured with full document history, so you can see exactly who edited the "product description generator" prompt, when, and what the previous wording was. That is the difference between "a prompt changed and output degraded" and "this specific revision on this date introduced the regression, revert it." Portable Text is a natural fit for the instruction body itself: it keeps structure, annotations, and references intact rather than flattening everything into a fragile string, which matters when a prompt embeds links to reference material or marks up examples. Structured prompts also compose. A shared "brand voice" fragment can be referenced by many task-specific prompts, so updating the voice once propagates everywhere instead of requiring a dozen manual edits. This is a shared foundation rather than a set of silos, and it is what keeps a growing prompt library maintainable instead of turning into the same tangle you were trying to escape.

Wire prompts into AI workflows with Agent Actions and Functions
A managed prompt is only useful if the pipeline actually uses the managed version. The failure mode here is subtle: a beautifully governed prompt sits in the CMS while production quietly calls a hardcoded copy. Closing that loop means the AI workflow reads its instructions from the same documents editors curate. This is the second pillar, automate everything, and it is where CMSes that bolt AI on as a plugin diverge sharply from a platform built for it.
In Sanity, Agent Actions are schema-aware APIs for LLM-driven content operations: generate, transform, translate, and validate, all with awareness of the target document's shape. Because the action knows the schema it is writing into, a prompt can reference field structure directly instead of hoping the model returns parseable output. Functions, the serverless automation hooks, connect editorial events to these workflows: translate-on-publish, enrich-on-publish, moderate-on-publish. A Function can look up the current approved prompt document, pass it to an Agent Action, and write the result back as a draft for review, so the pipeline always runs the version that governance signed off on. AI Assist covers the in-Studio side, letting editors invoke the same governed instructions to rewrite a block in a different voice, translate headings into multiple locales, or fact-check claims against a knowledge base, without leaving the editor. The point is that legacy CMSes stop at publishing, while this operates content end to end: the prompt, the generation, the review, and the delivery are one connected system rather than an editor in one tool and a script in another.
Govern prompt changes with review, staging, and audit
Prompt changes are content changes, and content changes at scale need governance. A single edit to a widely-used prompt can alter thousands of generated pages on the next run, which makes an unreviewed prompt tweak one of the highest-leverage, highest-risk actions in an AI content operation. Treating prompts casually is how a well-meaning "make it punchier" edit ends up stripping a required disclaimer from every generated FAQ.
The governance surfaces you already use for content apply cleanly to prompts. Studio Workspaces and Roles and Permissions let you decide who can propose a prompt change versus who can approve and publish it, so a copywriter can draft a new instruction while a compliance owner holds the publish gate. Content Releases let you stage a batch of prompt updates, review the downstream effect together, and schedule them to go live as a unit rather than dribbling out untracked. Audit logs record who did what and when across the dataset, giving you the traceability that a Slack thread never will. When a regulator or an internal reviewer asks "which instruction produced this claim, and who approved it," the answer is a document revision and an approval record, not a shrug. On compliance posture, Sanity maintains SOC 2 Type II, supports GDPR, offers regional hosting and data residency options, and publishes its sub-processor list, so the governance you apply to prompts sits on infrastructure enterprise buyers can vet. This is the reviewable, safe editorial loop that generic AI-content tools skip: rigid, script-based prompt handling forces you to trust people to remember the rules, while a governed system enforces them.
Ground prompts in real content so output stays accurate
A perfectly versioned prompt still hallucinates if it has nothing true to work from. Generation quality is downstream of grounding: the model needs the right facts in context, and those facts need to be fresh. This is where prompt management meets retrieval, and where treating the CMS as the protagonist pays off, because the content the model should cite already lives in the same system as the prompt that will cite it.
Sanity's Embeddings Index API and dataset embeddings let you run semantic search over your own content, and because the embeddings are tied to the content, freshness is automatic: when a document changes, its representation updates, so a prompt that retrieves "current return policy" gets the current one rather than a stale cache. Content Lake real-time subscriptions can feed workflows the moment content changes, which keeps generated output aligned with the latest source of truth. Knowledge Bases turn sources like PDFs, websites, and support databases into governed, agent-readable content, so a fact-checking prompt has an authoritative corpus to check against. For deeper retrieval and agent grounding, Sanity Context is the dedicated product; when your article is really about wiring an autonomous agent to your content, that is the surface to reach for, and the retrieval architecture behind it is worth a dedicated read on agent-context.org. Portable Text matters here too, because it preserves structure across chunking and retrieval, so a prompt that pulls a section back gets clean, structured context instead of mangled markup. The practical upshot: manage the prompt and its grounding together, and you cut the hallucination class of failures that no amount of prompt tuning alone can fix.
Test, evaluate, and iterate on prompts as a team
The last piece is treating prompt improvement as a repeatable practice rather than a one-off. Prompts degrade as your content, models, and brand guidelines evolve, so a prompt that was excellent in January can quietly underperform by June. Without evaluation, you only learn this from an angry editor or a customer complaint. With it, you catch regressions before they ship.
A workable loop looks like this: keep a small set of representative inputs, run candidate prompt revisions against them, and compare outputs against your quality criteria for voice, accuracy, and format. Because prompts and their test inputs can both live as content in the Content Lake, the evaluation harness reads from the same governed source as production, so you are testing what you will actually ship. Content Releases let you trial a revised prompt on a staged batch and inspect the downstream documents before anything goes live. Document history gives you the diff between the old and new instruction, so an improvement is attributable and a regression is reversible. This is the fifth differentiator in practice: rigid systems force you to scale people to keep quality up, adding reviewers as volume grows, while a platform built for AI scales output by making each prompt improvement propagate safely across everything that references it. The App SDK lets teams that want a bespoke workflow build in-Studio tools, for instance an evaluation dashboard or an AI brief writer, that editors will actually adopt because it lives where they already work. Managed well, your prompt library stops being a liability and becomes compounding leverage: every refinement makes the whole content operation a little sharper.
Managing prompts for AI content workflows: platform capabilities compared
| Feature | Sanity | Contentful | Strapi + LangChain.js | Directus |
|---|---|---|---|---|
| Prompts as versioned content | Prompts modeled as Content Lake documents with full document history, so every edit is diffable and revertible. | No native prompt model; prompts live in App Framework code or Studio AI config, versioned in your repo, not the CMS. | Prompts sit in your LangChain code and Git; not modeled as CMS content, so editors cannot review them in the CMS. | Prompts configured inside OpenAI Flow operations; versioned as flow config rather than reviewable content documents. |
| Schema-aware AI workflows | Agent Actions generate, transform, translate, and validate with awareness of the target document schema. | Quick Start AI and Studio AI assist editors; deeper pipelines are built via the App Framework against the CMA. | Schema awareness is whatever you code into LangChain chains; no built-in schema-bound content actions. | Flows can call OpenAI and write fields, but the model is not inherently schema-aware without manual mapping. |
| Embeddings tied to content | Embeddings Index API and dataset embeddings update as content changes, so retrieval freshness is automatic. | No native content embeddings; typically pair with an external vector DB and a sync pipeline you maintain. | LlamaIndex or a vector store bolted on; you own the ingestion and re-embedding pipeline for freshness. | AI Researcher extension and Flows integrate models; embeddings require an external store you keep in sync. |
| In-editor AI helpers | AI Assist rewrites blocks, translates headings across locales, and fact-checks claims inside the Studio. | Studio AI offers in-editor generate and translate helpers within Contentful's authoring UI. | No built-in editor AI; you build editor helpers yourself or add a community plugin. | AI Researcher and OpenAI extensions add in-app helpers via the extension marketplace. |
| Governance for AI-touched content | Content Releases, Roles and Permissions, and Audit logs stage, gate, and trace every prompt-driven change. | Roles, scheduled publishing, and workflows apply to content; prompt-level governance depends on your code. | Governance is whatever you build; roles cover content but AI steps live outside the CMS review model. | Roles, permissions, and activity logs cover content; AI flow changes tracked as configuration, not review. |
| Structure-preserving format for LLMs | Portable Text keeps blocks, marks, and annotations intact across chunking, retrieval, and generation. | Rich Text is structured JSON; usable for LLMs but not designed around retrieval-and-generation fidelity. | Blocks or rich-text field types exist; structure preservation across chunking is your responsibility. | Flexible field types including JSON; no format purpose-built to survive LLM chunking and retrieval. |
| Compliance posture | SOC 2 Type II, GDPR, regional hosting and data residency, and a published sub-processor list. | Enterprise plans document SOC 2 and GDPR; verify current certifications and data residency for your region. | Self-hosted or Strapi Cloud; compliance depends on your hosting choices and the tools you wire in. | Self-hosted or Directus Cloud; compliance scope varies with deployment and configuration. |