An automated, intelligent pipeline built with the Google Agent Development Kit (ADK) to audit legal and professional services invoices for contract compliance and financial accuracy.
In the legal sector, reviewing vendor invoices is a high-stakes, manual process. Law firms and corporations must cross-reference hundreds of line items against complex External Client/Contract Rules and Internal Financial Controls.
- Cost Leakage: High error rates lead to overpayment on capped tasks or inflated rates.
- Time Consumption: Analysts spend hours cross-referencing PDFs with static databases.
- Client Trust: Disputes over non-compliant billing delay payments and damage relationships.
Traditional rule-based systems struggle with the unstructured text in invoice descriptions. AI Agents can interpret the context of a line item (e.g., distinguishing a "Dinner Expense" from a "Travel Expense") while applying deterministic financial logic.
The system utilizes a Sequential Multi-Agent Pipeline. Each agent is a specialist, ensuring that reasoning is decoupled from data extraction and deterministic calculations.
- Intake Agent (Data Formatting): Standardizes raw, unstructured invoice data (JSON/PDF) into a consistent schema.
- Classification Agent (Data Mapping): Maps task descriptions to internal client codes and compliance categories.
- Compliance Agent (Core Tool-User): The "engine" of the audit. It executes tool calls to verify data against external rules.
- Output Agent (Reporting & Synthesis): Translates technical violations into a professional, actionable summary for financial approvers.
- Core AI Engine: Google Gemini 1.5 Flash (optimized for reasoning and function calling).
- Framework: Google Agent Development Kit (ADK) /
google-generativeaiSDK. - UI/Deployment: Streamlit & Ngrok.
- Logic Layer: Custom Python Tools for deterministic auditing.
| Tool Name | Type | Function |
|---|---|---|
rules_engine_tool |
Python Function | Validates billed hours against contract-defined maximums. |
billing_data_tool |
Python Function | Compares billed rates against standard role-based rate cards. |
The solution features a live Web UI where users can upload invoice data and receive an instant audit report.
The agent identifies a Junior Associate billing 15 hours (limit: 10) at $350/hr (limit: $200).
- Compliance Output:
CRITICAL ERROR: Billed time exceeds max by 5.0 hours. - Recommendation:
REJECT/REVIEW - Adjust rate to $200 and investigate overage.