Extraction is the step in which DocuWare IDP reads values from a document and returns them as single fields, for example, the invoice number, the invoice date or the total amount. These values become the index data a document is stored with, and the data that the following steps of the process work with.
The extraction itself is done by an AI agent. For your own document types and fields, there are two ways to set up a custom extraction:
Classic extraction: you annotate sample documents, and the agent learns from these examples which value belongs to which field. Use for existing workflows that perform well.
Extraction: you describe each field in words. The agent applies that description to the document, so you get a first result without any training. This first result is called zero-shot extraction. You can still train the agent afterward using annotated sample documents to improve results on your own documents. This is recommended for new workflows.
The description of a field is called a field prompt: a short instruction in plain language that tells the Extraction agent which value to return for this one field. It requires no special syntax or commands to improve extraction quality.
You write field prompts while you define the fields of an extraction agent, under DocuWare Configurations > Early Access - IDP > AI Agents or under DocuWare Configurations > Early Access - IDP > IDP Flows > Extraction. The same agents and the same field settings are also available on the IDP platform; this article follows the way through Early Access - IDP.
Global extraction instructions
In the Fields page has an optional box, Global Extraction Instructions. What you write there applies to every field of the agent. A field prompt applies to only one field. Use the box for context that all fields share, instead of repeating that context in every field prompt.
Go to DocuWare Configurations and select Early Access - IDP.
In the left sidebar, select the AI Agents icon. The list shows the agents of your organization with their type, for example, Extraction or Classification.
Select Train your own Agent. A dialog asks which type of AI agent you want to create.
Select Extraction card.
Choose whether to create the agent with existing DocuWare data or with new training data.
Enter an Agent name and a Description.
Next, you have the option to fill the Global Extraction Instructions. These apply to every field of the agent.

Adding a field and its prompt
Each field of a GenAI Extraction agent is defined by three things: a field type, a name, and the field prompt. You can change the prompt at any time.
On the Fields page, select Add New Extraction Field. The Add New Field panel opens.
Choose the Field Type and enter a Name. The Name cannot be changed later.
Next, write the field prompt in Intelligent Description.
Add another field by selecting Add New Extraction Field.

On the IDP platform, you reach the same fields by clicking the Train your own model now button, then Create Custom Extraction and GenAI extraction.

