Skip to content

Headless CMS

When your posts live in a headless CMS, an adapter lets agents search and read them straight from the CMS’s delivery API. Pick yours, replace the placeholders, and paste the tag into your site’s layout.

Public dataset; add your site’s origin to the project’s CORS origins, without credentials.

<script src="https://cdn.jsdelivr.net/npm/agentprose@0/dist/agentprose.min.js" defer
data-adapter="sanity" data-project="abc123" data-dataset="production"
data-type="post" data-url-pattern="/blog/{slug}/"></script>

Search uses GROQ match with score().

data-url-pattern tells agentprose where each entry lives on your site, so agents get links to your pages, not to the CMS.

When your content model uses other field names, map them with the npm API:

import { createAgentTools } from 'agentprose';
import { contentful } from 'agentprose/adapters/contentful';
createAgentTools({
adapter: contentful({
space: 'xxxx',
accessToken: 'CDA_TOKEN',
contentType: 'article',
fields: { body: 'content', published: 'date', author: 'writer' },
}),
});

Every adapter’s options are in the adapter reference.