An internal tool that learns vendor patterns, categorizes transactions, and generates ready-to-import Excel summaries—all through natural conversation.
The Problem
Every month, our accounting team faced the same grind: dozens of credit card statements from Amex, Stripe, and various PDF sources, each containing hundreds of transactions that needed manual GL code assignment and allocation across three internal companies.
The process took 8–12 hours monthly. It required deep institutional knowledge, produced inconsistent results between different team members, and delayed month-end close.
We tried using off-the-shelf LLM platforms to speed things up, but the results were spotty—inconsistent categorizations, no memory of past decisions, and enough manual correction that it barely saved time over doing it by hand.
We built a system to fix this.
What It Does
The tool converts unstructured credit card statements into categorized, allocated, export-ready data. Upload a file, have a conversation, download a professional Excel summary.

The core workflow:
- Extract — Parse Excel or PDF into standardized transaction records
- Categorize — Match vendors to GL codes using saved patterns or AI
- Aggregate — Collect totals by category, apply credits to offset their respective categories, and format distribution across a set number of entities
- Export — Generate formatted Excel with company columns and totals

The Categorization Engine
This is where the real value lives. The system uses a three-tier approach that gets smarter over time.
Tier 1: Pattern Matching (Instant)
A JSON-based “facts” database stores known vendor→GL mappings. When a transaction comes in, the system checks if the vendor matches any saved pattern. Case-insensitive substring matching, zero API cost, instant results.
After several months of use, 85%+ of transactions categorize without any AI calls.
Tier 2: LLM Classification (GPT-4o)
Unknown vendors go to GPT-4o, which analyzes vendor name and description, selects from 32 supported GL codes, and handles ambiguous merchants (Square payments, Google*, PayPal). Accuracy sits around 90% on first attempt.
Tier 3: Human Override
Users can correct any categorization through natural language:
“Change NETFLIX to Entertainment”
Every categorization is tagged with its source—[FACTS], [AI], or [MANUAL]—so reviewers always know how a decision was made.

The Learning Loop
The system improves with use. Here’s how institutional knowledge gets captured:
- AI categorizes a new vendor
- Staff reviews and approves (or corrects)
- User says “save facts”
- Pattern saved to database
- Next month → instant categorization

This creates a flywheel: the more you use it, the less AI you need.
Architecture
Built on LangChain’s ReAct agent pattern, the system dynamically decides which tools to use based on conversation context.

The agent has access to these tools:
| Tool | Purpose |
|---|---|
extract_transactions |
Parse Excel/PDF into transaction objects |
categorize_transactions |
Apply facts + AI to assign GL codes |
show_vendor_categories |
Display categorized vendors with sources |
save_facts |
Persist approved patterns |
generate_summary |
Create formatted Excel export |
Users interact through natural language. The agent figures out which tools to call and in what order.

The Output
The final Excel summary includes:
- Entity split columns — Configurable company distribution with calculated amounts
- All GL codes listed — Even unused ones show “–” for consistency
- Color formatting — Yellow totals, blue amounts, gray headers
- Optional detail sheet — Full transaction list with dates, vendors, amounts

Results
| Metric | Before | After |
|---|---|---|
| Monthly processing time | 8–12 hours | ~2 hours |
| Categorization consistency | Variable | Standardized |
| Knowledge retention | In people’s heads | Explicit in facts.json |
| Month-end delay | Common | Eliminated |
The 80% time reduction is real. But the bigger win is consistency—every transaction follows the same logic, and that logic is visible and correctable.
Example Session
Here’s what a typical workflow looks like:

Total time: 5 minutes.
Takeaway
This project demonstrates something important about practical AI tooling: the goal isn’t to replace human judgment, it’s to accelerate the work that our employees can do while cutting out the monotony.
When the tedious parts disappear, people can focus on the work that actually requires their expertise. That’s not just automation—that’s leverage.
Built with Python, Flask, LangChain/LangGraph, and GPT-4o. Internal tool—not publicly available.
