Concierge Agent Protocol 1.0 Draft How a visiting agent calls the CAP URL from agent.txt. Full spec: https://conciergeprotocol.org/spec Find the file GET https://{domain}/agent.txt The first line is Protocol: CAP/1.0. Use the file only if it has a CAP line. A redirect from /agent.txt may go to any https URL. The domain is vouching for that target. If /agent.txt is missing, an HTML page, or has no CAP line, read the homepage. Follow Link: ; rel="agent", or in the head. Fetch that URL once. Do not follow a pointer from it. If /agent.txt is a valid door, ignore the homepage. The door belongs to the domain you asked, not the host that served the file. Every request CAP-Version: 1.0 CAP-From: agent:{your-agent-id} Send a message POST {CAP}/messages Content-Type: application/json { "message": "Black running shoes in size 12", "context": { "style": "minimal, all black" } } context is optional. It is a short brief, not a profile and not the company's API payload. 200 means the answer is ready. Use reply only when status is done. 202 means it is still working. The response sets Retry-After and Location. Wait Retry-After seconds, then: GET {CAP}/messages/{id} Keep reading until status is done or failed. Tell the person the company is still answering. Do not invent a reply while status is working. Follow up POST {CAP}/messages { "message": "Something cheaper?", "previous_message_id": "msg_..." } Send only the new message. The company already has the earlier turns. Keep the newest id for the next follow-up. Leave previous_message_id off to start a new conversation. Account questions If agent.txt has an OAuth line, send Authorization: Bearer with the token the person granted. Without a token, an account question comes back with status failed and error.code login_required. Ask the person to log in, then send the message again. Log in Use HTTP only. There is no registration and no secret. 1. Read the metadata. For OAuth: https://{domain}/oauth, that is GET https://{domain}/.well-known/oauth-authorization-server/oauth 2. Start a login at its device_authorization_endpoint: POST {device_authorization_endpoint} Content-Type: application/x-www-form-urlencoded client_id=agent:{your-agent-id}&client_name={a name the person will recognize} Logins read by default. If the person wants changes made, such as creating or editing content, add &scope=write when the metadata's scopes_supported lists write. The person may still allow read only. If the reply says this login cannot make changes, log in again with scope=write. The response has device_code, user_code, verification_uri_complete, expires_in, and interval. 3. Tell the person: "Open {verification_uri_complete} and allow access if the page shows the code {user_code}." Never show them device_code. 4. Keep your turn open and poll in the foreground, so you can continue as soon as the person allows access. Every interval seconds, ask for the token: POST {token_endpoint} Content-Type: application/x-www-form-urlencoded grant_type=urn:ietf:params:oauth:grant-type:device_code&device_code={device_code}&client_id=agent:{your-agent-id} 400 authorization_pending: the person has not decided. Keep waiting. 400 slow_down: add 5 seconds to the interval. 400 access_denied or expired_token: stop. Tell the person. 200: access_token, refresh_token, and scope (what the person granted: read, or read write). Send the message again with Authorization: Bearer {access_token} and the same CAP-From. If you cannot keep polling, ask the person to tell you once they have allowed access, then ask for the token once. Confirm an action Some changes, such as deletes, wait for the person. Then the done message also has confirmation, with id, url, and summary. Give the person the url and summary, and say it happens once they approve. Never say it is done yet. Then read: GET {CAP}/confirmations/{id} with the same headers and token, waiting Retry-After between reads. status pending: keep waiting. done: tell the person it is done. denied or expired: tell the person nothing changed. failed: tell the person it did not go through, with result.message if set. The token works only with that CAP-From. When it expires, you get 401. Renew at the token_endpoint with grant_type=refresh_token&refresh_token={refresh_token}&client_id=agent:{your-agent-id}. The refresh token rotates. Never ask the person for their password. What to do with errors 400: the request or CAP-Version is wrong. Fix it and send again. 401: the token is invalid, expired, or revoked. 403: the token was issued to a different agent than CAP-From. 404: the message is missing, expired, or not yours. For a follow-up, start a new conversation. 409: the previous message is still working, or the thread is too long. Wait, or start a new conversation. 429 and 503: wait for Retry-After, then try again. failed: final for that message.