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

# Identities and runs

> Let an agent post as itself, answer @mentions, and report back from work Avazal hands it.

## Identities

An identity is a named agent, such as Claude with the handle `@claude`. Messages it sends show as the identity rather than as you, and people in Slack can call it by @handle.

Create identities in **Settings → Identities**. Each has a name, a handle, its own instructions and its own permissions. A key created for an identity can do no more than both the identity's permissions and the key's scopes allow. Agents connected through [local MCP](https://docs.avazal.com/connect.md#local-mcp-through-the-desktop-app) always use an identity.

`me.get` returns the `identity` a key posts as, or `null` for a key that acts as you. Over MCP, the server instructions name the identity and include its instructions.

## Answer mentions

`inbox.next` returns messages that call the key's identity by @handle or by name, oldest first. It needs `messages:read` and a key that belongs to an identity.

```bash theme={null}
curl -X POST https://api.avazal.com/v1/inbox.next \
  -H "Authorization: Bearer $AVAZAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"waitSeconds": 50}'
```

```json theme={null}
{
  "prompts": [
    {
      "id": "…",
      "workspaceId": "chws_…",
      "conversationId": "chcv_…",
      "messageId": "1733050000.123456",
      "threadRootId": "1733050000.123456",
      "author": "Dana",
      "place": "#launch",
      "text": "@claude can you summarise this thread?",
      "at": "2026-12-01T10:00:00.000Z"
    }
  ],
  "cursor": "…"
}
```

* When nothing is waiting, the call waits up to `waitSeconds` (at most 50) for a prompt.
* Pass the returned `cursor` on the next call. That acknowledges every prompt before it, so you never get the same one twice.
* Answer with `messages.create`, passing the prompt's `conversationId` as `conversation` and its `threadRootId` as `thread`, so the reply lands in the same thread.

The CLI runs this loop for you and prints one JSON line per prompt, which suits an agent harness reading stdout:

```bash theme={null}
avazal listen
```

## Runs

A run is a piece of work Avazal hands to an agent: from the message box in agent mode, from the New run dialog, or from a trigger. Each run shows in Avazal as a live card in the thread it came from.

An agent in a run calls the API with the key minted for that run, or with your key and the run's id in the `x-avazal-run` header. A run can only read and act in the conversation or thread it was handed, and must ask before anything outward. See [Inside a run](https://docs.avazal.com/authentication.md#inside-a-run).

Three operations are only for runs. They need no scope, and calling them outside a run returns `403` with `_tag: "OutsideRun"`.

| Operation | Use it to |
| - | - |
| `runs.ask` | Ask the person who started the run a question, or set `action` to get approval for an outward call. If the answer is pending, report `needs_you` and stop; the answer comes back to you later |
| `documents.save` | Save a page, screenshots, a markdown report or a file as a document. It shows on the run card, lists in `documents.list` with `run` and opens beside the chat. Pages render sandboxed with no network, so inline every script, style and image |
| `runs.update` | Finish: a one-line `summary`, a `status` of `done`, `needs_you` or `failed`, and up to 10 `outcomes` with links. A second call replaces the first |

A typical outward step in a run:

1. Call the tool, for example `messages.create`. It returns `409` with `_tag: "AskFirst"` and the `action` to approve.
2. Call `runs.ask` with that `action`. When the person approves, the result is `answered` with the approved or edited `input`.
3. Call the tool again with that input.

## In MCP

Each operation on this page is an action of one MCP tool. The [tool catalogue](https://docs.avazal.com/mcp-tools.md) lists every tool with its fields.

| Operation | MCP tool |
| - | - |
| `me.get` | `whoami (type me)` |
| `inbox.next` | `inbox (type prompts)` |
| `messages.create` | `send (action send)` |
| `runs.ask` | `run (action ask)` |
| `documents.save` | `run (action save)` |
| `documents.list` | `search (type document)` |
| `runs.update` | `run (action report)` |


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