# Agents, playbooks and guardrails

> Define an agent in plain English or from the library, let it run on a schedule, on an event or on demand as you under your role, read every run with its steps, sources, batches and approvals, save a run as a playbook the firm's clients inherit, and rely on the guardrails: no agent creates agents, no recursion, loop and budget monitors, no sending without a grant, a kill switch per organisation.

Source: /help/en/ai-assistant/agents-skills-and-guardrails

An **agent** is a procedure the application runs for you: *every Monday, propose accruals for unbilled rent*; *when bank lines arrive, match them and hand me the exceptions*; *when a close period opens, run the checks*. It uses the same tools an AI assistant connected over MCP would use, **as you**, under **your role**, and every write it makes follows the [action policies](/help/en/ai-assistant/approval-thresholds): it applies by itself only where the policy allows, otherwise it waits for a person in the Approvals inbox. Nothing an agent does is hidden: each run keeps every step with the tool called and its parameters, the records it read, the batches it wrote (undoable in one call) and the approvals it raised.

Agents are off for a new organisation. An owner or admin turns them on under **Settings → AI → Agents on** (the kill switch), then opens **Agents** in the Accounting group of the menu.

## Create an agent

Open **Agents → New agent** and either:

- **Describe it in plain English** (or Arabic) and press **Draft**: *every Monday, propose accruals for unbilled rent with a budget of 12 steps*. The draft names the trigger (scheduled, weekly on Monday), the tools from the catalogue the agent needs, the instructions and the budget, and says why (*matches the library agent "Accruals proposer"*). You review and change anything before saving.
- **Pick a library agent**: the pack ships seven ready-made agents with instructions in English and Arabic and the tools each needs: **Accruals proposer** (weekly), **Bank reconciler** (when bank lines arrive or a task is assigned), **Close runner** (when a close period opens), **Report packager** (monthly), **Anomaly reviewer** (daily), **Vendor coder** (when bank lines arrive) and **Inbox filer** (when a mailbox or a file store finds something new). The **Library** tab describes each one. The Inbox filer reads the items of the sources you allowed it, files bills and receipts as drafts, holds what it cannot place and ignores the rest, each with its reason; it has no tool that accepts, posts, pays or sends. See [Mailbox and file sources](/help/en/incoming-invoices/mailbox-and-file-sources).

The editor's fields:

| Field | What it does |
|---|---|
| Trigger | **On demand** (Run now), **Scheduled** (daily, weekly on a weekday, monthly, quarterly or yearly on a day, at a time) or **On event** (a close period opens, a task is assigned to it, a document is uploaded, bank lines arrive, a client asks a question). |
| Tools | Only these tools are offered to the agent, and only those your role allows. The agent-management tools are never in the list. |
| Allow send and submit | Off by default: `send_*`, `submit_*` and `file_vat_return` are refused with `send_not_granted`. On, they still answer a preview a person approves. |
| Budgets | A step budget (40 by default) and optional credit budgets per run and per month. A run that passes one stops as **Budget exceeded**. |
| Autonomy | **Pause for review**: every write waits for a person. **Autonomous under the policies**: the action policies decide what applies. A discrepancy pauses the run either way. |
| Appears on the close checklist | Each new close period gets a task for this agent in the group **Agents**; an admin reviews it. |
| Runs as | The member who saves the agent. Their role is the ceiling: an accountant's agent never gets an owner's tools. |

Saving bumps the agent's **version**; the next scheduled run is recomputed. **Disable** stops the agent at once and keeps every run; **Enable** brings it back.

## Runs

The **Runs** tab is the console: every run with its agent, the trigger, the status, when it started and how many steps it took, with filters by status (open, awaiting a person, done, stopped), by agent and, for a firm, **across the clients I manage**. Open a run for:

