Intelligent Invoice Analysis Powered by Generative and Agentic AI
Manual invoice processing is one of the most time-consuming and error-prone tasks in finance departments. Each incoming invoice needs to be read, reviewed, entered into a system, and followed up with email communication—often leading to bottlenecks and delays
We can use our Agentic AI capabilities such as document extractor and Generative AI used in a flow and this entire flow can now be automated in real time.
In this project , we’ll implement how to build a smart invoice processing workflow which uses
-
Document extractor to extracts key invoice data from PDFs or scanned images
-
Generates a natural-language summary of the invoice using Generative AI component
-
Composes and sends a professional email to finance or vendors using send email Tool
How does this approach prove to be beneficial?
This approach not only speeds up operations but also enhances accuracy and ensures nothing slips
through the cracks. Whether you're handling 10 or 10,000 invoices, this kind of automation is a game-changer for modern finance teams.
Steps to create the Invoice Processing flow
Create an agent
To begin creating a custom solution, the first step is to set up an agent. The user should choose the "Create from Scratch" option, enter a suitable agent name, and provide a brief description outlining the agent's purpose. Once all details are filled in, click the "Create" button to proceed.
After the agent is created, the user will be directed to the assistant's profile page. Here, they can customize the agent's style as needed. To begin building the workflow, click on the "Toolset" option.
When the Toolset option is clicked, an "Add a New Tool" popup will appear with four available options. To create a custom workflow, select the "Create a New Flow" option.
The next step is to add the necessary components to the flow. Click on the “+” icon to begin. From the list of available Activities, select "User Activity" to add it to your flow.
The User Activity is used to collect input from the user. Since this workflow is designed to generate an invoice summary by reading the contents of an uploaded file, Select “File upload” option from Interaction tab
Next, you'll need to add a Document Extractor to read data from the uploaded file and define the necessary variables. To do this, select the "Document Extractor" option.
Click on the "Edit Fields" option to modify the variables. Upon clicking this button, the user is redirected to the document upload page, where they can upload a file and define the variables to be extracted from it.
Now you are in the document extractor page and you can see drag and drop functionality to upload files .There is an option to change the LLM models also.Upload a file and add the variables to extract
Following are the extraction variables
-
To Email
-
Total Due
-
Due Date
-
Invoice Date
-
Order Number
-
Invoice Number
Once extraction is completed the details are highlighted as shown below
Click the Done button to finish the extraction process. The extracted fields will then be displayed in the popup within the flow diagram.
Steps to include generative AI component in the flow
Integrating generative AI capabilities is crucial for producing a meaningful invoice summary. To do this, create a generative AI skill by clicking the “+” button in the flow diagram and selecting “Generative Prompt.”
Next, you need to incorporate the input variables that were defined during the document extraction step. These variables contain the key data points extracted from the invoice. Use these as inputs for the generative AI skill to ensure it has the necessary information to work with.
Then, craft a clear and relevant user prompt that guides the generative AI to produce a meaningful and accurate invoice summary. This prompt should instruct the AI on how to interpret the extracted data and what kind of summary is expected—whether it’s a concise overview, detailed breakdown, or highlighting specific insights.
By combining well-defined input variables with a thoughtfully designed prompt, the generative AI can create a summary that adds real value and clarity to the invoice data.
Data mapping between components
Next step is to perform data mapping between components.Click on the document extract and then edit data mapping
Select the “Value” option, which corresponds to the uploaded file received from the User Activity component. This ensures that the generative AI skill uses the actual document provided by the user as input, allowing it to process and analyse the content effectively. By linking the “Value” from the User Activity, you enable the workflow to access the specific file uploaded during the interaction, making the subsequent extraction and summarisation steps accurate and tailored to the user’s data.
Similarly, click on the Generative Prompt and then select Edit Data Mapping. Here, you’ll see all the variables created for the generative prompt. By default, the Auto Map option is enabled, which automatically maps the variables for you, streamlining the integration process.
Steps to add “ send an email” tool to the flow
Once the summary is generated, the next step is to send the details to the customer as a reminder. To do this, add the Outlook skill. Before using it, make sure to connect the skill
Click on the “+” symbol to add a new component. Navigate to the Tools tab, where you can browse or search for available tools. In the search bar, type “Send Email in Outlook” to quickly locate the tool designed for sending emails via Outlook. Once you find it, select the tool to add it to your workflow.
Once the Send Email in Outlook tool is added to your workflow, the next step is to perform data mapping. This involves linking the relevant variables and inputs from your flow to the tool’s required fields, such as the recipient’s email address, subject line, email body, and any attachments.
To begin this process, click on the “Edit Data Mapping” option. This will open a mapping interface where you can assign values to each field.
To use the generated response from the Generative Prompt as the email body, click on the text box within the data mapping section for the email body field. Then, select the Generative Prompt from the list of available components. This will map the AI-generated summary directly into the body of the email.
Additionally, users can map other components—such as the recipient's email address, subject line, or attachments—by selecting the corresponding variables or outputs from earlier steps in the workflow. This allows for a fully customized and dynamic email setup based on the data collected and processed throughout the flow.
Before the actual deployment of the agent to public we can verify the preview.For that provide a suitable phrase to invoke the agent
Once the user uploads the invoice file, the agent automatically initiates the document processing workflow. It begins by reading the contents of the file using the Document Extractor, which identifies and extracts key information such as invoice number, dates, line items, total amount, taxes, and vendor details.This extracted data is then passed to the Generative AI component, which interprets the information and generates a clear, concise, and meaningful invoice summary. The summary may include insights such as payment status, due dates, total payable amount, and any anomalies or noteworthy items.This end-to-end process is designed to reduce manual effort, improve accuracy, and deliver fast, actionable insights directly from the uploaded invoice document.

Next, instruct the agent to send the invoice summary to the stakeholders via email. Enter an appropriate message or subject line, then click "Send" to dispatch the email.
Sample of the generated email
Advantages of using this workflow
-
Automates manual tasks like data entry, validation, and categorization.
-
Speeds up the end-to-end invoice lifecycle—from receipt to payment.
-
Enhances accuracy in capturing invoice details (dates, amounts, numbers).
-
Cuts down on labor costs associated with manual invoice handling.
-
Easily handles high volumes of invoices, especially during peak business periods.
I would encourage you to explore other functionalities in Agentic AI/Watsonx Orchestrate to get a better understanding of how you can leverage these features to better fit your business needs.
More information about loops can be found here:
https://www.ibm.com/docs/en/watsonx/watson-orchestrate/base?topic=agents-creating
Acknowledgement:
I’d like to thank Dennis Parrot , Justin Wang for their insights and support during the development of this blog. Their expertise helped to shape the direction and depth of the article.