The cloud agents programmatic interface is easier to read by resource groups: durable agents, their runs, artifacts and usage accounting, lifecycle management, worker tokens, self-hosted workers and service endpoints for discovering capabilities. That grouping reflects how an integration is built in practice - from creation to cleanup - and it also explains the shape of the addresses: an agent exists for a long time, a run lives inside an agent, and everything else belongs to one of the two.
The current version is in open beta while the previous one still serves event notifications. That is a transitional state, and it is taken into account explicitly in the architecture: a layer translating external messages into your data model is worth writing straight away. The price of that layer is one file and one type; the price of its absence is rewritten business logic on the day the previous version stops serving notifications.
It helps to lay the endpoints out in a table by group once. It is given below: creating and listing agents, working with runs, the event stream and cancellation, artifacts and usage, archiving and deletion, tokens, workers and discovery. You come back to this map when designing: it shows what is available and hints at what an integration usually lacks.
| Group | Endpoints | Purpose |
|---|---|---|
| Agents | POST /v1/agents, GET /v1/agents, GET /v1/agents/{id} | Creation with the first run, listing, metadata |
| Runs | POST and GET /v1/agents/{id}/runs, GET .../runs/{runId} | Continuing work and the state of a specific run |
| Stream and cancel | GET .../runs/{runId}/stream, POST .../runs/{runId}/cancel | Events as work proceeds and stopping an active run |
| Artifacts and usage | GET .../artifacts, GET .../artifacts/download, GET .../usage | Work results and the billed cost |
| Lifecycle | POST .../archive, POST .../unarchive, DELETE /v1/agents/{id} | Cleanup: archiving, restoring and deletion |
| Tokens | POST /v1/sub-tokens | A one-hour user-scoped token for a self-hosted worker |
| Self-hosted workers |
|---|
| GET /v0/private-workers and related endpoints |
| Fleet state and the queue of pending requests |
| Discovery | GET /v1/me, GET /v1/models, GET /v1/repositories | Key information, available models, connected repositories |
|---|
A real integration falls into a recognizable sequence. Create an agent together with its first run, subscribe to the event stream, show the user what is happening, collect the artifacts, clean up after yourself. There is a subtlety here that people trip over: an event stream is a connection, and connections break. An event that arrived over the stream is a hint rather than a ledger entry; the source of truth about a run's state is the endpoint that returns that state. So the stream always has a fallback path: reconnecting and polling the state rather than an interface silently hanging.
Three things are lacking most often in an integration. Cancellation - without it a long run cannot be stopped programmatically, and waiting remains the only option. Usage accounting - without it cost becomes clear at the end of the month, when influencing it is too late. And cleanup: archiving, restoring and deletion exist for a reason, otherwise durable agents accumulate the way branches accumulate in an old repository, and six months later nobody can say which of them are still needed.
The token endpoint stands apart. It mints a one-hour user-scoped token so that a self-hosted worker runs as an active member of the team; minting it requires an agent-scoped key of a team service account, and the token neither refreshes itself nor mints further tokens. The rule is the same as in any permission system: grant as much as the specific work requires and for the duration of that work.
The key information endpoint is worth remembering separately: it answers what the key is - its name, creation date and owner - and the presence of owner fields shows whether it is a user key or a service account key. That is cheap diagnostics for the case where an integration is refused and it is unclear which key it is even using. The model list has the same purpose: it answers what is available to your account now rather than what was available on the day the code was written, which is why a model name hard-coded into configuration is worth checking against it at startup.
The list of connected repositories stands apart because of its strict rate limit. That is a direct architectural hint: the list is cached. An integration that calls it on every user action is designed wrongly and will hit the limit at the first spike of load - and it will hit it not only for itself but for every consumer of the same key.
The engineering conclusion is simple: before writing an integration it helps to run your eyes over the groups and mark which endpoints you actually need. The set usually turns out small - creation, the event stream, cancellation, artifacts and cleanup. Everything else is added as a need appears rather than in advance: unused integration code ages faster than any other.
The typical failures are predictable. Not implementing cancellation and having no way to stop a run. Treating the event stream as the source of truth and hanging when the connection drops. Ignoring usage accounting. Accumulating agents without archiving or deleting them. Handing a self-hosted worker the full key instead of a one-hour user-scoped token. And fetching the repository list without a cache.