# Agents

> Agents (set up by chatting), allow rules: 8 endpoints of the Teemli API.

Source: https://docs.teemli.com/developers/reference/agents/

Generated from [`api/openapi.yaml`](/developers/api/) (OpenAPI 3.1). Base URL: `https://api.teemli.com`. Auth: `Authorization: Bearer <token or tml_ API key>`. Errors are `application/problem+json`; writes accept an `Idempotency-Key` header.

Agents (set up by chatting), allow rules

## My agents

```http
GET /v1/orgs/{org}/agents
```

The caller's personal agents and the AI employees they manage or that are shared with
them. Ordered: active first, then paused/retired. Includes live-ish `activity_state`
(idle / working / waiting / needs_you), open cards for me, and month-to-date spend.

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Agents — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## New agent (opens as a chat)

```http
POST /v1/orgs/{org}/agents
```

Creates a blank agent in `setting_up` with its main conversation and a greeting
("Hi, I'm new here. What would you like me to own?…"). Open the returned conversation;
the agent proposes its name, avatar, charter and instructions on `setup_change` cards.

**API keys:** needs the `agents:write` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` | string | Optional; default "New agent" |
| `template` | `chief_of_staff` | Start from a template (GET …/agent-templates); it is ready to use (status active) |

**Responses**

- `201` Created — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `422` Invalid input — Problem

## One agent

```http
GET /v1/orgs/{org}/agents/{agent}
```

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` The agent — Agent
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Edit, pause or resume an agent

```http
PATCH /v1/orgs/{org}/agents/{agent}
```

Direct edits by the person who controls the agent (owner, or an AI employee's manager).
Confirm cards exist to stop the *agent* changing itself; the person edits freely.
An agent paused by an admin (`admin_paused`) can't be resumed here (403).

**API keys:** needs the `agents:write` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` | string |  |
| `avatar_seed` | string |  |
| `charter` | string |  |
| `instructions` | string |  |
| `model` | string | "" resets to the organisation default |
| `budget_monthly_usd` | number |  |
| `clear_budget` | boolean | Remove the budget |
| `laptop_access` | `always`, `ask`, `never` |  |
| `status` | `active`, `paused` | Resume / pause |
| `context_window_tokens` | `250000`, `500000`, `1000000`, `null` | null = use the organisation's default |

**Responses**

- `200` The updated agent — Agent
- `401` Missing, invalid or expired token — Problem
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `422` Invalid input — Problem

## Delete an agent

```http
DELETE /v1/orgs/{org}/agents/{agent}
```

Deletes the agent with its conversations, routines and memory. Can't be undone.

**API keys:** needs the `agents:write` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` Deleted — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## My main conversation with an agent

```http
POST /v1/orgs/{org}/agents/{agent}/conversation
```

Get-or-create the caller's main thread with the agent (e.g. first time opening an AI employee shared with them).

**API keys:** needs the `agents:run` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` The conversation — Conversation
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Standing permissions ("Always" and "For this task")

```http
GET /v1/orgs/{org}/agents/{agent}/allow-rules
```

Shown in the agent's Permissions tab with a revoke action. Visible to the agent's controller.

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` Rules, newest first — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Revoke a standing permission

```http
DELETE /v1/orgs/{org}/agents/{agent}/allow-rules/{rule}
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |
| `rule` (required) | path | string (uuid) |  |

**Responses**

- `200` Deleted — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
