Start here, agents
Everything on this site is readable without a browser. Start from llms.txt, read any page as Markdown, or ask the docs for their graph. To make an app agent-operable, hand your agent the prompt below.
Set up your agent
Every page on this site is also available as Markdown, and /llms.txt indexes them all. Paste this prompt into your agent to point it at the docs:
Help me make this Next.js app agent-operable with Affordances. Start by reading https://affordances.vercel.app/llms.txt, which lists every page of the Affordances docs. Any page is available as Markdown by adding .md to its URL (for example https://affordances.vercel.app/docs/quickstart.md), and https://affordances.vercel.app/llms-full.txt has the whole site in one file.
1. Follow https://affordances.vercel.app/docs/guides/nextjs/getting-started.md: install @affordances/next, @affordances/react, and zod, then run `vlx @affordances/cli init`. It writes the route handler, wraps next.config.ts with withAffordances, and generates the manifest.
2. Next to each page an agent should operate, add a state.ts (what the page shows) and an actions.ts with defineAction. Set `expose` on every action an agent may call, and use 'confirm' for anything that spends money or can't be undone.
3. Check your work with curl -H 'Accept: application/vnd.affordances+json' on the page's URL, and read https://affordances.vercel.app/docs/guides/nextjs/sessions.md and https://affordances.vercel.app/docs/guides/security.md before exposing anything that needs a session.
Only use APIs that appear in the docs.llms.txt
An index of every page on this site, for agents to read before anything else.
Markdown pages
Add .md to any page's URL for a plain Markdown copy, or read the whole site in one file.
This site’s graph
These docs run on Affordances: ask / for application/vnd.affordances+json, and search and read pages as actions.
MCP
Serve any Affordances site to Claude, Cursor, and other MCP clients as two tools.
Guides
Walkthroughs for the things teams set out to do first.
- Make a page agent-operable
Init, a state file, an action, and curl.
- Share your session with agents
One auth resolver for the UI and the agent path.
- Ask before an order goes through
Confirm actions run only after the person approves.
- Give browser agents tools
WebMCP tools from the page’s own graph.
- Connect Claude to your site
Two MCP tools over any Affordances site.
- Guard what agents can do
Preconditions agents see before they call.
- Answer with what changed
Deltas: changed entities, output, and next steps.
- Catch unmarked controls
Lint rules for Affordance and action names.
Concepts
Actions
One defineAction call describes something a person or an agent can do on a page, and returns the server action that does it.
State
A route's state.ts says what the page shows, as entities. It's loaded for the graph and again after every action.
Expose
Nothing reaches agents until an action says who may call it: public, session, or confirm.
Guards and confirm
The precondition an action checks before it runs. Agents see it before they call, and get its reason when it fails.
Deltas
Calling an action returns what changed on the page, so the agent doesn't have to read it again.
Reference
Protocol
The normative Affordances protocol, version 0: discovery, graphs, calls, deltas, and error codes.
Security
Default deny, explicit confirmation, Origin checks for cookies, and a fixed order of checks on every call.
Options
Every option of defineAction, createHandler, and withAffordances, in one place.
API reference
Every export of every package, with its types, generated from the source.
Benchmarks
A browser agent and an Affordances agent on the same tasks, with committed results.