Writing a field prompt
Naming the value and excluding the rest
A document often contains several values of the same kind. An invoice, for example, can contain an invoice number, an order number, a customer number, and a delivery note number. If the prompt does not say which value is meant, the AI has to choose one of them. Write the prompt so that only one value on the document can match it.
For example, "Extract the number." matches every number on an invoice. "Extract the invoice number assigned by the supplier. Do not use the order number, customer number, or delivery note number." matches only one.
A prompt can follow this structure: action, target, context, constraint. Add a constraint only when it solves a problem. Every extra rule is another instruction the AI has to weigh against the others, and rules that overlap can contradict each other. Start with a short prompt and test it. Add an exclusion, a label or a position when a test shows that it is needed.
Using labels from the document
A prompt can refer to the label printed next to the value. This helps when suppliers use different words for the same information. An example is "Extract the customer reference number, usually labeled 'Customer Reference' or 'Your Reference'. Do not use the purchase order number."
Do not tie a prompt to a single label when your documents come from many suppliers. A label that is missing on one layout then costs you the value.
Handling information that is missing
Say what should happen when the value is not on the document. Otherwise the AI may fill the field with the closest value it finds. An example is "Extract the delivery date if it is stated on the document. Do not substitute the invoice date or the order date."
Do not ask the AI to guess a value that the document does not support. How an empty value is then passed on depends on the field type and the extraction settings, and a field prompt does not override that.
Field prompt examples for common fields
The following prompts follow the same pattern for the fields that appear in most invoice processes.
Field | Prompt that is too general | Prompt that works |
|---|---|---|
Invoice number | Extract invoice number. | Extract the invoice number issued by the supplier. Do not use the order number or customer number. |
Invoice date | Extract the date. | Extract the invoice issue date. Do not use the delivery date or the payment due date. |
Supplier name | Extract company name. | Extract the name of the company issuing the invoice, not the recipient. |
Delivery address | Extract address. | Extract the delivery address. Do not use the supplier address or the billing address. |
VAT ID | Extract VAT ID. | Extract the VAT ID of the invoice issuer, not the recipient. |
Total amount | Extract total. | Extract the final invoice total including VAT. Do not use the subtotal or the VAT amount. |
Purchase order number | Extract order number. | Extract the customer's purchase order number. Do not use the supplier's internal order reference. |
Using visual clues from the document
GenAI Extraction also reads the page as an image, so it can follow how the elements on a page sit in relation to each other. A visual clue is useful when the text alone does not identify the value. A field prompt can therefore refer to a position, a color, a stamp or a signature.
This capability is called the Image Channel. The Image Channel is available only for GenAI Extraction, not for classic extraction. All new and untrained GenAI Extraction agents use it automatically.
Visual clue | Example prompt |
|---|---|
Position | Extract the document reference number located in the top-right corner. |
Relative position | Extract the recipient name located below the issuer details. |
Color | Extract the status shown inside the blue or green stamp. |
Stamp | Extract the date displayed in the approval stamp. |
Signature | Return true if a signature is present on the document. Otherwise return false. |
Logo | Return true if a company logo is present on the document. |
Barcode or QR code | Return true if a barcode or a QR code is present on the document. |
Information: Barcodes and QR codes are detected, not decoded
A prompt can ask whether a barcode or a QR code is on the document, and where it sits on the page. The value encoded inside it is not read.
If an agent ignores a visual instruction, follow these steps:
Check that the agent is of the type GenAI Extraction and not a classic extraction.
Review the field prompt and state the visual clue explicitly.
If the value is encoded in a barcode or a QR code, see the limitation above.
Prompts for tables and line items
Table fields need more care than header fields, because the AI has to understand both the single value and the row it belongs to. Visual information helps most here, because the AI uses the structure of the table itself: its rows, its columns, and its headers.
When you write a prompt to extract information from a table field, you can refer to the visual structure of the table: its rows, columns and headers, and where values sit in relation to each other. If it is not clear which values belong together, describe the relationship in the prompt. In the table below, there are some examples:
Columns tell the AI which value to take from each line item. For example: "Extract the value in the Qty column. Do not use the Unit price column."
Rows indicate which rows are not line items. For example: "Exclude subtotal and total rows."
Headers tell the AI how to read the table structure. For example: "Extract the quantity, usually in the column labeled Qty or Quantity."
Table extraction is meant to include every line item in the table. For this reason, a prompt should not decide which line items are included. For example, do not write a prompt like "Extract only the first three rows." In the example, the result would be incomplete, and you get no warning that line items are missing. Subtotal and total rows are not line items, so you can still exclude them.
Field | Prompt |
|---|---|
Product description | Extract the description of each invoiced product or service from the corresponding line item. Do not use the invoice header or general remarks as a product description. |
Quantity | Extract the quantity for each line item. Use the quantity that belongs to the product or service in that row, not the unit price or the row total. |
Item total | Extract the total amount for each line item. Do not use the unit price or the overall invoice total. |
Tip: Table extraction is meant to capture the whole table
Do not use a field prompt to limit extraction to the first few rows. If only part of the table is relevant, filter the data in the process that follows extraction.
Returning values that are not on the document
A field prompt is not limited to copying text from the page. GenAI Extraction can also interpret what it reads and return a value that is not printed on the document.
Field | Prompt |
|---|---|
Location | If the delivery address is in Munich, return "Munich". If it is in Hamburg, return "Hamburg". Otherwise return "Other". |
Invoice category | Return "Parts" for invoices about spare parts or warehouse materials. Return "Administration" for general administrative services. |
International | Return true if the delivery address is outside Germany. Otherwise return false. |
This works well for simple classification and mapping. GenAI Extraction is not a rule engine, and it does not guarantee the same decision in every edge case. Calculations and business-critical rules belong in the process that runs after extraction.
Testing a field prompt
A field prompt rarely returns the right value on the first attempt. Improve it in small steps:
Start with a clear, simple prompt that describes the information without extra restrictions.
Test it on representative documents. Include different layouts, several suppliers and the edge cases you really receive.
Find the cause of each wrong result. Ask whether the field was ambiguous, whether the AI picked a neighboring value, or whether a visual clue would have decided it.
Change one thing at a time, and address the error you observed rather than every error you can imagine.
Test again across all your sample documents. Do not optimize a prompt for one problem document at the cost of the others.
Choosing between a prompt and training examples
Some results cannot be reached by rewording an instruction. Improve the field prompt when:
The definition of the field is ambiguous.
The AI picks the wrong value out of several candidates.
An exclusion rule is missing.
A visual characteristic identifies the correct value.
Add training examples when:
Zero-shot results are mostly correct, but not consistent across different documents.
The expected result is specific to your organization.
Several document layouts have to be read in the same way.
The correct result is easier to show than to describe.
The agent has to learn patterns that your documents repeat.
If clear field prompts still return inconsistent results across different documents, add training examples. This usually helps more than making the prompts longer and more detailed.
A field prompt states the rule. A training example shows it. An agent that is already trained keeps the annotations it learned from, so a prompt you change later can pull against them.
Important: Check the training data after you change a prompt significantly
An updated field prompt is applied at extraction time, but the agent was trained with the earlier prompt and the earlier annotations. If the new prompt changes what counts as the correct value, review the affected training data and train the agent again. Otherwise, results stay inconsistent between documents.