# Invoice Audit Extractor

> Extract invoices from PDFs and phone photos, Arabic included (١٢٣ numerals, RTL), audit every total with deterministic rules, and export JSON, CSV, Excel + report. Degraded photos are rejected with a request for a clearer shot, never guessed.

Invoice Audit Extractor is a free AI agent skill on Agensi by Mohamed Elsayed, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Mohamed Elsayed](https://www.agensi.io/creators/mohamed-elsayed)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-26
- Security: scan passed (2026-11-26); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/invoice-audit-extractor
- Tags: llm-ops, python, ocr, accounting, data-extraction

## About this skill

### The problem

Invoice tools fall into two camps: extractors that trust whatever the model reads (and silently invent numbers when the photo is bad), and checkers that only work if you already typed the invoice into text. If your invoices are photos, scans, or in Arabic, neither camp helps.

### What this skill does

- **Extracts** invoice number, dates, seller, buyer, currency, line items (qty, unit price, discount, tax rate, line total), subtotal, discounts, tax, grand total.
- **Inputs:** PDF, JPG, PNG, TIFF, HEIC. Phone photos, scans, multi-page documents. Arabic, English, French — Western (123) and Arabic-Indic (١٢٣) numerals.
- **Audits the arithmetic** with deterministic rules: line sums, discount-netted lines, tax = stated rate × subtotal, subtotal + tax = grand total, batch duplicate detection, past-due and missing-field flags.
- **Outputs:** JSON + CSV + formatted Excel + a short report per document. Bank identifiers are masked in every report.
- **Refuses to guess:** unreadable fields come back empty and flagged; a document that fails the audit is marked REVIEW/FAIL with the exact arithmetic, and you're asked for a clearer photo.

### Measured results (test corpus, November 2026)

Tested on 26 documents in 3 rounds: synthetic templates, 7 real public invoices from open datasets, and 5 independent Arabic invoices including phone-photo and stamped scans.

- **100% field accuracy** on every legible document (79/79 fields on the Arabic set).
- **0 invented numbers** across all 26 documents — unreadable values were flagged, never fabricated.
- Caught **5/5 deliberately seeded errors**, plus **2 real-world errors** found in public invoices (a printed total 0.38 off; an unprinted 0.25 rounding gap).
- One heavily blurred, stamp-covered photo scored 40% — and the audit caught the inconsistency and rejected the document instead of passing it. That is the product working as designed.

### Why not just prompt an AI?

Because a plain prompt can't tell you when it's guessing. This skill pairs extraction with a deterministic audit script (line math, tax-rate math, discount math, duplicates) that doesn't care how confident the model sounds — the numbers either reconcile or the document is flagged.

### Use cases

- Check a supplier invoice before paying it.
- Turn a month of receipt photos into a clean Excel ledger.
- Verify your own invoice before sending it to a client.
- Process Arabic invoices that other extractors can't read.

### Known limitations (read before buying)

- Heavily degraded photos (motion blur, stamps over the numbers) are rejected, not read.
- Handwritten invoices work but expect more REVIEW verdicts.
- Multi-currency in one document is flagged, not converted.
- The audit checks arithmetic and completeness. It does not verify that a tax ID is registered or that goods were delivered.
- Judging "vague payment terms" is advisory only, not a deterministic check.

### Planned (not in v1 — listed for transparency)

PO matching (2-way/3-way), accounting exports (Xero/QuickBooks), batch folder organization.

Languages: tested on Arabic and English invoices (photos, scans, PDFs).

## Requires

- Python

## Known limitations

Handwritten receipts have lower accuracy. Heavily blurred images will trigger a review request. Does not verify external data like tax ID registrations or bank account status.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Invoice Audit Extractor skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill prevent the mathematical 'hallucinations' common in standard AI prompts?

The skill extracts line-item data into JSON, then runs a deterministic Python audit to verify that the math (quantity × price + tax) matches the printed total, flagging any discrepancies for your review.

### What document formats can I upload for extraction?

The skill supports PDF, PNG, JPG, and HEIC files, making it compatible with everything from professional digital invoices to mobile photos of paper receipts.

### Does the Invoice Audit Extractor handle international invoices or different numeral systems?

Yes, it supports English, French, and Arabic documents, including the ability to normalize Arabic-Indic numerals into standard digital formats for your spreadsheets.

### What assets are included in the skill package?

You will receive the core extraction logic, the `validate_invoice.py` script for arithmetic auditing, and the `export_invoice.py` utility for generating CSV and Excel reports.

### Are there any specific technical dependencies required to run the export scripts?

This skill requires Python 3.9 or higher and the `openpyxl` library if you intend to export data directly to Excel format.

### Can the skill accurately read handwritten receipts?

While the skill is highly accurate with printed text, it is not optimized for handwritten notes; blurred or handwritten fields will be flagged as 'null' to ensure you don't process inaccurate data.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
