Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
<img src="logo/dark.svg" width="200" alt="agentsfleet" />
</picture>

**Documentation for agentsfleet.**
# Documentation for agentsfleet

`agentsfleet` runs fleets that respond to webhooks, schedules, and messages.
You review each fleet's tools, access, and spending limits before saving it.
Use these docs to create fleets, inspect runs in the activity stream, and manage your workspace.
A fleet is a personal agent with an ongoing job. It can run when you send a message, on a schedule, or when a connected app sends an event.

[Create your first fleet](https://docs.agentsfleet.net/quickstart) or [send work through the API](https://docs.agentsfleet.net/api-reference/introduction).
In the dashboard, [review tool access](https://docs.agentsfleet.net/fleets/approvals) in the fleet's conversation and [see spending by fleet](https://docs.agentsfleet.net/billing/budgets) under **Usage**.

<img src="images/guffy.webp" alt="An ivory and mint folded bird leads a flock of smaller paper birds." width="540" />

Meet Guffy, the agentsfleet paper bird.

[![Docs](https://img.shields.io/badge/agentsfleet-Docs-B8F0CE?style=for-the-badge)](https://docs.agentsfleet.net)
[![Get early access](https://img.shields.io/badge/agentsfleet-Get_early_access-B8F0CE?style=for-the-badge)](https://accounts.agentsfleet.net/waitlist)
Expand All @@ -20,6 +25,13 @@ Use these docs to create fleets, inspect runs in the activity stream, and manage

---

## Read the docs with an agent

Open the [Markdown index](https://docs.agentsfleet.net/llms.txt) to find a guide by title and read that page on its own.
The [full Markdown guide](https://docs.agentsfleet.net/llms-full.txt) includes the guides and API reference in one file.

If your client cannot open those links, use the [public navigation file](https://raw.githubusercontent.com/agentsfleet/docs/main/docs.json). Its guide paths correspond to `.mdx` files in [the docs repository](https://github.com/agentsfleet/docs). The API tab links to the OpenAPI file.

## Development

Before editing, read `AGENTS.md`, `.orly/standards/docs.md` and `.orly/standards/docs-pages.md`. For changelog edits, also read `.orly/standards/changelog.md`.
Expand Down
109 changes: 70 additions & 39 deletions api-reference/error-codes.mdx

Large diffs are not rendered by default.

80 changes: 57 additions & 23 deletions api-reference/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: API introduction
description: Base URL, authentication, errors, and common response formats.
description: Connect to a workspace, send a fleet a job, and read its reply.
type: explanation
audience: user
verified: 2026-11-25
product_version: 0.90.0
verified: 2026-12-03
product_version: 0.95.0
executable: false
---

Expand All @@ -16,37 +16,34 @@ The OpenAPI file lists the available routes, inputs, responses, and status codes

## Why it exists

Use the API when a script or service needs direct access. Use the command-line client for interactive terminal work.
A script or another agent can hand work to a fleet that already has the right instructions and tools. Your software can come back for the reply.

## How it behaves

### Authenticate

Most paths accept a bearer token in the `Authorization` header. Tenant API keys start with `agt_t` and are shown once when created.
For a script or another agent, open **Account menu → Security → Create API key** in the dashboard.
Save the full `agt_t` key when it appears. Later, the list shows only a four-character suffix when one is available.

Manage keys and active sessions on the dashboard's **Security** page.
Send the key as `Authorization: Bearer <API_KEY>`. An account key uses the permissions of the person who created it.
`GET /v1/users/me` returns the caller's identity, account, credential type, and scopes.

Key lists show a recorded four-character suffix for recognition; older keys can have no recorded suffix.
The suffix cannot authenticate a request, and the original key cannot be recovered from it.
For interactive use, `agentsfleet login` saves a personal command-line credential starting with `afc_`. Signing in to the same server with the same account and machine name replaces the old credential.

Interactive users sign in with `agentsfleet login`. Login saves a durable command-line credential that starts with `afc_`. The credential resolves to the person who signed in.

`GET /v1/users/me` returns your identity, tenant, credential type, and scopes.
It requires authentication but no particular scope. Use it to check whether a credential still works.

The credential stays valid until a logout, a newer login from the same computer, or a dashboard revoke ends it.
`agentsfleet logout` asks the server to revoke the credential and clears the local copy. If the server cannot revoke it, [follow the sign-out recovery steps](/cli/agentsfleet#account-and-diagnosis). If you know the credential's identifier, you can also revoke it with your personal session using `DELETE /v1/cli-credentials/{id}`.

Browser session tokens use the identity provider’s published signing keys. Keys refresh after six hours. If the provider is unavailable, previously confirmed keys remain usable for at most fifteen more minutes.

After that ceiling, session verification returns HTTP `503` with `UZ-AUTH-004` until a refresh succeeds. Token expiry still applies throughout.
If the signing keys are still unavailable after those fifteen minutes, session verification returns HTTP `503` with `UZ-AUTH-004`. An expired token stays invalid.

Webhook and connector paths use provider signatures instead of bearer tokens. The OpenAPI security section on each operation states the required method.
Incoming webhooks use the sender's signature. To set up a connected app, use the authentication method in that endpoint's reference.

### List fleets

To list fleets, copy `<WORKSPACE_ID>` from `agentsfleet workspace list`.
Replace `<API_KEY>` with a key that has `fleet:read` access to that workspace.
Create keys under **Settings → Security → Create API key** in the dashboard.
Use the workspace identifier your account owner gives you for `<WORKSPACE_ID>`.
With `workspace:admin`, call `GET /v1/tenants/me/workspaces` and copy the workspace's `id` from `items`.

Replace `<API_KEY>` with the key you saved. Its owner needs access to the workspace and the `fleet:read` scope.

```bash
curl "https://api.agentsfleet.net/v1/workspaces/<WORKSPACE_ID>/fleets" -H "Authorization: Bearer <API_KEY>"
Expand All @@ -56,15 +53,37 @@ curl "https://api.agentsfleet.net/v1/workspaces/<WORKSPACE_ID>/fleets" -H "Autho
<varies>
```

Read fleets from `items`. When `next_cursor` has a value, use it to fetch the next page.
Read the fleet's `id` from `items`. If `next_cursor` has a value, pass it unchanged as `starting_after` to read the next page.

### Send a job and read the reply

<Frame>
<img src="/images/dispatch.webp" alt="" width="144" height="144" />
</Frame>

Use the same workspace and fleet identifiers for the message and the reply.

1. Send `POST /v1/workspaces/{workspace_id}/fleets/{fleet_id}/messages` with the bearer key and `Content-Type: application/json`. Sending needs `fleet:write`.
2. Put the job in the JSON string `message`. Include a unique string as `operation_id` if you might retry.
3. Save the `turn_id` from HTTP `202`. This means the API accepted the message. The reply comes later.
4. Read `GET /v1/workspaces/{workspace_id}/fleets/{fleet_id}/messages` with `fleet:read`. Match the turn by its `turn_id` and read `response_text`.

If `response_text` is null, check `status` and `failure_label`. To follow one turn directly, use `GET /v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}`.

To retry a message, use the same sender, request body, and `operation_id`. Omitting `operation_id` sends a new message on each attempt.

For a new fleet, send `POST /v1/workspaces/{workspace_id}/fleets` with the first `message` and a unique version 7 universally unique identifier (UUID) as `operation_id`.
Save `fleet.id` and `accepted.turn_id`. Retrying the same create request returns the original fleet while it exists.

A different request body with the same key returns [HTTP `409`](/api-reference/error-codes#UZ-FLEET-004). If someone deleted the fleet, the API returns [HTTP `410`](/api-reference/error-codes#UZ-FLEET-006). Use a new key only when you want to create a new fleet.

### Read an error

Errors use the HTTP problem details format. Each product error includes an `error_code`, a `request_id`, and a documentation URL.

### Identifiers and timestamps

Identifiers use version 7 Universally Unique Identifiers (UUIDs).
agentsfleet assigns UUIDs to its resources. Use the identifiers returned by the API.

Timestamps are Request for Comments (RFC) 3339 strings in Coordinated Universal Time (UTC), such as `2026-10-17T18:06:49.123Z`. A whole second has no fraction, as in `2026-10-17T18:06:49Z`. Compare timestamps after parsing them, because text order is not time order.

Expand All @@ -75,7 +94,9 @@ Schedule expressions retain their declared timezone.

### Money amounts

Money amounts are whole nanodollars, written as decimal strings. One United States (US) dollar is `"1000000000"`. Every field whose name contains `_nanos` uses this form, including balances, charges, event costs, and model rates.
Balances, charges, turn costs, and model rates use whole nanodollars, written as decimal strings. One United States dollar is `"1000000000"`.

A durable task's `running_nanos` measures elapsed time in nanoseconds. Its `model_nanos` measures model spending in nanodollars.

Except for the balance below, a nanodollar string holds digits only, with no sign, no leading zero, and no decimal point.
It matches `^(0|[1-9][0-9]*)$` and never exceeds `"9223372036854775807"`.
Expand All @@ -91,10 +112,23 @@ The request line and headers can use up to 16 KiB. The server refuses larger hea

Clients may receive HTTP `431` or a closed connection. Reduce credentials, cookies, or forwarding headers before retrying.

Rate limits apply per workspace. A limited request includes `Retry-After`; wait for that delay before retrying.
An API instance at its concurrent request limit returns HTTP `429` with `UZ-API-001`. Wait for the delay in `Retry-After` before retrying.

Streaming activity uses Server-Sent Events (SSE). A stream can return `UZ-API-002` when the service cannot accept another subscriber.

### Query parameters for runner task reads

Runner clients use their runner credential for these five `GET` operations under `/v1/runners/me/runs/{run_id}/durable_tasks`.
Put the listed fields in the URL query string. The `fencing_token` comes from the runner's current assignment.

| Path suffix | Required query fields | Optional query fields |
|---|---|---|
| `/inputs` | `fencing_token` | `starting_after`, `after_input_sequence`, `limit` |
| `/effects` | `fencing_token`, `durable_task_id` | `ordinal_after`, `starting_after`, `limit` |
| `/effects/{effect_id}` | `fencing_token` | None |
| `/checkpoints/{checkpoint_id}/objects` | `fencing_token`, `pin_id` | `starting_after` |
| `/checkpoints/{checkpoint_id}/pages/{page_id}` | `fencing_token`, `pin_id` | None needed |

## Related pages

- [OpenAPI 3.1 file](https://raw.githubusercontent.com/agentsfleet/agentsfleet/main/public/openapi.json)
Expand Down
54 changes: 41 additions & 13 deletions api-reference/scopes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,87 @@ title: API scopes
description: Permissions that an agentsfleet access token can carry.
type: reference
audience: user
verified: 2026-11-25
product_version: 0.90.0
verified: 2026-12-03
product_version: 0.95.0
executable: false
---

## Synopsis

Each access token carries named scopes. An API request fails when the token lacks the required scope.
Scopes name the actions your credential can take. An account API key uses its creator's permissions.
Read `scopes` from `GET /v1/users/me` to check your current permissions.

Some scope groups use `read`, `write`, and `admin` levels. A higher level includes every lower level in the same group.
A scope applies only where you have account or workspace access. The table shows which scopes include others.

## Example with output

Copy `<WORKSPACE_ID>` from `agentsfleet workspace list`. Replace the fake token with a tenant API key from **Settings → Security**.
Replace `<WORKSPACE_ID>` with the identifier from your account owner.
With `workspace:admin`, you can also read it from `items[].id` in `GET /v1/tenants/me/workspaces`.
Replace `<API_KEY>` with an account key from **Account menu → Security → Create API key**.

```bash
curl -s 'https://api.agentsfleet.net/v1/workspaces/<WORKSPACE_ID>/fleets' -H 'Authorization: Bearer af_test_00000000'
curl -s 'https://api.agentsfleet.net/v1/workspaces/<WORKSPACE_ID>/fleets' -H 'Authorization: Bearer <API_KEY>'
```

```text
<varies>
```

A valid key without `fleet:read` returns this scope error. The fake token above fails authentication instead.
A key with `fleet:read` returns the list in `items`. Without that scope, the API returns HTTP `403`. The `detail` field names the required scope.

```text
{"title":"Insufficient scope","error_code":"UZ-AUTH-022","detail":"Missing required scope: fleet:read"}
{"title":"Insufficient scope","error_code":"UZ-AUTH-022","detail":"Requires scope fleet:read"}
```

## Options

### Account and workspace scopes

| Scope | Effect | Included by |
|---|---|---|
| `fleet:read` | Reads fleets, turns, memory, and triggers. | `fleet:write`, `fleet:admin` |
| `fleet:write` | Creates and updates fleets, sends messages, and removes fleet triggers. | `fleet:admin` |
| `fleet:admin` | Deletes fleets. | None |
| `schedule:read` | Reads a fleet's hosted schedules. | `schedule:write` |
| `schedule:write` | Creates, changes, deletes, or syncs a hosted schedule. | None |
| `secret:read` | Lists secret names and metadata. | `secret:write` |
| `secret:write` | Creates, rotates, and deletes secrets. Deleting a secret named for a connector also needs `connector:write`. | None |
| `apikey:read` | Lists tenant API keys. | `apikey:write`, `apikey:admin` |
| `apikey:write` | Creates and rotates tenant API keys. | `apikey:admin` |
| `apikey:admin` | Revokes tenant API keys. | None |
| `apikey:write` | Creates an account API key or revokes an active one. | `apikey:admin` |
| `apikey:admin` | Deletes an already revoked account API key. | None |
| `grant:read` | Lists integration grants. | `grant:write` |
| `grant:write` | Revokes integration grants. | None |
| `connector:read` | Reads connector state. | `connector:write` |
| `connector:write` | Starts a connector setup flow and disconnects a connector, including by deleting its secret. | None |
| `billing:read` | Reads the tenant balance and charges. | None |
| `workspace:admin` | Creates and lists workspaces. | None |
| `workspace:admin` | Lists and creates workspaces. Owners also use it to manage account invites and members. | None |
| `approval:read` | Reads pending approvals. | `approval:resolve` |
| `approval:resolve` | Approves or denies a request. | None |
| `runner:tenant` | Registers and manages runners for the account's own work. A platform administrator grants this scope separately. | None |

To approve or deny a request, sign in through the dashboard or your personal command-line client with `approval:resolve`.
Revoking a fleet's integration grant also requires a personal sign-in and `grant:write`.

Only account owners can write workspace secrets or connect apps, even when a member holds the corresponding scope.

List pending requests with `approval:read`. Approving or denying also needs a person's signed-in session and `approval:resolve`.
### Platform operator and runner scopes

Operator tokens may carry `runner:*`, `platform-key:*`, `model:*`, or `workspace:any`. Tenant integrations do not need these scopes.
These scopes govern the shared platform or identify a runner. Runner registration and runner management are separate permissions.

| Scope | Effect | Included by |
|---|---|---|
| `model:read` | Reads the platform's model catalog through the administrator API. | `model:admin` |
| `model:admin` | Adds, changes, and removes models in the platform catalog. | None |
| `platform-key:read` | Reads the platform's default provider and model settings. | `platform-key:admin` |
| `platform-key:admin` | Sets or removes the platform's default model credentials. Also authorizes workspace checkpoint key rotation. | None |
| `runner:read` | Lists platform runners and reads their state, history, and runs. | `runner:write` |
| `runner:write` | Changes an existing platform runner and can retire a revoked runner. | None |
| `runner:register` | Registers a new platform runner and creates its first credential. | None |
| `runner:self` | Allows a runner credential to use the runner API for its own work. | None |
| `stream:read` | Reserved for platform stream diagnostics. No current route requires it. | None |
| `workspace:any` | Allows an operator to cross account ownership boundaries. The operation's other scopes still apply. | None |

The `agt_r` credential issued to a runner carries only `runner:self`. See [Install a runner](/runners/install).

## Errors

Expand Down
Loading
Loading