Indent to Purchase Order (PO) Enterprise Agent

Indent to Purchase Order (PO) Enterprise Agent

Indent to Purchase Order (PO) Enterprise Agent

Transforming manual multi-page procurement document processing into a stateful, human-in-the-loop agentic pipeline powered by LangGraph, AWS Bedrock Claude Vision, and Celery. 

Overview

In enterprise procurement and supply chain operations, organizations handle thousands of vendor communications monthly, ranging from complex multi-page quotation PDFs to billing invoices and purchase orders. These unstructured documents arrive via email and must be manually read, cross-referenced against internal ERP systems (Indents, Requests for Quotations), and entered financial databases for review and approval. 

Manual data entry and traditional OCR scripts created massive operational bottlenecks. Standard OCR tools struggled to parse non-standard vendor layouts, multi-page financial tables, and varying terminology. Processing a single 40-page quotation document required up to 45 minutes of manual effort, leading to slow purchase order turnaround times, data entry errors, and high operational overhead. 

To solve this challenge, we architected and built the Enterprise Agentic AI Platform—a 4-agent stateful automation system (Quotation Extraction, Billing Ingestion, 3-Way Matching, and Purchase Billing). Powered by LangGraph, AWS Bedrock Claude Vision, and Celery/Redis background task queues, Customer converts multi-page vendor documents into structured, verified ERP records in under 15–30 seconds, complete with persistent human-in-the-loop checkpointing and a real-time audit trail.

Challenges 

Business Challenges

  1. Manual Data Entry Bottlenecks: Processing complex vendor documents manually took up to 45 minutes per document, delaying procurement cycles and purchase order issuances.
  2. ERP Disconnect & Misaligned Item Mapping: Cross-referencing vendor quotation items against internal ERP Indents and RFQs was error-prone, causing misquoted rates and incorrect supplier assignments. 
  3. Financial Risk & Lack of Governance: Ingesting financial data directly without human verification introduced risks of overpayment, incorrect tax entries, or processing duplicate invoices.

Technical Challenges

  1. High Latency & Web Server Timeouts: Multi-page LLM Vision extraction takes 5 to 15 seconds. Running this synchronously in FastAPI blocked web worker threads and caused HTTP gateway timeouts under concurrent user load. 
  2. Loss of Table Structure in Multi-Page Documents: Traditional text OCR fails to preserve spatial relationships across multi-page financial tables, leading to scrambled unit rates and quantities. 
  3. State Loss Across Interrupts: Implementing a Human-in-the-Loop approval process required halting the workflow midway (interrupt_before=["db_ingest"]). Standard memory-backed state graphs lost progress whenever background processes or containers restarted. 

Solution 

The platform introduces five core capabilities designed around operational efficiency and data integrity.

  1. Asynchronous Event-Driven Architecture (Celery + Redis)
    What It Enabled
    Offloaded heavy PDF rendering (PyMuPDF) and LLM vision inference to background Celery workers. 
    FastAPI responds instantly with a task ID, keeping the UI fast and preventing server thread blocking under heavy load. 
  2. Vision-Driven Multimodal Data Extraction (AWS Bedrock Claude Haiku)
    What It Enabled 
    Converted PDF pages into 150 PPI JPEGs and passed them directly to AWS Bedrock Claude Haiku Vision. 
    This enabled accurate visual reading of multi-page tables, headers, and supplier terms without relying on fragile OCR bounding boxes. 
  3. Persistent Human-in-the-Loop Checkpointing (LangGraph + Postgres) 
    What It Enabled
    Graph execution automatically halts prior to database insertion. 
    The exact graph state is serialized as a binary snapshot in PostgreSQL via PostgresSaver. 
    This allows reviewers to examine extracted data on the dashboard and click "Resume / Approve" to trigger database ingestion safely. 
  4. Real-Time Audit Timeline & Embedded Document Viewer (React Dashboard)
    What It Enabled
    Features a dark glassmorphism dashboard built with React and TypeScript. 
    Reviewers can watch a real-time audit log timeline populate step-by-step while inspecting the original PDF directly in an embedded iframe. 

Impact Created

Qualitative & Quantitative Outcomes

  • 99.4% Reduction in Processing Time
    Document extraction time reduced from 45 minutes per document to under 15 seconds
  • 100% Financial Governance & Auditability 
    Zero unverified data ingested. Every single execution step is tracked in audit_logs and held at a human-in-the-loop checkpoint.
  • Zero Web Server Thread Blocking 
    100% of LLM processing runs asynchronously via Celery, keeping FastAPI web endpoints responsive at <100ms.
  • Seamless State Resilience
    Workflows paused at interrupt_before survive container restarts without data loss thanks to Postgres. 

Transformation Snapshot 

FeatureBefore (Manual / Legacy OCR)After (ADE – Agentic Document Extraction ) 
Workflow Ingestion Manual PDF reading and manual data entry into the system. Automated ingestion of emails and attached PDFs via Celery task queues, with minimal human intervention.
Extraction EngineRigid, regex- and template-based OCR pipelines that break when document layouts change.Multimodal LLM vision model (Claude Haiku) that understands document structure and content more flexibly, handling varied layouts and formats. 
Processing DurationAround 30–45 minutes per document due to manual steps and slow, brittle OCR flows.Roughly 3–15 seconds per document end-to-end, thanks to automated pipelines and LLM-based extraction. 
ERP Item Resolution Manual lookup of indents, RFQs, and other ERP entities; high chance of human error and inconsistency. Automated foreign-key resolution with fuzzy matching against ERP records, reducing manual lookups and improving accuracy.
Approval ControlErrors were typically caught post-entry, requiring manual correction and rework after data was already in the system.Stateful human-in-the-loop control: the workflow can pause for human review/approval and resume with a single click, preserving context.
AuditabilityAudit trail was either paper-based or incomplete/missing logs, making tracing decisions and changes difficult.Real-time, structured timeline of actions stored in audit_logs, giving clear visibility into who did what and when.
Document ViewingUsers had to switch between a separate PDF reader and the ERP interface, causing context switching and inefficiency.Integrated UI with an iframe that streams documents directly from MinIO within the same interface, keeping everything in one place. 

 

Conclusion

The Enterprise Agentic AI Platform demonstrates that enterprise document processing is no longer about rigid OCR templates or fragile regex rules. 

By coupling stateful agentic orchestration (LangGraph) with vision-capable LLMs and asynchronous worker queues, organizations can achieve full automation while maintaining total human oversight and enterprise governance. 

"Customer replaces slow, error-prone manual document entry with stateful, intelligent Agentic document extraction delivering 15-second processing accuracy and total financial auditability at penny-level operating costs."