Skip to content

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
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.

  • AGENTS_AUTH sets how a person is known. gomoe.dev runs native. Instances and checks run tailscale, the default, unless started with native sign-in, and a stand-in for tailscale serve there 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 answers 401 with sign in first, and one whose second factor has not passed answers 401 with finish signing in with your second factor. A request that carries any header starting with tailscale-, other than a GET for a built file under /assets/, answers 400 with this server signs people in itself, and takes no Tailscale identity. A tool may send Authorization: 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 the Tailscale-User-Login header that tailscale serve sets. The Tailscale-User-Name header 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 403 with <login> is not on a team. GET /v1/me and POST /v1/me/join accept a login on no team. With native, 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 answers 401 with missing instance token, and an unknown token answers 401 with unknown instance token.
  • The machine port refuses any request that carries a header starting with tailscale-. It answers 400 with people connect through Tailscale, not the machine port. It also refuses a session cookie, with 400 and people 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 403 with only 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 404 with no such route.
  • A route marked admin answers 403 to a member.
  • A request that changes something on the people socket must have the content type application/json. Any other type answers 415 with a change must be sent as JSON. The exceptions are POST /v1/transcribe, which takes an audio type, and an upload to an attachments route, which takes the X-File-Name header.
  • A body is one JSON object of at most 20 MiB. A larger body answers 413 with body too large. A body that is not JSON answers 400 with body must be JSON, and JSON that is not an object answers 400 with body must be a JSON object. A body that does not fit the route’s schema answers 400 with 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.
  • A route answers 200 with a JSON body. Only the routes the pages mark answer 201, and other routes that make something, such as POST /v1/agents and POST /v1/conversations, answer 200.
  • A failure answers its status with {"error": "<message>"}. An error the API did not expect answers 500 with internal error.
  • GET /v1/connectors/callback/<key> answers 302. A file route answers the file’s bytes with its own headers, and an export answers application/x-ndjson.
  • A History route answers 404 with no such session for a session the person may not see, the same as for one that does not exist.

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.