HTTP API conventions
The Agents API serves two main listeners. People reach the people socket, through nginx on gomoe.dev and through tailscale serve on a server in Tailscale mode. Machines, boxes and agent sessions reach the machine port with an instance token. Each route belongs to one listener, and the pages after this one list the routes by area.
| Page | Routes |
|---|---|
| Conversations, files and voice | People socket |
| Agents, keys, approvals and connectors | People socket |
| Tasks, projects, documents and pipelines | People socket |
| Team, access, boxes and history | People socket |
| Machine port | Machine port |
| Shapes, streams, git and WebSockets | Both |
Listeners
Section titled “Listeners”| Listener | Where it listens | Who calls it |
|---|---|---|
| People | A Unix socket at the path in AGENTS_PEOPLE_SOCKET. On gomoe.dev nginx sends every path but /machine/ to it. On a server in Tailscale mode tailscale serve is pointed at it. |
The app and people |
| Machines | TCP port AGENTS_API_PORT (7700 by default) on each address in AGENTS_MACHINE_HOST (127.0.0.1 by default) |
Daemons, boxes and agent sessions |
| Laptops | A Unix socket at AGENTS_LAPTOP_SOCKET, when the laptop door is set up. On gomoe.dev nginx sends /machine/ to it with the prefix taken off, so a Mac reaches it at https://gomoe.dev/machine. |
A person’s own Mac, with its machine token |
| Views | A Unix socket at AGENTS_FRAME_SOCKET, when connector views are set up |
A browser frame, for GET /f/<ticket> |
The API also serves the built app from app/dist on the people socket. A GET outside /v1/ returns the file at that path, or index.html when there is none.
Who is calling
Section titled “Who is calling”AGENTS_AUTHsets how a person is known. gomoe.dev runsnative. Instances and checks runtailscale, the default, unless started with native sign-in, and a stand-in fortailscale servethere passes people’s requests, with the Tailscale headers the caller sets, to the socket.- With
native, a person is known by the session cookie of native sign-in,__Host-agents_session, and their login is the account’s email. A request with no session answers401withsign in first, and one whose second factor has not passed answers401withfinish signing in with your second factor. A request that carries any header starting withtailscale-, other than aGETfor a built file under/assets/, answers400withthis server signs people in itself, and takes no Tailscale identity. A tool may sendAuthorization: Bearer agt_<token>with an API token from Settings > API tokens in place of the cookie. The token acts as its maker on its one team. - With
tailscale, a person is known by theTailscale-User-Loginheader thattailscale servesets. TheTailscale-User-Nameheader gives the display name, cut to 200 characters. - In either mode the login must belong to a person on a team. Otherwise the route answers
403with<login> is not on a team.GET /v1/meandPOST /v1/me/joinaccept a login on no team. Withnative, the sign-in routes and the routes that make and join teams accept one too. - A machine sends
Authorization: Bearer <instance token>. The API compares the token’s SHA-256 hash with the one stored for each instance. A request with no token answers401withmissing instance token, and an unknown token answers401withunknown instance token. - The machine port refuses any request that carries a header starting with
tailscale-. It answers400withpeople connect through Tailscale, not the machine port. It also refuses a session cookie, with400andpeople sign in on the people port, not the machine port. - The laptop door takes only a Mac’s machine token. A computer’s token answers
403withonly a person's own Mac connects from outside the server's network. The door does not serve the model gateway, a connector’s gateway or webhooks. - A route that is registered on the other listener answers
404withno such route. - A route marked admin answers
403to a member.
Requests
Section titled “Requests”- A request that changes something on the people socket must have the content type
application/json. Any other type answers415witha change must be sent as JSON. The exceptions arePOST /v1/transcribe, which takes an audio type, and an upload to an attachments route, which takes theX-File-Nameheader. - A body is one JSON object of at most 20 MiB. A larger body answers
413withbody too large. A body that is not JSON answers400withbody must be JSON, and JSON that is not an object answers400withbody must be a JSON object. A body that does not fit the route’s schema answers400with what is wrong. - A path segment written
<id>is a lowercase UUID. An event number, a version number, an attempt number and a seat number are integers. On a server in Tailscale mode, a Tailscale user, device or invite id is letters and digits.
Answers
Section titled “Answers”- A route answers
200with a JSON body. Only the routes the pages mark answer201, and other routes that make something, such asPOST /v1/agentsandPOST /v1/conversations, answer200. - A failure answers its status with
{"error": "<message>"}. An error the API did not expect answers500withinternal error. GET /v1/connectors/callback/<key>answers302. A file route answers the file’s bytes with its own headers, and an export answersapplication/x-ndjson.- A History route answers
404withno such sessionfor a session the person may not see, the same as for one that does not exist.
Agent routes
Section titled “Agent routes”The routes under /v1/record and /v1/team-agents, and the connector gateway, are for an agent inside a session. They need ?session=<session id>, and that session must be running on the calling machine. Otherwise they answer 403 with record reads need a session running on this machine. A session that is a replay reads nothing from the team record and answers 403.