How to Automate Content Tagging and Categorization Using AI
Ask ten editors to tag the same article and you get ten taxonomies. One files it under "Retail," another under "Ecommerce," a third invents "Shopping" on the spot, and a fourth leaves the tags field blank because the deadline hit first.
Ask ten editors to tag the same article and you get ten taxonomies. One files it under "Retail," another under "Ecommerce," a third invents "Shopping" on the spot, and a fourth leaves the tags field blank because the deadline hit first. Multiply that across ten thousand documents and your category system stops being navigation and becomes noise. Faceted search returns the wrong things, personalization misfires, and the retrieval layer feeding your AI assistants pulls in half the relevant content because the tags that should have narrowed the set were never applied consistently.
Sanity is the AI Content Operating System, the intelligent backend for companies building AI content operations at scale, and it treats tagging as an automation problem wired into the data model rather than a chore bolted onto the editor. That distinction matters. Automated tagging only pays off when the AI writes into a governed taxonomy field, when a human can review before anything ships, and when those tags immediately improve how content is retrieved downstream.
This guide walks through how to automate content tagging and categorization with AI: designing a taxonomy the model can target, wiring schema-aware generation into the workflow, governing what the AI may write, and closing the loop so tags actually sharpen retrieval instead of just filling a field.
Why manual tagging breaks at scale
Manual categorization fails for structural reasons, not because editors are careless. Taxonomies drift as teams grow, synonyms multiply, and nobody owns the controlled vocabulary, so "Footwear," "Shoes," and "Sneakers" all end up as live tags describing the same shelf. Backlogs make it worse: when a migration dumps forty thousand legacy documents into a new system, no editorial team retro-tags them by hand, so the archive stays effectively invisible to any filter that depends on tags.
The stakes are downstream and compounding. Tags are the structured predicates that faceted search, personalization, content recommendations, and increasingly AI retrieval all lean on. A pure embeddings search can fuzzily match "find me something like a trail runner," but it falls over on anything structural like "trail runners under $150, in stock at the Portland warehouse, men's size 11." That structural filter is exactly what a clean tag applies. Miss the tag and the query either returns too much or silently drops relevant results, and no amount of clever ranking recovers content the filter never surfaced.
There is also a quieter cost. Inconsistent tagging erodes trust in the system, so teams stop relying on categories and start building manual curation lists and hardcoded collections instead. That is scaling people to compensate for a system that should scale output. The reframe this guide argues is simple: categorization is an automation problem with a governance requirement attached, and it should be solved once, in the content backend, rather than re-litigated by every editor on every document.
Model the taxonomy before you automate it
Automation is only as good as the field it writes into, so the taxonomy comes first. This is the Model your business pillar in practice. Before any AI touches a document, you need a defined vocabulary: a tags or category field backed by a controlled list, a document type for taxonomy terms so categories are references rather than free strings, and clear rules about which fields are canonical. Free-text tags are where consistency goes to die; a reference to a governed term is what makes "Trail running" mean exactly one thing everywhere it appears.
In Sanity, the taxonomy lives in the schema, and because the schema is code, it adapts to how your business is actually organized instead of forcing your business into a fixed content type. You model a category document with fields for label, synonyms, parent term, and description, then reference it from the content that gets tagged. That structure is what turns tagging from a guessing game into a constrained classification task: the model is not inventing labels, it is selecting from a known set and writing references into a specific field.
Getting this layer right also future-proofs the downstream work. The same taxonomy that powers a navigation menu is the vocabulary an AI retrieval query filters on, and the same category references a human uses to browse are the predicates that hard-filter an agent's search. Legacy systems create silos here, one taxonomy for the website, another spreadsheet for the campaign tool, a third buried in the search config. A shared foundation means you model the categories once and every consumer, editor, search index, and agent reads the same structure. Automate on top of a messy taxonomy and you automate the mess; model it cleanly and the automation compounds.

