Connect Your AI Agent to Surreal CMS

By Cory LaViska on November 20, 2026

Your AI agent can now work in your Surreal CMS account. Give it a token, and it can create the site, enable the pages, add templates and blocks, and invite your client. Everything it does appears in your activity log as your agent's work.


What it looks like

Start your agent and give it a prompt like this one.

Build a marketing site for Acme Bakery with Home, Menu, and Contact pages.

Read https://www.surrealcms.com/skills/surreal-cms/SKILL.md, add the site to my Surreal CMS account, and let bob@acmebakery.com edit it.

The agent writes the pages with content regions, checks them with the skill's checker, and deploys them to your hosting. Then it uses the token to create the site in Surreal CMS, enable the pages, add a page template and a few blocks, invite Bob, and give him access. It asks before it sends the invitation, and it ends with a list of what it did and what's left for you, such as opening each page in the editor once before Bob does.


Turning it on

Go to Users › Edit Profile › Security & Access › Agent Access and select Enable Agent Access. You'll choose two things:

  • Invite people and manage their access. On by default. Turn it off if you'd rather invite clients yourself.
  • Delete things. Off by default. Sites, pages and their files, revisions, and people can't be brought back, so the agent only gets this when you say so.

The token is shown once. The agent reads it from an environment variable named SURREAL_AGENT_TOKEN, so it stays out of your code and your chat. If you use Claude Code, put it in ~/.claude/settings.json and it's there every time. For any other agent, see its documentation for setting environment variables.


What it can't do

Tokens can leak, so a few things are off limits no matter how the switches are set:

  • It can't create or change admins, set anyone's password, or change anyone's email.
  • It can't generate login links.
  • It never sees your hosting credentials. It can set them when it creates a site, but they never come back in a response, so they never end up in the model's context.
  • It can't publish, edit an existing page's content, or upload files. Those stay in the app, where you and your clients work.

When the agent runs into one of these, the API tells it exactly which switch it needs or that the task belongs in the app, and the skill tells it to stop and say so rather than look for another way.


Everything is logged

Every site, page, template, block, and invitation an agent touches is a row in the activity log, under your name with a via agent badge. Turning agent access on or off, regenerating the token, and changing a switch are logged too. If something looks wrong, you can see what the agent did and when.


Turning it off

Disable Agent Access revokes the token right away. Regenerate replaces it and keeps your switches. And if you own the account, Settings › Advanced has an Allow AI agents switch that pauses every agent on the account at once, without removing anyone's token, so you can turn it back on later without anyone setting up again.


Agent access is part of every paid plan. The Developer API and its Personal Access Token are still there for your own integrations. For an agent, use an agent token. If you build something with it, or the skill gets something wrong, let us know.

So simple, it’s Surreal

Free for personal, educational, and non-profit websites.

By signing up, you agree to the terms of service.