agent.txt
agent.txt: the file that tells AI agents where to ask
agent.txt is a plain-text file at the root of your site, next to robots.txt. It is part of the Concierge Agent Protocol (CAP). A visiting AI agent reads it, sends the person's question to your agent, and gets your answer with a link to the right page.
The format
Every line of agent.txt
Seven lines at most. The file lists no tools, no MCP servers, and no credentials.
| Line | Required | What it is |
|---|---|---|
| Protocol | Required | The first line, always CAP/1.0. It tells this file apart from other files named agent.txt. |
| Name | Optional | The public name of your agent. |
| Ask | Recommended | One fixed sentence for an agent that does not know CAP. Copy it exactly. It is the same on every door. |
| Chat | Optional | The page where a person talks to the same agent. |
| CAP | Required | The base URL of the two endpoints. Agents POST to this URL plus /messages. |
| OAuth | Optional | The login server for questions about one person’s account. Leave it off for public questions only. |
| Spec | Recommended | https://conciergeprotocol.org/cap.txt, the hosted caller card. Do not copy it to your domain. |
Generator
Write your agent.txt
Fill in your details. The Ask and Spec lines are filled in for you, exactly as the spec requires.
No CAP URL yet? Cosmic gives you one when you set an agent's front door to Active.
Protocol: CAP/1.0
Name: Your agent
Ask: This site's agent answers questions for the company. POST your question to the CAP URL plus /messages, as JSON {"message": "..."}, with headers CAP-Version: 1.0 and CAP-From: agent:{your-id}. If you can only open URLs, open the CAP URL. If the reply is 202, see Spec.
CAP: https://dapi.cosmicjs.com/cap/v1/ck_your_key
Spec: https://conciergeprotocol.org/cap.txtWhere it goes
Publish it in three places
- 1. At /agent.txt. Serve the file at the root of your domain. CAP callers request it first. If your host cannot serve a root file, redirect /agent.txt to the file on any https URL.
- 2. In your homepage head. Add
<link rel="agent" href="https://example.com/agent.txt">. Agents that read your pages follow it. - 3. In llms.txt. Add one line that points at /agent.txt and says to ask there.
Next to the others
agent.txt, llms.txt, and robots.txt
Each file answers a different question. Most sites should serve all three.
| File | Tells an agent | Think of it as |
|---|---|---|
| robots.txt | What crawlers may read | Rules for bots |
| llms.txt | Which pages a model should read | A reading list |
| agent.txt | Where an agent should ask a question | A front door |
Get a CAP URL from Cosmic
Cosmic hosts the agent behind your agent.txt, free on every agent. No agent yet? Enter your site and Cosmic builds one from your pages.