Skip to main content

Agentic Table Extractor: Introduction

Enterprise Feature

This feature is available in Unstract Cloud Edition and Unstract On-Premise Edition.

What is Agentic Table Extractor?

Agentic Table Extractor is a multi-agent pipeline within Prompt Studio that extracts structured table data from documents. Unlike standard extraction prompts that treat tables as flat text, Agentic Table Extractor uses a sequence of specialized agents — each backed by a Vision Language Model (VLM) — to detect, analyze, and extract tables with structural awareness.

It handles PDFs, Excel files (.xlsx/.xls), and images, and works especially well on complex tables that span multiple pages, have merged cells, or contain nested structures.

Standard Table Extraction vs. Agentic Table Extraction

Standard table extraction (enforce_type: table) sends a single prompt to one LLM and asks it to extract table data in one pass. This works for simple, well-formatted tables but struggles with:

  • Tables that span multiple pages, where rows may be split across page breaks
  • Complex table structures with merged cells or hierarchical headers
  • Documents where tables need to be located among other content first
  • Large tables where a single LLM call can't capture all rows accurately

Agentic Table Extraction (enforce_type: agentic_table) addresses these limitations by breaking the problem into specialized stages, each handled by a dedicated agent.

AspectStandard (table)Agentic (agentic_table)
LLM callsSingle callMulti-agent pipeline (6 agents)
Page handlingEntire document at oncePage-by-page scanning with parallel processing
Multi-page tablesOften splits or misses rowsDetects and merges cross-page rows
Table detectionRelies on prompt instructionsDedicated detection agent screens pages
Output transformationNoneCode generation for JSON schema mapping
LLM adapters required1 (project LLM profile)2 (advanced + lite) + X2Text adapter
File typesPDF, imagesPDF, images, Excel (.xlsx/.xls)
CostLower (single call)Higher (multiple agent calls)

The 6-Agent Pipeline

Agentic Table Extractor processes documents through a pipeline of six specialized agents:

Document


Agent 0: DetectorPromptGenerator (advanced LLM)
│ Generates a detection prompt from your target table description

Agent 1: PresenceDetector (lite LLM)
│ Screens pages in parallel to find which ones contain the target table

Agent 2: TableDetector (advanced LLM)
│ Analyzes table structure — headers, columns, data types

Agent 3: ContentExtractor (advanced LLM)
│ Extracts row data page by page, merges rows that span page breaks

Agent 4: CodeGenerator (advanced LLM)
│ Generates Python transformation code to map raw data to JSON structure

Agent 5: CodeExecutor (no LLM)
Runs the generated code in a sandboxed environment

Agent 0 — DetectorPromptGenerator

Uses the advanced LLM to turn your natural-language target table description into a structured detection prompt. This prompt is used by Agent 1 to screen pages efficiently.

Agent 1 — PresenceDetector

Uses the lite LLM to screen each page of the document in parallel, determining whether the page contains (or is part of) the target table. Pages that don't contain the table are skipped, saving time and cost on large documents.

Agent 2 — TableDetector

Uses the advanced LLM to analyze the structure of detected tables — identifying column headers, data types, and table boundaries. This structural understanding guides the content extraction.

Agent 3 — ContentExtractor

Uses the advanced LLM to extract actual row data from each relevant page. It handles cross-page row merging — when a table row is split across a page break, the extractor detects the continuation and merges the data into a single row.

Agent 4 — CodeGenerator

Uses the advanced LLM to generate Python transformation code that maps the raw extracted data into your JSON structure, including grouped output when the schema defines a nested hierarchy. The generated code is validated using AST parsing and flake8 before execution.

Agent 5 — CodeExecutor

Runs the generated transformation code in a sandboxed environment with a 60-second timeout. No LLM is involved — this is pure code execution. The sandbox restricts available modules and prevents file system or network access.

Supported File Types

  • PDF — The primary use case. Works with both native and scanned PDFs.
  • Excel (.xlsx, .xls) — Each sheet is treated as a separate "page" in the pipeline. See Excel Support.
  • Images — PNG, JPEG, TIFF, and other image formats supported by the configured X2Text adapter.