Wire schema-aware generation into the workflow
With a taxonomy in place, the automation itself should be schema-aware, meaning the AI knows the shape of the field it is writing into and constrains its output accordingly. This is the mechanism that separates real categorization from "paste the article into ChatGPT and hope." A tool that returns prose forces the model to paraphrase, and paraphrasing is where facts go to die. You want the classifier to return structured data the system can pass straight through into a reference field, not a paragraph you then have to parse.
Sanity's Agent Actions are exactly this: schema-aware AI interfaces (Generate, Transform, Translate, Prompt, and Patch) that create and modify documents in the Content Lake, exposed over an HTTP API and through @sanity/client via client.agent.action.*. Because an action is schema-aware, you can point it at a specific taxonomy or tags field and have it write categories rather than open-ended text. The same instruction that would produce a wall of prose from a generic LLM produces a set of valid references when it is bound to your schema.
For editors who want AI in the interface rather than in a pipeline, AI Assist is the in-Studio plugin, and its documented recipes include AI-powered automatic tagging for blog posts and generating image alt text, all driven by schema-aware context. Custom field actions wire Agent Actions into the Studio document and field menus, so an editor can run a schema-aware "suggest tags" instruction directly from the field they are looking at. For bulk and on-publish automation, the same actions run as a Functions pipeline, so a newly published document gets classified automatically instead of waiting on a manual trigger. This is the Automate everything pillar: the AI is a content primitive, not a sidebar bolted onto the editor.
Govern what the AI may read and write
The fastest way to lose trust in automated tagging is to let the model quietly overwrite fields it should never touch, or ship categories nobody reviewed. Governance is not a compliance afterthought here; it is what makes automated tagging safe enough to run at volume. The question is never just "can the AI tag this," it is "what may the AI read, what may it write, and who signs off before it goes live."
Agent Actions give field-level control over exactly that. Fields marked readOnly or hidden are skipped by default, and conditionalPaths (defaultReadOnly or defaultHidden, or per-path overrides) opt specific fields back in. So you can let a tagging action read the body and title while it is structurally forbidden from touching price, author, or legal fields. Crucially, noWrite runs an action without mutating the dataset, which means you can preview tag suggestions and show them to an editor before a single reference is committed. That preview-before-commit loop is what turns AI tagging from a leap of faith into a reviewable step.
Stage the rest of the review with Content Releases: batch a set of tag changes, preview them the way you preview a website change, and ship on a schedule rather than letting mutations land silently in production. Roles & Permissions decide who can approve, and Audit logs record what changed and when. On the platform side, the honest compliance facts are SOC 2 Type II, GDPR, regional hosting and data residency, and a published sub-processor list. Legacy CMSes bolt AI on and hope the governance catches up; here the controls that gate AI writes are the same controls that gate human writes.
Close the loop: tags that sharpen retrieval
Tagging is not the finish line, it is the input to everything that reads your content, which now includes AI assistants and agents. This is the Power anything pillar. A well-applied category is a structured predicate, and structured predicates are what let retrieval blend the three techniques that actually work together instead of relying on any one alone: keyword search for literal matches, embeddings for semantic ranking, and hard filters for the constraints that must hold.
Anthropic's contextual retrieval research measured how much that blend matters: contextual embeddings cut top-20 retrieval failures by 35%, adding contextual BM25 took that to 49%, and adding reranking on top brought it to 67%. None of the three layers alone was enough. Your tags are the filtering layer in that stack, and they compound with the others rather than competing with them. In GROQ you express all three in one query, using match with text::query() for the keyword hit, score() and boost() to weight it, and text::semanticSimilarity() for the semantic rank, while your tag references do the hard filtering that has to hold.
The part teams underestimate is freshness. When retrieval is wired into Content Lake, index freshness (incremental indexing, re-embedding on change, deletion handling, and backfill) is handled for you rather than being a permanent roadmap line item. When a product description updates, a price changes, an article publishes, or a record is deleted, the index knows. Bolt a separate vector database onto your CMS and you own that pipeline forever; wire retrieval into the content backend and the freshness problem stops being something you maintain. Clean tags plus fresh retrieval is what makes an agent return the right three products instead of a plausible-sounding paragraph about them.
An adoption path that does not stall
The failure mode for AI tagging initiatives is not the model, it is the rollout. Teams try to auto-tag the entire archive on day one, trust the output blindly, and lose the room the first time the AI mislabels a flagship product. A staged path earns trust incrementally and keeps a human in the loop exactly where judgment matters.
Start with suggestion, not commitment. Run the tagging action in noWrite mode so editors see proposed categories in the field menu and accept or reject them; this measures accuracy against your taxonomy without risking a single bad write. Once suggestion quality is trusted for a content type, promote it to an on-publish Functions pipeline that tags automatically but routes changes through Content Releases for a batch review before they reach production. Only then tackle the backlog: run the same schema-aware action across legacy documents in scheduled batches, reviewing samples rather than every record, which is how forty thousand untagged archive items finally become searchable.
Throughout, resist inventing metrics to justify the project. Measure the things that actually move: tag coverage across the corpus, agreement between AI suggestions and editor decisions, and the downstream retrieval quality your search and agents deliver once categories are consistent. The strategic point underneath the mechanics is that a rigid CMS forces you to scale people to keep tagging up, while an AI-native platform scales output instead. You are not hiring a taxonomy team to chase a backlog; you are letting a governed, schema-aware pipeline do the classification and reserving human attention for the edge cases and the approval gate.
Automated tagging and categorization: how the approaches compare
| Feature | Sanity | Contentful | Strapi + LangChain.js | Directus |
|---|---|---|---|---|
| How AI attaches to the model | Schema-aware Agent Actions (Generate, Transform, Patch) write directly into a specified taxonomy or tags field via @sanity/client or HTTP, so output is references, not prose. | App Framework hosts AI sidebar apps (React plus an assistant) in fixed slots; capable but presentation-first, so tagging is app-mediated rather than a schema-bound action. | Assembled from LangChain.js orchestration glue plus tutorials; tagging is achievable but you build and maintain the classification pipeline yourself. | First-party OpenAI integration wired into Flows plus an AI Researcher extension; a low-code enrich-and-tag pattern good for simpler flows. |
| Constrained to a taxonomy | Actions point at a controlled reference field, so the model selects from a governed vocabulary rather than inventing free-text labels that drift. | Possible, but the sidebar app is responsible for mapping AI output to your taxonomy field; nothing schema-level enforces it. | You write the prompt and post-processing that constrain output to valid terms; consistency depends on your glue code. | Flows can enrich fields, but binding output to a controlled reference list is on you to configure. |
| Field-level read/write governance | readOnly and hidden fields skipped by default; conditionalPaths opt fields back in, so a tagger reads body and title but cannot touch price or legal fields. | Governance is defined in the app logic and roles; field-level limits on what AI may write are not a native action primitive. | Whatever your orchestration code permits; no built-in field-level guardrails on AI writes. | Flow permissions and roles apply, with lighter field-level control over exactly what the AI may write. |
| Preview before committing tags | noWrite runs an action without mutating the dataset, so editors preview suggestions before a single reference is written. | Preview depends on how the sidebar app is built; not a platform-level dry-run of AI writes. | Dry-run behavior is whatever you implement in the pipeline. | Flows execute against data; previewing suggestions before write is a custom build. |
| Staged review and audit of AI changes | Content Releases stage and preview batches of tag changes; Roles & Permissions gate approval and Audit logs record what changed and when. | Environments and roles support review workflows; AI-tag changes flow through the same release process you configure. | Review and audit are provided by your own app and database layer, not the tagging step. | Revisions and roles exist; staging a reviewable batch of AI tag changes is a manual assembly. |
| Tags feeding hybrid retrieval | Tag references hard-filter in the same GROQ query that blends match text::query(), score(), boost(), and text::semanticSimilarity() for keyword plus semantic ranking. | Structured filtering is strong; semantic ranking on the same content typically means adding a separate vector service. | Retrieval is whatever you wire with LangChain.js plus a vector store you host and keep in sync. | Filtering via the API is solid; semantic search generally requires an external embeddings pipeline. |
| Keeping the search index fresh | Wired into Content Lake, so incremental indexing, re-embedding on change, deletion handling, and backfill are handled rather than owned as a pipeline. | An added vector index must be kept in sync with content changes by your integration. | Index freshness is a permanent pipeline you build and maintain around your vector store. | External embeddings index must be re-synced as content changes; that upkeep is on your team. |