VOOZH about

URL: https://dev.to/henimohamed/building-a-multi-agent-tax-audit-system-with-langgraph-and-odoo-2a06

⇱ Building a Multi-Agent Tax Audit System with LangGraph and Odoo - DEV Community


TL;DR: I built a multi-agent system that audits invoices, detects fiscal inconsistencies, and generates compliance reports — integrated with Odoo ERP and standalone databases.

The Problem

Tax auditing for small and medium businesses in Tunisia is manual, error-prone, and slow. Most accounting firms rely on Excel and manual checks. Regulations change frequently, and keeping up is a full-time job.

I wanted to build something that could ingest financial data, run audit rules automatically, and produce compliance reports — without needing a team of accountants.

The Architecture

The system uses a LangGraph-based multi-agent architecture:

Agent 1: Data Ingestion Agent

  • Connects to Odoo ERP or standalone SQL databases
  • Extracts invoices, ledgers, and financial statements
  • Normalizes data into a unified schema

Agent 2: Audit Agent

  • Applies tax rules against the data
  • Detects anomalies: missing invoices, misclassified expenses, VAT discrepancies
  • Flags items for human review

Agent 3: Reporting Agent

  • Generates compliance reports
  • Produces a summary of findings with risk levels
  • Suggests corrective actions

Orchestrator

  • LangGraph manages the flow between agents
  • Handles state, retries, and error recovery

Technical Challenges

Schema Mismatch: Every Odoo instance is customized differently. The ingestion agent had to handle dynamic schemas — detecting table structures at runtime and mapping them to a canonical audit model.

Multi-Agent Coordination: Getting three agents to work together without stepping on each other's state was the hardest part. LangGraph's checkpointing was essential here.

Regional Tax Rules: Tunisian tax law isn't well-documented in English. Building the rules engine meant working directly with Arabic and French regulatory texts.

What's Next

  • Real-time invoice validation
  • Multi-company support
  • A dashboard for non-technical accountants

The repo is at github.com/HENI-MOHAMED/Audit-Agent.


Built with Python, FastAPI, LangGraph, Odoo, and a lot of coffee.