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

# Agents

> Learn what End Close agents do: investigate exceptions, write notes with suggested fixes and checked evidence, and run your own instructions on a schedule.

End Close agents are AI workers that do reconciliation work alongside your team. Some are built in: they write matching rules and investigate exceptions. Others are agents you define, with standing instructions that run on a schedule or on demand against your End Close data.

## How agents fit with the other concepts

* The **reconciliation agent** writes and refines the [rules](https://endclose.com/docs/concepts/rules-and-matches.md) of each [reconciliation](https://endclose.com/docs/concepts/reconciliations.md). See [The reconciliation agent](https://endclose.com/docs/concepts/reconciliations.md#the-reconciliation-agent).
* **Exception agents** look into each [exception](https://endclose.com/docs/concepts/exceptions.md) and write a note and a suggested fix for each overdue line.
* **Your agents** carry out instructions you write, such as a daily cash check or a month-end report, and can read and change End Close data within the limits you set.

## Investigate exceptions

When the overdue lines behind an [exception](https://endclose.com/docs/concepts/exceptions.md) change, End Close starts an investigation. The agent searches the reconciliation's records for candidates and records what it found on the exception's `investigation`:

| Field | Description |
| - | - |
| `outcome` | `match_found` (confident candidates), `no_match` (a thorough search found nothing) or `needs_review` (candidates with weak signals). |
| `recommendation_text` | The agent's recommendation. |
| `confidence_score` | Its confidence, from 0.0 to 1.0. |
| `candidate_records_searched` | How many candidate records it checked. |
| `suggested_record_ids` | Up to 10 candidate records, best first. |

An investigation only reads your data. Applying what it found is up to a person.

End Close can also review an exception line by line. The agent writes a finding for each overdue line: a note in one or two plain sentences, whether the line looks right as it stands, and a suggested fix. The fix is a `match` with specific records, an `adjust` that matches them and books the remaining gap as an [adjustment](https://endclose.com/docs/concepts/reconciliations.md#adjustments) with a reason, or nothing. End Close checks every suggestion against your records before saving it. A reviewer applies it with **Approve**, so nothing changes until a person agrees.

If your own matching engine writes findings through the [findings API](https://endclose.com/docs/guides/exception-findings-api.md), its findings take precedence and the agent leaves those lines alone.

### Evidence checked against your documents

A finding can quote the documents behind it, such as a contract clause or an invoice line, with a link to the file. When the link points to a PDF in **Files**, End Close checks the quote against the document and stores the result on the quote's `check`:

| `check.status` | Meaning |
| - | - |
| `found` | The quote is on the cited page, or anywhere in the document if no page was cited. |
| `found_elsewhere` | The quote is in the document, on a different page. `page` says which. |
| `not_found` | The document doesn't say what the quote says. |
| `no_text` | The PDF has no text to search, such as a scan. |
| `pending` | Not checked yet. |

Other statuses cover quotes with no document, links outside **Files**, files that aren't PDFs, and PDFs that can't be read. When a quote is found, `page` and `boxes` locate it, so the review can open the PDF at the right page with the quote highlighted.

## Run your own agents

An agent you create has a name, standing `instructions`, and a schedule. Each run carries out the instructions in an isolated sandbox with access to the environment's data, then writes a markdown `summary` and any output files.

```json Agent theme={"dark"}
{
  "id": "0193c4e1-2a7b-7c3d-9e8f-4a5b6c7d8e9f",
  "kind": "llm",
  "name": "Daily cash check",
  "instructions": "Each morning, compare yesterday's Chase Operating balance with the ledger and list any unmatched deposits over $10,000.",
  "cadence": "weekdays",
  "hour": 8,
  "minute": 0,
  "timezone": "America/New_York",
  "active": true,
  "endclose_writes": false,
  "delivery_enabled": true,
  "delivery_recipients": ["finance@example.com"],
  "delivery_file_pattern": "*.csv",
  "next_run_at": "2026-11-11T13:00:00Z"
}
```

| Field | Description |
| - | - |
| `instructions` | The prompt every run carries out. |
| `cadence` | `manual` (the default), `hourly`, `daily`, `weekdays` or `weekly`. Scheduled cadences need `minute`, plus `hour` for daily and weekdays, plus `day_of_week` for weekly. |
| `timezone` | The IANA time zone the schedule runs in. |
| `active` | Inactive agents aren't scheduled but can still be run on demand. |
| `mentions` | Reconciliations, data streams, people and other agents whose context goes into every run. Mentioning an agent lets a run start it. |
| `endclose_writes` | Whether runs may change End Close data: matches, exceptions and findings, marking records overdue, and starting other agents. When `false`, runs can only read. |
| `input_files` | Reference files every run can use, such as a mapping table or a prior statement. |
| `delivery_enabled` | Email output files matching `delivery_file_pattern` to `delivery_recipients` after each completed run. |

Agents of kind `browser` also appear in the API. End Close sets them up to sign in to a web portal, such as a bank's, and import what it exports. You can't create them through the API.

### Runs

Each execution is a run, listed under `GET /agents/{id}/runs`. A run moves through `pending`, `running`, `completed`, `failed` or `cancelled`. A run that needs a person's approval or an answer waits in `waiting` until someone responds in the app. `triggered_by` says what started it: `schedule`, `manual`, `api`, a file drop, another agent, or a resumed decision.

Start a run straight away, whatever the agent's cadence:

```bash cURL theme={"dark"}
curl -X POST https://api.endclose.com/v1/agents/$AGENT_ID/runs \
  -H "X-API-Key: $ENDCLOSE_API_KEY"
```

The run is created `pending` and works in the background. Poll `GET /agents/{id}/runs/{run_id}` for its status, `summary`, output files and full transcript. One agent can start another, but End Close refuses a trigger that would loop or chain more than 5 runs deep.

### Input files

`POST /agents/{id}/files` attaches a file to the agent, sent as `multipart/form-data` with a single `file` part. Every run lists the agent's input files and can download them. Files can be up to 50 MB each, with up to 20 per agent. A file with the same name as an existing one is added alongside it, so delete the old file first to replace it.

## Related

> [card] [Exceptions](https://endclose.com/docs/concepts/exceptions.md)
>
> The overdue lines agents investigate.

> [card] [Review exceptions](https://endclose.com/docs/guides/review-exceptions.md)
>
> Approve or keep what agents suggest.

> [card] [Exception findings API](https://endclose.com/docs/guides/exception-findings-api.md)
>
> Write findings from your own engine instead.

> [card] [API reference](https://endclose.com/docs/api-reference/overview.md)
>
> Agent, run and file endpoints.


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