---
url: /operations/documents.md
---

# Documents

Document upload, parsing, sensitive-content guardrails, and the virtual
filesystem the agent receives selected documents through.

## Document Parsing Configuration (YAML)

The core service supports extracting text and structure from uploaded documents using an optional parser. Configure the document parser in `core.config.yaml`. By default, document parsing is disabled (`parser_backend: "none"`).

Currently, Xberg is the only supported parser backend. To enable it, set the parser backend to `"xberg"` and configure the URL and timeout:

```yaml
parser_backend: "xberg" # Default is "none"
xberg_url: "http://xberg-full:8000"
xberg_timeout: 120.0
```

Where:

* `parser_backend`: Defines the parser used (`none` to disable, or `xberg`).
* `xberg_url`: Points to your Xberg parsing service.
* `xberg_timeout`: Execution timeout in seconds.

## Personal data and secret warnings for documents

After extraction, the core service scans each uploaded document for likely
personal data (IBAN, Steuer-ID, Sozialversicherungsnummer, ID card numbers,
credit cards, dates of birth, email addresses, phone numbers) and secrets
(private keys, access tokens, JWTs, connection strings, credential
assignments). Detection uses patterns plus checksums; it does not detect names
or addresses. The scan report stores categories and counts. Matched values stay in the document itself.

Every upload enters an owner-only review before it can be attached to a chat,
including documents with no findings. The owner can inspect the parsed text and
correct extraction or OCR errors in a plain-text editor; the original uploaded
binary is never changed or retained. The review shows the initial parsed text
separately from the current review text. Saving an edit requires the current
revision, validates the same UTF-8 and size limits as extraction, and reruns the
enabled document guardrails. A stale save is rejected, previous finding offsets
and decisions are discarded, and the new scan must be reviewed before
confirmation. The service records whether text was edited and the editor and
timestamp in review metadata.

For each current sensitive-content finding, the owner can keep it or redact it
from the extracted text. Redaction also reruns the scan and requires fresh
confirmation. Only the reviewed and confirmed text becomes attachable. Cancelling
a new upload deletes the pending document; cancelling a review of an existing
document restores its previously published version. A scanner failure returns
HTTP 503 and leaves the current revision unavailable for publication. Text edits
do not alter the source file. Apply core database migrations before rolling out
the service and frontend.

Configure the document-local guardrail under `documents.guardrails.sensitive_content`:

```yaml
documents:
    guardrails:
        sensitive_content:
            enabled: true # scan new uploads
            ignored_email_domains: ["muenchen.de"]
            disabled_categories: [] # e.g. ["phone"]
```

Documents uploaded before the scan existed, or while it was disabled, are not
flagged.

## Virtual filesystem for selected documents

After a document is uploaded and parsed, its extracted text is stored in the
core service's PostgreSQL-backed file store. When a chat request selects one or
more documents, the agent receives them through a read-only `/documents/`
filesystem mount. The mount does not support `ls` or `glob` for path discovery.
The model must use the document paths supplied in the prompt; `read_file` and
`grep` work only with those supplied paths. The mount is scoped to the
authenticated user and to the documents selected for that request; it is not a
general document search or a writable filesystem.

The filesystem tools are Deep Agents built-ins and must be enabled for every
model that should read attachments. Add them under that model's
`deep_agent.enabled_builtin_tools` configuration:

```yaml
models:
    - id: "<model-id>"
      provider: "<provider-key>"
      deep_agent:
          enabled_builtin_tools:
              - write_todos
              - ls
              - read_file
              - glob
              - grep
```

If these tools are omitted, documents can still be uploaded and their excerpts
can appear in the prompt, but the model cannot access the virtual filesystem.
