> ## Documentation Index
> Fetch the complete documentation index at: https://vetta.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents

> Create, version, run, and inspect reusable agent configurations.

An **agent** is a reusable, versioned configuration: a model, a system prompt, a set of tools and skills, a completion window, and a budget. Sessions and deployments run against an agent. Every update is captured as an immutable [agent version](#the-agent-version-object) with optimistic concurrency.

## The agent object

**id** `string`

Unique id (e.g. `agt_01H...`).

**object** `string`

Always `agent`.

**name** `string`

Human-readable name.

**harness** `string`

The [harness](https://vetta.sh/docs/how-managed-agents-is-built.md#the-three-layers) — the agent loop. [`GET /v1/harnesses`](https://vetta.sh/docs/api/harnesses) publishes the set, what each one can be admitted for, and whether it holds a sandbox between turns.

**model** `string`

Model identifier, e.g. `z-ai/glm-5.3-flash`. See [the model router](https://vetta.sh/docs/concepts/model-router.md).

**model\_selection** `object | null`

Optional per-turn model choice: `{ "options": { "<model id>": "<what it is for>", … }, "min_confidence"?: number }`. When set, every turn of every session picks one of the options over the transcript so far and `model` is the default; `null` (the default) pins `model`. See [model auto-selection](https://vetta.sh/docs/concepts/model-selection.md#select-during-a-call).

**window** `string`

Default [completion window](https://vetta.sh/docs/concepts/completion-window.md): `immediate | priority | loose`.

**system** `string`

System prompt.

**tools** `object`

The toolset configuration. See [Tools](https://vetta.sh/docs/capabilities/tools.md).

**tools**

**default\_config** `object`

Default `{ permission }` applied to every tool unless overridden. `permission` ∈ `allow` (run silently) · `ask` (pause → `tool.confirm`[event](https://vetta.sh/docs/api/events.md)) · `deny` (tool is not offered to the model at all).

**configs** `object`

Per-tool overrides keyed by tool name — a [built-in](https://vetta.sh/docs/capabilities/tools.md#built-in-tools) (`bash`, `browser`, `web_search`, `generate_image`, …) or a namespaced `<server>.<tool>`. Each entry is `{ enabled, permission, config? }`; `enabled` defaults to `true` when a write leaves it out.

**mcp\_servers** `object[]`

Attached MCP servers the agent may call.

**skills** `string[]`

Attached [skill](https://vetta.sh/docs/api/skills.md) references. Each entry is a slug or id, optionally suffixed `@version` to pin an immutable version (e.g. `refund-policy@3`). An unpinned reference resolves to the skill's latest version at session start.

**multiagent** `object | boolean | null`

The team this agent coordinates: a `{ "type": "coordinator", "agents": [ … ], "board"?: boolean }` object, or `false`/`null` when it coordinates none. See [Coordinator](https://vetta.sh/docs/team/coordinator.md#the-multiagent-field).

**handoffs** `boolean | "team" | string[]`

Who the agent may send work to with `send_to_agent`: `true` (any agent in the organization but itself — the default, and what every agent created before this field reads as), `false` (nobody; the agent is offered neither `send_to_agent` nor `list_agents`), `"team"` (the agents on its `multiagent` roster), or a list of agent names. See [Tools](https://vetta.sh/docs/capabilities/tools.md#handoffs).

**budget** `object`

Required spend controls.

**budget**

**cap\_micro\_usd** `integer`

Ceiling for the period, in micro-USD.

**max\_task\_micro\_usd** `integer`

Ceiling for a single session/task, in micro-USD.

**period** `string`

Reset window: `day | week | month`.

**notifications** `object`

Email preferences: `{ email, approvals, questions, updates }`. Each toggle is independent. `updates` fires when a run finishes a turn; approval and question messages deep-link to the paused session. On a team, a member's approvals and questions are mailed from its coordinator's settings and link the coordinator's session, where they are answered; a member's own session sends nothing. All fields default off.

**output\_schema** `object | null`

Optional JSON Schema the agent's final result must satisfy. Sessions inherit it as their default and may override it per run. See [Structured outputs](https://vetta.sh/docs/capabilities/structured-outputs.md).

**structured\_output\_required** `boolean`

Whether a run that cannot produce an object conforming to `output_schema` is a failure rather than a plain-text answer. Sessions inherit it and may override it per run.

**description** `string | null`

Optional longer description.

**metadata** `object`

Arbitrary key/value pairs you attach.

**current\_version** `integer`

Monotonic version counter. Pass this as `expected_version` on update for optimistic concurrency.

**created\_at** `string`

Creation timestamp.

## Create an agent

`POST /v1/agents` → `201 Created`.

**name** `string` *required*

Human-readable name, 1–100 characters.

**model** `string` *required*

Model identifier: any id the [model list](https://vetta.sh/docs/api/models.md) publishes, or `vetta/auto`. Anything else is `validation_failed` naming `model`, on create and on an update that changes it.

**model\_selection** `object`

Per-turn model choice among two to sixteen concrete catalogue ids, each priced for `window`; `model` must be one of them. Defaults to `null`. Refused with `feature_not_configured` (501) on a deployment without an evaluation model, so a saved policy is always one every turn can act on.

**budget** `object` *required*

Spend controls (`cap_micro_usd`, `max_task_micro_usd`, `period`). Agents cannot be created without a budget. `max_task_micro_usd` may not exceed `cap_micro_usd`, and a cap of `0` stands only beside a ceiling of `0` (an agent that spends nothing); either is `validation_failed` naming the field.

**harness** `string`

Defaults to `"pi"`. A harness the deploy cannot run is refused when the session starts, naming the field — see [harnesses](https://vetta.sh/docs/api/harnesses.md).

**window** `string`

Default completion window (`immediate | priority | loose`). Defaults to `immediate`.

**system** `string`

System prompt.

**tools** `object`

Toolset config — a `default_config` plus per-tool `configs`. See [the toolset schema](https://vetta.sh/docs/capabilities/tools.md).

**mcp\_servers** `object[]`

MCP servers to attach.

**skills** `string[]`

Skills to attach. Each entry is a slug/id, optionally `@version` to pin (e.g. `refund-policy@3`).

**multiagent** `object | boolean | null`

Declare a team: `{ "type": "coordinator", "agents": [ … ], "board"?: boolean }` with 1 to 20 roster entries. `false` or `null` declares none; on a `PATCH`, `null` clears a roster. Defaults to `false`. See [Coordinator](https://vetta.sh/docs/team/coordinator.md#the-multiagent-field).

**handoffs** `boolean | "team" | string[]`

Who the agent may send work to: `true` (anyone in the organization), `false` (nobody), `"team"` (its `multiagent` roster — refused with `validation_failed` when the agent has none), or up to 50 agent names. Defaults to `true`.

**notifications** `object`

Optional `{ email, approvals, questions, updates }` settings. An email address is required when any toggle is enabled.

**output\_schema** `object`

JSON Schema the final result must satisfy. Defaults to `null`. See [Structured outputs](https://vetta.sh/docs/capabilities/structured-outputs.md).

**structured\_output\_required** `boolean`

Treat a non-conforming result as a failure rather than answering in prose. Defaults to `false`; needs an `output_schema`.

**description** `string`

Longer description. Defaults to `null`.

**metadata** `object`

Arbitrary metadata.

```bash cURL theme={"system"}
curl -fsSL https://api.vetta.sh/v1/agents \
  -H "authorization: Bearer sk_live_..." \
  -H "content-type: application/json" \
  -H "idempotency-key: $(uuidgen)" \
  -d '{
    "name": "Refunder",
    "model": "z-ai/glm-5.3-flash",
    "window": "immediate",
    "system": "You process refunds.",
    "tools": {
      "default_config": { "permission": "allow" },
      "configs": {
        "browser": { "enabled": true, "permission": "ask", "config": { "allowed_domains": ["*.example.com"] } }
      }
    },
    "skills": ["refund-policy@3"],
    "budget": { "cap_micro_usd": 50000000, "max_task_micro_usd": 5000000, "period": "month" },
    "notifications": { "email": "ops@example.com", "approvals": true, "questions": true, "updates": true }
  }'
```

```json Response theme={"system"}
{
  "id": "agt_01H8XK...",
  "object": "agent",
  "name": "Refunder",
  "harness": "pi",
  "model": "z-ai/glm-5.3-flash",
  "window": "immediate",
  "system": "You process refunds.",
  "tools": {
    "default_config": { "permission": "allow" },
    "configs": {
      "browser": { "enabled": true, "permission": "ask", "config": { "allowed_domains": ["*.example.com"] } }
    }
  },
  "mcp_servers": [],
  "skills": ["refund-policy@3"],
  "multiagent": false,
  "handoffs": true,
  "budget": { "cap_micro_usd": 50000000, "max_task_micro_usd": 5000000, "period": "month" },
  "notifications": { "email": "ops@example.com", "approvals": true, "questions": true, "updates": true },
  "output_schema": null,
  "description": null,
  "metadata": {},
  "current_version": 1,
  "created_at": "2026-08-20T17:00:00Z"
}
```

## Retrieve an agent

`GET /v1/agents/{id}` → `200 OK` with the current configuration, including `current_version`.

```bash theme={"system"}
curl -fsSL https://api.vetta.sh/v1/agents/agt_01H8XK... \
  -H "authorization: Bearer sk_live_..."
```

## List agents

`GET /v1/agents` → `200 OK`, cursor-paginated. See [Pagination](https://vetta.sh/docs/api/pagination.md).

```json Response theme={"system"}
{
  "data": [ { "id": "agt_01H...", "name": "Refunder", "current_version": 3 } ],
  "has_more": false,
  "next_cursor": null
}
```

## Update an agent

`PATCH /v1/agents/{id}` → `200 OK`. Applies a partial update and creates a new immutable version. A no-op update creates no new version.

Updates use **optimistic concurrency**: pass the `expected_version` you read. If it no longer matches `current_version`, the API returns `409` with code `version_conflict` and applies nothing. **Omitting `expected_version`** performs an unconditional, last-write-wins apply — use this for declarative CI that reconciles an `.agent.yaml` toward a desired state.

**expected\_version** `integer`

The `current_version` you last read. Omit for an unconditional apply.

**system** `string`

Any subset of the mutable fields (`name`, `system`, `model`, `model_selection`, `window`, `tools`, `mcp_servers`, `skills`, `multiagent`, `handoffs`, `budget`, `notifications`, `output_schema`, `structured_output_required`, `description`, `metadata`). Renaming is deliberately not a config change: a patch that only sets `name` mints no new version.

```bash theme={"system"}
curl -fsSL -X PATCH https://api.vetta.sh/v1/agents/agt_01H8XK... \
  -H "authorization: Bearer sk_live_..." \
  -H "content-type: application/json" \
  -d '{ "expected_version": 1, "system": "You process refunds. Confirm the order first." }'
```

Returns the full [agent object](#the-agent-object) at its new version:

```json Response theme={"system"}
{ "id": "agt_01H8XK...", "object": "agent", "current_version": 2, "system": "You process refunds. Confirm the order first." }
```

### Version conflict (409)

If another writer advanced the version, you get:

```json 409 Conflict theme={"system"}
{
  "error": {
    "type": "conflict",
    "code": "version_conflict",
    "message": "expected_version 1 does not match current_version 2.",
    "request_id": "req_01H9ZZ...",
    "param": "expected_version"
  }
}
```

Refetch the agent, re-apply your change against the fresh `current_version`, and retry.

## The agent-version object

Each update snapshots the full config into an immutable **agent version**. Versions never change once written.

**version** `integer`

Monotonic version number.

**created\_at** `string`

When this version was created.

**created\_by** `object`

The principal that created the version — `{ "type": "user" | "key" | "system", "id": "..." }`.

**model** `string`

Model identifier at this version.

**model\_selection** `object | null`

Per-turn model choice at this version, or `null`.

**system** `string`

System prompt at this version.

**window** `string`

Completion window at this version.

**tools** `object`

Toolset config at this version.

**mcp\_servers** `object[]`

MCP servers at this version.

**skills** `string[]`

Skill references at this version.

**multiagent** `object | boolean | null`

The `multiagent` coordinator object (or `false`/`null`) at this version.

**handoffs** `boolean | "team" | string[]`

Handoff policy at this version. Versions minted before the field carry `true`.

**budget** `object`

Budget at this version.

**notifications** `object`

Notification recipient and toggles at this version.

**output\_schema** `object | null`

Output schema at this version.

**structured\_output\_required** `boolean`

Whether a conforming object was required at this version.

**description** `string | null`

Description at this version.

**metadata** `object`

Metadata at this version.

## List versions

`GET /v1/agents/{id}/versions` → `200 OK`. The full immutable version history in one page: this list is **not** paginated — `limit` and `after` are ignored, and the reply always carries `has_more: false`, `next_cursor: null`. Each row is a whole [agent-version object](#the-agent-version-object); versions are addressed by their `version` number, not by an id.

```json Response theme={"system"}
{
  "data": [
    { "version": 2, "created_at": "2026-08-20T18:00:00Z", "created_by": { "type": "user", "id": "usr_01H..." }, "system": "You process refunds. Confirm the order first." },
    { "version": 1, "created_at": "2026-08-20T17:00:00Z", "created_by": { "type": "user", "id": "usr_01H..." }, "system": "You process refunds." }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## Retrieve a version

`GET /v1/agents/{id}/versions/{n}` → `200 OK` with the full [agent-version object](#the-agent-version-object) for version `n`. Use it to inspect or diff a past configuration.

```bash theme={"system"}
curl -fsSL https://api.vetta.sh/v1/agents/agt_01H8XK.../versions/1 \
  -H "authorization: Bearer sk_live_..."
```

```json Response theme={"system"}
{
  "version": 1,
  "created_at": "2026-08-20T17:00:00Z",
  "created_by": { "type": "user", "id": "usr_01H..." },
  "model": "z-ai/glm-5.3-flash",
  "system": "You process refunds.",
  "window": "immediate",
  "tools": { "default_config": { "permission": "allow" }, "configs": {} },
  "mcp_servers": [],
  "skills": ["refund-policy@3"],
  "multiagent": false,
  "handoffs": true,
  "budget": { "cap_micro_usd": 50000000, "max_task_micro_usd": 5000000, "period": "month" },
  "notifications": { "email": "ops@example.com", "approvals": true, "questions": true, "updates": true },
  "output_schema": null,
  "structured_output_required": false,
  "description": null,
  "metadata": {}
}
```

## Roll back to a version

`POST /v1/agents/{id}/rollback` → `200 OK`. Creates a **new** version whose config equals an earlier one — history is never rewritten. Returns the full [agent object](#the-agent-object) at that new version.

**to\_version** `integer` *required*

The version whose config to restore.

**expected\_version** `integer`

The `current_version` you last read, for optimistic concurrency. Omit for an unconditional rollback.

```bash theme={"system"}
curl -fsSL https://api.vetta.sh/v1/agents/agt_01H8XK.../rollback \
  -H "authorization: Bearer sk_live_..." \
  -H "content-type: application/json" \
  -d '{ "to_version": 1, "expected_version": 2 }'
```

```json Response theme={"system"}
{ "id": "agt_01H8XK...", "object": "agent", "current_version": 3 }
```

## Spend

`GET /v1/agents/{id}/spend` → `200 OK`. Metered spend for the current budget period, in micro-USD, optionally broken down by component with `?by=component`.

The agent's computer time is billed to the agent, once per running interval however many sessions shared the machine, and to no session. So the agent's spend is more than its sessions' `consumed_micro_usd` added up; the `computer` component is the difference.

```json Response theme={"system"}
{
  "agent_id": "agt_01H8XK...",
  "period": "month",
  "spent_micro_usd": 12418700,
  "by_component": { "model": 11902000, "computer": 481000, "search": 6474, "media": 390000 }
}
```

## Delete an agent

`DELETE /v1/agents/{id}` → `200 OK`. Removes the agent. Version history is retained for existing sessions. Its open board cards are left unassigned. If the agent is on another agent's team roster, it is removed from that roster: each coordinator gets a new version without it (a roster left with no members is cleared to `null`), and the response lists those coordinators in `removed_from`, each at the version that dropped it. An agent on no roster answers `removed_from: []`. Each roster change is also recorded in the audit log as `agent.updated`.

> [!WARNING]
>
> Deleting an agent also deletes every [deployment](https://vetta.sh/docs/api/deployments.md) that runs it, so its schedules stop firing. The call does not ask first; list them with `GET /v1/deployments` before you delete.

```bash theme={"system"}
curl -fsSL -X DELETE https://api.vetta.sh/v1/agents/agt_01H8XK... \
  -H "authorization: Bearer sk_live_..."
```

```json Response theme={"system"}
{
  "id": "agt_01H8XK...",
  "object": "agent",
  "deleted": true,
  "removed_from": [{ "id": "agt_01H8XL...", "name": "lead", "version": 4 }]
}
```

> [card] [Run an agent](https://vetta.sh/docs/api/sessions.md)
>
> Create a session to run an agent directly.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.