- Home
- Skills
- APIs & Backend
- ap invoice agent
Works with the AI Agents you already use
ap invoice agent
Extract, validate, and match supplier invoices with deterministic OCR, arithmetic checks, and audit-ready routing.
$12
ap invoice agent
Example session with this skill installed
Process batch-2024-05-12 containing invoice_001.pdf and match it against our supplier master and open PO list. Ensure all line items are validated for arithmetic.
- Read your context and instructions
- Compiled the ap invoice agent
Batch processing for 'batch-2024-05-12' is complete. 'invoice_001.pdf' was routed to HUMAN_REVIEW due to a price variance, while all other documents reached COMPLETED status.
Bill Record: invoice_001.json
{
"document_identity": {
"batch_id": "batch-2024-05-12",
"document_id": "doc-8f2e1a",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"workflow_status": "HUMAN_REVIEW",
"review_reasons": ["UNIT_PRICE_VARIANCE_EXCEEDS_TOLERANCE"],
"extracted_fields": [
{
"field_name": "total_amount",
"raw_value": "1,250.00",
"normalized_value": "1250.00",
"confidence": 98.5,
"evidence_references": ["ev-9921"]
},
{
"field_name": "invoice_date",
"raw_value": "May 10, 2024",
"normalized_value": "2024-05-10",
"confidence": 95.0,
"evidence_references": ["ev-9922"]
}
],
"line_items": [
{
"line_number": 1,
"description": "Widget Type A",
"quantity": 10,
"unit_price": "125.00",
"amount": "1250.00"
}
],
"validation_checks": {
"line_items_subtotal_match": "PASSED",
"invoice_total_match": "PASSED",
"po_matching": {
"status": "FAILED",
"reason": "Unit price 125.00 exceeds PO price 115.00"
}
},
"audit_trail": [
{"event": "INTAKE_COMPLETE", "timestamp": "2024-05-12T10:00:01Z"},
{"event": "OCR_SUCCESS", "engine": "PaddleOCR", "confidence": 92.4}
]
}
Next steps
- Open the review interface to resolve the
UNIT_PRICE_VARIANCE_EXCEEDS_TOLERANCEon doc-8f2e1a. - Run
scripts/check_bill_record.pyto verify the integrity of the generated JSON files. - Update the supplier master if the price variance in invoice_001.pdf reflects a negotiated change.
Connects securely to your tools. The creator never sees your data.
About this skill
Manual invoice entry is slow and prone to errors that cost companies thousands in overpayments. This skill transforms raw PDFs and images into structured, audit-ready bill records using a deterministic pipeline that prioritizes evidence over guesswork.
What it does
- Multi-stage processing runs intake, preprocessing, OCR, extraction, validation, and matching in a strict sequence.
- Deterministic extraction uses labels, regex, and coordinate-based evidence to pull header fields and line items.
- Financial validation executes eight exact-decimal arithmetic checks on subtotals, taxes, shipping, and grand totals.
- Reference matching performs two-way or three-way matching against supplier master data, purchase orders, and goods receipts.
- Fail-closed routing automatically sends invoices to human review if any confidence threshold, business rule, or arithmetic check fails.
- Audit trail generation records every candidate, check, and correction in an append-only log for full traceability.
How it works
- Intake and Clean reads files, validates magic bytes, computes SHA-256 hashes, and applies image preprocessing like deskewing and denoising.
- OCR and Extract runs primary and fallback engines to build tokens and lines, then scores candidates based on visual evidence.
- Validate and Match runs financial integrity checks and matches data against provided PO and supplier records.
- Route or Review finalizes the bill record or routes to a human operator with specific reason codes for every discrepancy.
Frameworks & tools
This skill is built for Python 3.11+ environments. It utilizes OpenCV for image manipulation, PaddleOCR and Tesseract 5 for text extraction, and PostgreSQL for state management. It requires a PDF rasterizer and supports exact-decimal arithmetic libraries.
Why this beats prompting it yourself
Prompting alone often leads to "hallucinated" totals and inconsistent data structures. This skill uses a multi-engine fallback strategy and strict arithmetic gates to ensure that every value returned is backed by physical coordinates on the document. It prevents silent errors by failing to a human reviewer rather than guessing missing values.
Use cases
- AP automation building a high-volume intake pipeline for supplier bills.
- Audit preparation creating a traceable record of every extraction and manual correction.
- Discrepancy detection flagging price variances between invoices and purchase orders.
- Batch scanning processing 1000s of legacy invoice images into a unified JSON format.
Known limitations
Does not support executing payments or posting directly to ERPs. Not for receipts or bank statements. Indian number grouping and credit notes require custom logic. Primary implementation is Python-based.
Python 3.11+ required. Does not support payments or ERP posting. Unverified for credit notes and Indian number grouping. Restricted to USD, GBP, and EUR by default.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 17 days ago
Requires
Permissions
Allowed Hosts