- **Steps**: one row per thought, tool call (open **Parameters** for the exact arguments), result (with the policy that decided: *auto* or *review*, and why), approval, pause and escalation.
- **Sources**: the records the agent read, as links into the application.
- **Outputs**: the counts and ids it produced.
- **Batches**: every write it applied, with **Undo** (one call reverts the batch through the record's own path).
- **Approvals**: the proposals waiting in the inbox, with their links.
- The **escalation** when it paused: the reason, the recommended action and the evidence (links to the lines, findings or figures).

Statuses: **Queued** (waiting for the executor; three runs at a time per organisation), **Running**, **Paused** (a person decides: **Resume** continues with an optional note, **Stop here** ends it), **Awaiting approval** (its proposals wait in the inbox), **Done**, **Failed**, **Budget exceeded**, **Credits used up** (the AI credit pool ran out: scheduled and event-triggered runs stop until a top-up or the monthly reset), **Loop detected** and **Disabled** (the agent or the kill switch stopped it).

Scheduled and event runs are started by the scheduler every five minutes; **Run now** on an agent or on a close task executes at once.

## Agents on the close checklist

A close task can be assigned to an agent instead of a person (**Assign to an agent** on the task) with an **Autonomy** of its own: *Autonomous*, *Pause on discrepancy* (the default) or *Pause always*. Assigning emits the event the agent listens to and starts a run linked to the task; the task shows the run, a **pause banner** with the reason when the agent stopped, and **Open the run**. The agent only prepares: a person signs the reviewer and approver roles. A template role may name `agent:<library key or id>`, and every active agent with **Appears on the close checklist** gets its own task when a period opens. The full close flow is in [Run a month-end close](/help/en/close/run-a-month-end-close).

## Playbooks

A **playbook** is a procedure in markdown the assistant and every agent read with their instructions. Save one from a finished run (**Save as playbook** on the run: its tool calls become the numbered procedure) or write one under **Settings → Accounting → Playbooks**. Scopes: **Firm** (reaches every client the firm manages), **Client** (this organisation) and **Only me**. A client whose setup differs **forks** the firm's playbook into its own copy and edits it; the fork remembers where it came from. A body change bumps the version.

## Guardrails

| Rule | How it shows |
|---|---|
| Agents cannot create or change agents | `create_agent`, `update_agent`, `run_agent`, `disable_agent` and the policy tools are never in an agent's list; a call is refused `agent_guardrail` and recorded in the audit log with the reason. |
| No recursion | An event raised during a run carries the run and never triggers another agent. |
| Loop monitor | The same tool with the same arguments three times stops the run as **Loop detected**. |
| Budgets | More steps than the budget, or credits past the run or monthly budget, stop the run as **Budget exceeded**. |
| No sending without a grant | `send_*`, `submit_*` and `file_vat_return` are refused unless **Allow send and submit** is on, and even then they answer a preview a person approves. |
| Kill switch | **Settings → AI → Agents on** off stops every queued, running and paused run at once and refuses new ones; nothing is deleted. |
| Disable keeps the history | A disabled agent's runs stay in the console. |
| Discrepancy pauses | A reconciliation difference, a preview warning, a refused tool or a figure outside the expected range pauses the run whatever the autonomy. |

## Platform floors and switches

Two things sit above your own settings and belong to the platform's staff, not to your organisation:

- **Floors.** Under **Settings → AI → Action policies** each row shows a locked lower bound beside it. The platform decides which actions may ever be automatic and up to which amount and confidence: sending and submitting are never automatic, and posting, approving and creating documents are automatic only under an explicit amount the floor allows. A policy you save below the floor is refused with the floor named (`policy_below_floor`); a policy you saved earlier that the floor now caps is applied as the floor, and the row says so.
- **Switches.** Platform staff can pause agents for one organisation, for one library agent everywhere, or for the whole platform during an incident, always with a reason. Your queued and running runs end with the status **Disabled** and the note "paused by the platform", the Agents page shows the reason, and your own **Agents on** switch stays exactly as it was: nothing is deleted, and runs start again at the next tick once staff lift the pause (`agents_paused_by_platform` until then). The change is in your audit log as `agents.platform_switch`.

Library agents are published by the platform: when a newer version of the agent you created from the library is out, the list shows **Update available** and the editor says so. **Apply library update** copies the new instructions and tools onto your agent; until you do, your agent keeps the text you have.

## Attribution

Every change an agent makes is in the audit log with the actor kind **Agent**, the agent's name, the run and the member it ran as; a refused call is a row with the blocked reason. The Batches tab lists the agent's batches, and the Approvals inbox marks its proposals with the source badge **Agent** and a link to the run. See [Audit log](/help/en/account-and-setup/audit-log).

## Mailboxes and file stores an agent may read

An agent reads nothing outside your books unless you let it. Under **Settings → Connections → Cloud storage** an owner or admin connects a mailbox or a cloud store, sets its scope (which folders, which senders, since when) and allows an agent on it with **Agents may read**. Without that grant the agent's read is refused; with it, the agent reads inside the scope only, every read is recorded, and what it finds becomes a draft a person accepts. In this release a mailbox is the test connection only, and the tools that read a source arrive in a later release. The steps are in [Cloud storage](/help/en/documents/cloud-storage), under *Mailboxes and what agents may read*.

## REST and MCP

Routes: `GET/POST /agents`, `POST /agents/draft`, `GET/PATCH /agents/{id}`, `POST /agents/{id}/run`, `/disable`, `/enable`, `GET /agents/runs`, `GET /agents/runs/{id}`, `POST …/resume`, `POST …/cancel`, `POST …/save-playbook`, `GET/POST /playbooks`, `PATCH/DELETE /playbooks/{id}`, `POST /playbooks/{id}/fork`, `PATCH /close/tasks/{id}` with `assigneeAgentId` and `autonomy`. MCP tools for a person's assistant: `list_agents`, `run_agent`, `list_agent_runs`, `get_agent_run`, `list_playbooks`, `save_playbook`. None of these are in an agent's own tool list.
