惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
有赞技术团队
有赞技术团队
量子位
N
Netflix TechBlog - Medium
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
V2EX
IT之家
IT之家
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK
From manual to automated: Building AI agents for procurem...
Nick Winder · 2025-08-22 · via Inside Nutrient

Is your team drowning in procurement documents? Purchase orders, invoices, receipts, payments — hundreds of them flow through your system daily. Hours are spent manually matching invoices to purchase orders, chasing missing payments, and flagging exceptions.

What if an AI agent could handle 70 percent of this work automatically, surfacing only the problematic documents that actually need human attention? That’s exactly what this post will explore using a procurement example.

TL;DR

AI agents can automate document processing through classification, data extraction, and three-way matching — while intelligently flagging exceptions for human review.

The procurement document matching problem

Procurement can follow many different processes, but this example will use a three-way matching process with the following document requirements:

  • Purchase order (PO) — What was ordered
  • Invoice — The amount the vendor is charging
  • Payment — What was paid

Once an order is complete, all these documents should be present, and all the values must match. But things often go awry, and it takes human time to chase down vendors and buyers to sort out messes.

It’s easy to see how this process breaks down quickly:

  • Documents arrive in different formats and layouts.
  • Reference numbers might be missing or inconsistent.
  • Amounts can vary due to shipping, taxes, or discounts.
  • Emergency purchases bypass normal PO processes.
  • Partial shipments create incomplete document sets.

Humans are great at spotting these patterns, but it’s time-consuming and error-prone at scale.

Enter AI agents with document processing superpowers

By combining AI agents with document processing tools, it’s possible to automate most of this workflow while preserving human oversight for the tricky cases. For simple workflows that follow the correct procedure, a human shouldn’t have to be involved. Matches are made, and costs are checked and flagged as complete. If not, then call the human.

The AI agent approach uses a three-stage pipeline:

  1. Upload and classification — AI determines a document type and extracts key data
  2. Three-way matching — With the extracted data, traditional programming logic matches related documents
  3. Exception handling — Surface discrepancies in documents and data for human review

All this can be made simple using any AI agent framework combined with Nutrient Document Engine MCP Server(opens in a new tab).

In the following sections, I’ll share an example of how to build an AI agent for procurement document processing using Nutrient Document Engine MCP Server and LangGraph.js(opens in a new tab). If you want to see the full example, you can find it in the examples section of Nutrient Document Engine MCP Server(opens in a new tab).

Stage 1: AI-powered document classification

To implement a classification AI agent, you need to read the content of a document. The first challenge you’ll hit is that documents can come in a variety of formats: PDFs, Office documents, and even images. At Nutrient, we want to take that worry off your hands and abstract file types away from your workflow. All you need is to use the extraction functions provided by the Document Engine MCP Server for your AI Agent.

Using the LangGraph.js(opens in a new tab) agent framework, connect to the Document Engine MCP Server, filter for the exact tools required for classification, and create a ReAct agent with the following:

// Create the client to connect to Document Engine MCP Server.

const mcpClient = new MultiServerMCPClient({

mcpServers: {

documentEngine: {

transport: "http",

url: "http://localhost:5100/mcp",

},

},

});

// Filter for the extraction tools only.

const relevantTools = await mcpClient

.getTools()

.then((tools) =>

tools.filter(

(tool) =>

tool.name?.includes("extract_text") ||

tool.name?.includes("extract_tables") ||

tool.name?.includes("extract_key_value_pairs") ||

tool.name?.includes("extract_form_data"),

),

);

// Create the ReAct agent with the filtered tools and prompt.

const agent = createReactAgent({

llm: model,

tools: relevantTools,

prompt: CLASSIFICATION_PROMPT,

});

The AI agent operates in a ReAct loop: It thinks about what to do, uses tools to extract information, observes the results, and repeats until it can confidently classify the document.

For example, with an invoice, it might:

  1. Extract text to find the word “Invoice” or “Bill.”
  2. Look for structured data like invoice numbers and amounts.
  3. Check for PO references that link to other documents.
  4. Analyze the layout to confirm document type.

In the full example, I ask the model to extract some information about the document and then request structured parsing to retrieve a JSON output like the following:

{

"type": "invoice",

"confidence": 0.95,

"extractedData": {

"invoiceNumber": "INV-2024-0156",

"poReference": "PO-2024-001",

"vendor": "ACME Office Supplies Inc.",

"amount": 17292.4,

"date": "2024-01-15"

}

}

The beauty of using an AI agent here is the adaptability. If all your documents used the exact same template, you could use heuristics to parse the document. But as I mentioned earlier, the documents you receive may not be in a single format, and even if they are, they may not display the information in a common format. AI agents can adapt to these variances and reactively extract data from structures they’ve never seen before.

Stage 2: Intelligent three-way matching

Once documents are classified and data is extracted, the matching logic kicks in. This is where we shift from AI reasoning back to traditional programming — because matching rules are well-defined business logic.

The system uses a two-tier matching strategy, outlined below.

Strategy 1: Reference number matching

// Match by exact reference numbers (most reliable).

for (const po of purchaseOrders) {

const relatedInvoices = invoices.filter(

(inv) => inv.extractedData.poReference === po.extractedData.poNumber,

);

const relatedPayments = payments.filter(

(pay) =>

pay.extractedData.invoiceReference ===

relatedInvoices[0]?.extractedData.invoiceNumber,

);

if (relatedInvoices.length && relatedPayments.length) {

// Perfect three-way match found.

groups.push({

po,

invoice: relatedInvoices[0],

payment: relatedPayments[0],

});

}

}

Strategy 2: Vendor and amount matching

Here’s an example of matching invoices and purchase orders:

// Fall back to vendor + amount matching with some hysteresis.

const matchingInvoices = invoices.filter(

(inv) =>

inv.extractedData.vendor === po.extractedData.vendor &&

Math.abs(inv.extractedData.amount - po.extractedData.amount) < 100, // Allow small variances

);

This applies to basic matching and works most of the time, but I’m sure there’s better business logic you could apply for your company!

Stage 3: Exception handling that actually helps

Here’s a super useful area where you can help initiate action more quickly. Because the matching logic defines what information is missing, it’s possible to provide actionable advice back to the user.

Using the example dataset in the Document Engine MCP Server repository, you’ll end up with the following situations:

Complete Match (70% of cases):

- PO-2024-001 → INV-2024-0156 → PAY-2024-0089

- All reference numbers align, amounts match (within tolerance)

- Status: ✅ No action needed

Emergency Purchase (Orphan Invoice):

- Emergency HVAC repair: $3,572.25

- No PO (after-hours emergency)

- Status: ❌ Urgent review needed

- Suggestion: "Create retroactive PO for emergency repair"

Partial Shipment:

- PO for 500 bearings → Invoice for 300 bearings

- Amounts: $12,781.25 vs $7,490.62

- Status: ⚠️ Partial delivery

- Suggestion: "Awaiting remaining 200 bearings"

The system surfaces exactly what information is missing and suggests what the next steps are. You could even take the agentic design a step further and perform those actions with AI if you have the right tools connected!

Conclusion

AI agents won’t replace your finance team, but they will transform how they work. By automating much of the manual document processing, your team can focus on the small percentage of problematic cases that actually require human judgment.

The procurement example shows a clear path forward: Start with document classification, add intelligent matching, and design thoughtful exception handling. The result is a system that works with your team, not against them.

Want to try it yourself? The complete example is available in the Nutrient Document Engine procurement example(opens in a new tab) — with sample documents, classification logic, and matching algorithms all ready for you to copy.