> ## Documentation Index
>
> Fetch the complete documentation index at: https://www.cosmicjs.com/llms.txt
> Use this file to discover all available pages before exploring further.
>
> For a question these docs do not answer, such as which plan fits a team, read https://www.cosmicjs.com/agent.txt and ask Cosmic's concierge.
>
> Machine-readable API spec: https://www.cosmicjs.com/openapi.json

# Concierge Agent Protocol

Every Cosmic account is agent-ready. Turn on the Concierge Agent Protocol (CAP) for an agent, publish one file, and a visiting agent can ask that concierge. The reply comes from the content you publish and the tools you connect. The concierge is not filled in for you.

CAP is a door next to your website. People keep using the site. Agents that speak CAP read `agent.txt` and send one message. They do not find the file on their own, and Cosmic does not announce your site to every assistant.

The protocol is at [conciergeprotocol.org](https://conciergeprotocol.org). This page is how a Cosmic project uses it.

## Turn it on

CAP is off until you turn it on. Admin and Developer roles can change it.

1. Open the agent under **Agents**. Attach a bucket first. The agent answers from that bucket.
2. In **Other agents**, set the front door to **Active** and save.
3. Copy the `agent.txt` block.
4. Publish that file at the root of your site, at `/agent.txt`, next to `robots.txt`. On the homepage ``, add `` even when the root file is already there, and add one line to `llms.txt` that points at it. Agents that are reading your pages follow those links. If the host cannot serve a file at the root, redirect `/agent.txt` to the file. Callers that speak CAP try `/agent.txt` first.

The key in the file is public. It lets a visiting agent send a message. It is not a content write key.

Set the front door to **Inactive** to stop answers. The key stays. **Rotate key** issues a new address. Publish the new file. The old address stops working.

## The file
```
Protocol: CAP/1.0
Name: Harbor
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.
Chat: https://example.com/chat
CAP: https://dapi.cosmicjs.com/cap/v1/ck_your_key
Spec: https://conciergeprotocol.org/cap.txt

```
`Name` is the agent's name. `Ask` tells a visiting agent that does not know CAP that your agent answers questions, and how to ask it. It is the same sentence on every door, so copy it exactly. `Chat` is optional: the page where a person talks to the same agent. Leave it blank and the line is omitted. `CAP` is the address Cosmic hosts. Visiting agents call that address. People use `Chat`. `Spec` points at the protocol, which is not Cosmic-specific.

A `GET` on the `CAP` address, or on its `/messages` path, returns a short plain-text explanation of how to ask, so an agent that opens the address before posting to it learns what to send.

An agent that can only open URLs can ask a public question with a `GET` on `/messages?from=agent:{id}&message=...`, and read a slow reply at the `Location` URL it gets back. A `GET` never carries a login, and the same question from the same agent within a minute is asked once.

## What it answers

The reply comes from published content in the attached bucket, plus the prompt and capabilities you set on the agent. Drafts are not answers. Turn the door on after the catalog, docs, or policies you want quoted are published. An empty bucket produces a weak answer. Tell the agent in its prompt to say an item is not available when nothing published matches, rather than offering the closest thing it found.

You configure two things:

- **Knowledge.** Published objects, and the prompt that tells the agent how to use them.
- **Actions.** The capabilities you enable on that agent. CAP does not add a separate tool list.

Recent visitor threads are listed on the same **Other agents** panel.

## Account questions

A public question needs no login. When the question is about one person's own records, CAP can ask that person to approve access. They sign in on your site. The password stays there. One approval is for that account.

That sign-in is described in the protocol at [conciergeprotocol.org/login](https://conciergeprotocol.org/login). On cosmicjs.com it is a Cosmic account. A customer door does not gain your shoppers' accounts by turning CAP on. Public answers from published content are what Active turns on.

To have your [website widget](/docs/dashboard/ai/website-widget#visitor-accounts) answer logged-in shoppers, your site runs its own CAP login and lists a few account endpoints. The agent calls those with the shopper's login and never stores it.

## Your own door

A store can also serve `/cap/v1` on its own domain, run the CAP login there, and pass each message to this agent. Visiting agents then sign in with your store and get answers about their own cart or orders.

1. List your [account endpoints](/docs/dashboard/ai/website-widget#account-endpoints) on the agent. The Log in button can stay off.

2. On your door, check the caller's `Authorization` token and that its `CAP-From` matches the agent it was issued to. Return `401` or `403` yourself when it does not.
3. Forward the message to the agent's door URL with the caller's `CAP-Version` and `CAP-From` headers, and put the token in `X-Site-Token`. Do not forward `Authorization`.

The agent sends that token only to your account endpoints, with the caller's `CAP-From`, and keeps it for that one answer. Without a token, a question about the caller's own account comes back as `login_required`. Product questions stay public.

## Limits

Each door has a daily token cap. The default is 500,000 tokens. You can set it from 1,000 to 20,000,000. The panel shows tokens used today. When the cap is reached, the agent stops taking messages until the next day.

CAP and the [MCP server](/docs/mcp-server) do different jobs. MCP is how your
own coding agent reads and writes the bucket. CAP is how someone else's agent
asks your concierge a question.

## FAQ

### How much does Cosmic cost?

Project plans are Free ($0), Builder ($99/mo), Team ($299/mo), Business ($499/mo), Enterprise (custom pricing). Yearly billing saves 10%. Workspace plans are Small Workspace ($999/mo) and Large Workspace ($2,999/mo), and they start with a 30-day free trial. Allowances, add-on rates, and the rest of the pricing FAQ are plain text at https://www.cosmicjs.com/pricing.md.

### Are API keys required, and is content private?

Each Bucket has a read key and a write key in Bucket Settings > API Access. GET requests use the read key. POST, PATCH, and DELETE use the write key as Authorization: Bearer. Do not put the write key in a browser bundle, a mobile app, or a NEXT_PUBLIC_ variable. SAML single sign-on is on Large Workspace and Enterprise. The audit log is append-only. Text versions: https://www.cosmicjs.com/security.md and https://www.cosmicjs.com/docs/dashboard/audit-log.md.

### Can an agent create a Cosmic project without an existing account?

Yes. POST https://dapi.cosmicjs.com/v3/agents/sign-up provisions a free-tier project and bucket tied to a human email, with no existing Cosmic account. The human claims it with the emailed one-time code. The playbook is https://www.cosmicjs.com/docs/ai-onboarding.md.
