> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.instabase.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.instabase.com/_mcp/server.

# Agent extract

> Extract structured fields using a large language model (LLM) and your extraction schema.

Enterprise Single-tenant

The *Agent extract* step extracts structured data from documents using LLMs, according to the schema defined in a linked agent extract module.

## Parameters

* **Extraction schema** -- Select the agent extract module containing your extraction schema JSON file.

  Schema files are JSON objects whose keys are document class names. Each class value has a `description` string and a `fields` array. Each field defines at least a `name` and a [`data_type`](#supported-data-types). Most fields also include a `description`, telling the LLM what to extract.

## Supported data types

Set `data_type` on each field in `fields` to one of `TEXT`, `TEXT_LIST`, `OBJECT_LIST`, or `TABLE`.

* `TEXT` -- A single text value.

* `TEXT_LIST` -- A list of text values.

* `OBJECT_LIST` -- A repeating group of sub-fields with a fixed shape, such as a list with defined properties. Add a `prompt_schema` array on the parent field. Each object in `prompt_schema` lists sub-fields with `name` and `description` only--`data_type` is not required.

* `TABLE` -- Tabular extraction.

## Reasoning fields

Reasoning fields use model instructions you write in `prompt` instead of a static `description`. Set `"prompt_type": "advanced"` and include `data_type` as for any other field. Omit `description` for these entries (use `prompt` only).

```json
{
  "name": "reasoning field",
  "prompt_type": "advanced",
  "data_type": "TEXT",
  "prompt": "calculate the sum of the deductions"
}
```

## Sample extraction schema

```json
{
  "Invoice": {
    "description": "An invoice document requesting payment for goods or services",
    "fields": [
      {
        "name": "Invoice Number",
        "data_type": "TEXT",
        "description": "The unique invoice identifier or number"
      },
      {
        "name": "Invoice Date",
        "data_type": "TEXT",
        "description": "The date the invoice was issued"
      },
      {
        "name": "Total Amount",
        "data_type": "TEXT",
        "description": "The total amount due on the invoice including tax"
      },
      {
        "name": "Vendor Name",
        "data_type": "TEXT",
        "description": "The name of the vendor or supplier"
      },
      {
        "name": "Line Items",
        "data_type": "OBJECT_LIST",
        "description": "Table of line items on the invoice",
        "prompt_schema": [
          {
            "name": "Item Description",
            "description": "Description of the item or service"
          },
          {
            "name": "Quantity",
            "description": "Quantity of the item"
          },
          {
            "name": "Unit Price",
            "description": "Price per unit"
          },
          {
            "name": "Amount",
            "description": "Total amount for this line item"
          }
        ]
      }
    ]
  }
}
```