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

# Documents

> Reference material your agents search — files, live URLs, and email-captured attachments.

Documents give agents a first-class way to ground their answers in your own reference material — product docs, contracts, pricing sheets, FAQs — without you having to chunk and embed anything by hand. You organize documents into **collections**, bind collections to agents, and the agents retrieve the most relevant passages at runtime.

## Collections and documents

A **collection** is a named, workspace-scoped set of documents with its own indexing settings (chunk size, re-index schedule). Create and manage collections on the dashboard **Documents** page.

Each **document** in a collection is one of:

* **File** — an uploaded PDF, DOCX, CSV, or text/markdown file. Files are static snapshots: the stored file *is* the document.
* **URL** — a live web page. The URL is the source of truth; the indexed text is only a retrieval index, and agents re-fetch the current page when they need up-to-date content.
* **Integration** — documents from connected providers (Google Docs, Notion). *Not yet supported* — the kind exists but ingestion returns a clear error until the adapters ship.

Every document is chunked and embedded on add, on manual re-index, and on the collection's refresh schedule (`hourly` / `daily` / `weekly`; `manual` only re-indexes on demand).

## Live documents are references, not snapshots

For anything that lives online, agntdata deliberately does **not** treat the indexed copy as the document. Search results from URL (and later integration) documents are flagged `live: true` with a `last_synced_at` timestamp, and the agent is instructed to fetch the current content when details matter — so your agents never act on a stale copy of a page that changed yesterday.

## Agent tools

Bind one or more collections to an agent (Agents → configure → **Documents** card, or `document_collection_ids` in the agent config). A non-empty binding grants two tools automatically:

* **`agnt_documents_search`** — semantic search over one bound collection. Returns the top-matching chunks with a similarity score and each match's parent document (`id`, `name`, `kind`, `ref`).
* **`agnt_documents_read`** — reads a document's *current* content by id: a live fetch for URL documents, the extracted file for snapshots. Reads are **progressive** so agents don't burn tokens on full documents: a bare call returns a peek (size, line/page/row counts, first \~40 lines), `query` greps the full text server-side and returns only matching lines with context, and `offset`/`limit` reads a bounded line window with pagination.

The reading ladder, cheapest first: **search** for meaning ("what does the contract say about termination?"), **grep** for exact strings (an amount, a name, a clause number), **window** only when the agent must read a passage linearly. Both tools are scoped: an agent can only search and read collections it is bound to.

## Saving email attachments to a collection

Email triage rules support a **Save attachments** action. When a rule with this action matches a message, the message's document-type attachments (PDF, DOCX, CSV, text) are saved as files into the rule's target collection and indexed automatically — invoices, contracts, and reports file themselves as they arrive.

**This is set up for you at mailbox connect.** Onboarding screening provisions a workspace **Email Attachments** collection and always includes at least one rule that saves document attachments (either composed onto a stream rule like Receipts, or a standing document-capture rule). Your Inbox Manager and superagnt are bound to that collection automatically, so they can search everything triage files. You can retarget or remove the rule like any other.

Two things to know:

* **Only attachments are saved.** The email body is never stored in the document system.
* The action composes with the others — a rule can label the message, save its attachments, archive it, and escalate the thread, in that order.

Configure it in the rule editor on the **Email** page (pick the target collection), or ask your agent to create the rule — the triage-rule tools accept the `save_to_documents` action with a `document_collection_id`.

## Reading attachments directly

Independent of saving, email-capable agents can read attachments in place: `connection_gmail_list_attachments` / `connection_outlook_list_attachments` lists a message's file attachments, and `read_attachment` reads one's extracted text (PDF, DOCX, CSV, and text files) with the same progressive contract as `agnt_documents_read` — peek by default, `query` to grep, `offset`/`limit` to window. Use these when a thread hinges on an attached document the agent hasn't filed yet.

## Related

<CardGroup cols={2}>
  <Card title="Workspace database" icon="database" href="/agents/workspace-database">
    Structured durable state for your agents.
  </Card>

  <Card title="Tools" icon="screwdriver-wrench" href="/agents/tools">
    The full deployed-agent tool registry.
  </Card>
</CardGroup>
