Use a Celigo AI agent to extract structured data from documents and return it in the JSON schema you define. This helps you automate document based workflows such as invoice processing, purchase order matching, and order entry.
Document extraction isn't a separate resource in the AI studio. Use your existing AI agent and configure its document input, instructions, and output schema.
When to use document extraction
Use document extraction when:
- A flow receives documents and downstream steps need specific values from them.
- You want extracted values returned in a defined JSON structure for mapping to another application.
- You need line-item or other tabular data from documents, including tables that span multiple pages.
For example, you can extract an invoice number, invoice date, vendor, purchase order number, total amount, and line items, then map those values to your downstream application.
Prerequisites
Before you begin:
- Add a Celigo AI agent to your flow. See Create an AI agent.
- Select a model that supports file input. See Learn about Celigo AI agents for how models differ.
- Make sure the document is available to the flow so you can map it to the AI agent, for example, as an email attachment or in the flow payload.
- To process and extract data from document formats that aren't natively supported by the selected AI agent type, go to Account > Company settings > AI settings and enable Intelligent document processing.
Extract data from a document
- In your flow, map the document to the AI agent's file input. See Input for Celigo AI agents.
- In the agent's Instructions, describe the information you want to extract. For example, extract the invoice number, invoice date, vendor name, purchase order number, total amount, and line items from the document.
- Set the output type.
- Define the output schema for the values you want the agent to return. For example, your schema can define fields for invoice details and an array for line items.
- Preview the agent with a sample document and verify that the extracted data matches your schema.
- Map the agent output to the next step in your flow.
The agent processes the document and returns the extracted values according to your output schema. If the returned data doesn't conform to your schema, the record errors out and no partial data passes to downstream steps.
Note: You don't need to add a separate document extraction step. The AI agent determines from your input and instructions that document data needs to be extracted.
Extract tables from multiple pages
Define repeating data, such as invoice line items, as an array in your output schema.
When a table continues across multiple pages, the extracted rows are combined into a single array. Repeated table headers aren't returned as additional rows.
For example, if an invoice contains line items across three pages, the output can return all line items in one array for mapping to the next step.
Supported documents and limits
The document types available for extraction depend on the file formats supported by the selected AI agent type. If the agent doesn't support a file format, it returns the following error:
You can also view this error in Flow Builder > Run console for the failed record.
To process and extract data from document formats that aren't natively supported by the selected AI agent type, go to Account > Company > AI settings, enable Intelligent document processing, and select Save.
The following limits apply to document processing:
- File size: Each file must be 20 MB or smaller. If a file exceeds this limit, the agent returns an error.
- Page limit: The agent extracts content from the first 50 pages of each file. If a file exceeds 50 pages, the first 50 pages are processed without an error and the remaining pages are ignored.
Review the extracted data
Preview the agent with representative documents before using it in a production flow. Verify that:
- Required values are extracted into the expected fields.
- Extracted values use the types defined in your schema.
- Repeating data is returned in the expected arrays.
- The output can be mapped correctly to your downstream step.
- Each file processed through document extraction counts as one AI agent action. Document extraction doesn't consume AI credits.
See Preview an AI agent.
Note: Document extraction consumes AI credits. Credit usage can vary depending on the document being processed. See Track your AI agent actions and credits usage.
What document extraction doesn't do
- Handwritten content: Handwriting isn't supported.
- Languages other than English: Documents in other languages are processed without error, but extraction accuracy isn't defined.
- Contracts: Clause identification and free-form extraction need a different approach to schema design and aren't supported.
- Human review: There's no built-in step for a person to check or correct extracted values before the flow continues.
- Memory across runs: Each run is independent. The agent doesn't carry context from a document it processed earlier.
Document retention in execution logs
Celigo doesn't keep the document after the run. Execution logs retain the extracted data and its metadata for 30 days by default. An administrator can configure retention from 0 to 90 days. Setting retention to 0 leaves no extraction output to troubleshoot from after a run.
See Monitor AI agent and guardrail activity with execution logs.