Back to Blog
Automation

We Automated Our Client's Entire Invoice Workflow with an AI Agent — Here's Exactly How We Built It

Georgi NikolovFebruary 21, 202612 min read
Share:

You're Paying a Human to Move Files

Let that sink in.

Every week, somewhere in your business, a smart person is opening emails, downloading PDFs, renaming files, and dragging them into folders. They're not making decisions. They're not building relationships. They're moving files.

That's not a workflow. That's a tax on your business.

We built an AI agent for a client that eliminated this entirely. Here's exactly how it works — and why it matters for every business running on manual processes.


The Before: 4 Hours Every Week, Gone

Our client had a simple but brutal problem.

Invoices arrived all week in a Microsoft 365 inbox — scattered across dozens of emails. Some were expenses. Some were income. Some were buried in email threads with zero context.

Every Friday, someone had to:

  • Open every email manually
  • Identify which ones actually contained invoices
  • Download the attachments
  • Figure out what period they covered, who sent them, what type they were
  • Upload each one to the right Google Drive folder for the accountant
  • MetricManual ProcessAI Agent
    Time per week3–4 hours0 minutes
    Errors / missed invoicesCommonNear zero
    Accountant prep time2+ hours at month-endOpen Drive, done
    Cost per monthSignificant staff timeCents in compute

    By month-end, the accountant would still find mistakes. Wrong folders. Missing invoices. Inconsistent naming. The kind of errors that happen when humans do repetitive work under time pressure.

    This is the problem every business has. The solution is a workflow agent.


    The Idea: What If an Agent Just Handled All of It?

    Not a Zapier zap. Not a Robotic Process Automation script. Not a chatbot.

    An AI agent — one that reads, understands, decides, and acts. One that can handle an invoice it's never seen before from a vendor it doesn't recognise, because it reasons about what it's looking at, not just matches patterns.

    Here's what we built.

    The outcome: Every Monday morning, a scheduled agent wakes up, processes every invoice from the past week, and organises them into Google Drive — classified, named, and sorted by year, quarter, month, and type. The accountant opens Drive and everything is already there.

    What Workflow Agents Actually Are

    Most people hear "AI" and think chatbot. A chatbot answers questions. A workflow agent takes actions.

    A workflow agent is an AI system with three things:

  • A goal — Process invoices from Microsoft 365 and organise them in Google Drive
  • A set of tools — Capabilities it can call to interact with the real world
  • A reasoning core — An LLM that decides what to do, in what order, with what data
  • The agent doesn't wait to be asked. It executes. It connects to systems, reads data, makes decisions, and acts — all without human intervention.

    Why this is different from traditional automation: Zapier and RPA follow rigid if/then rules. They break when formats change or edge cases appear. A workflow agent uses an LLM to reason about what it's looking at — so it handles invoices it's never seen before, from new vendors, in unusual formats, with confidence.

    How Tools Give the Agent Its Powers

    Tools are the agent's hands. Each tool is a specific capability the agent can call — reading an email, analysing a document, uploading a file. The agent decides which tool to use, when to use it, and what to do with the result.

    Here's the exact tool chain we built:

    Microsoft 365 Inbox
    Email Reader Tool
    Invoice Detector Tool (Kimi K2)
    Classifier Tool (Kimi K2)
    Drive Uploader Tool
    Google Drive

    Let's walk through each one.

    Email Reader Tool

    Connects to Microsoft 365 via the Microsoft Graph API. Authenticates securely, scans the inbox for new emails since the last run, and returns structured data: subject line, email body, sender, and any attachments. The agent now has everything it needs to work with.

    Invoice Detector Tool

    Takes each email and sends it to Kimi K2 with a structured prompt: "Does this email contain an invoice? Return yes or no with confidence." The LLM analyses the subject, body, and attachment metadata — and filters out newsletters, meeting requests, and everything else. Only invoices proceed.

    Classifier Tool

    For every confirmed invoice, this tool sends the full document to Kimi K2 for structured data extraction. It returns: type (expense or income), vendor or client name, invoice amount, currency, invoice date, and the period it covers. Reliable. Consistent. Every run.

    Drive Uploader Tool

    Takes the classified invoice data and uploads the PDF to the correct path in Google Drive: `/{Year}/{Quarter}/{Month}/{Type}/{Filename}`. If the folder doesn't exist, it creates it. The file is named consistently: `{Date}_{Vendor}_{Amount}.pdf`.

    The key insight: No single tool is smart on its own. The intelligence lives in how the agent chains them together — deciding which emails to process, what to extract, where to put things. The LLM is the decision-maker. The tools are its execution layer.

    The Full Architecture

    Put it all together and here's what the agent does every Monday morning:

    Wake up on scheduleModal.com triggers the agent automatically every Monday at 7:00 AM
    Connect to Microsoft 365Authenticates via Microsoft Graph API, fetches all new emails since last Monday
    Detect invoicesSends each email to Kimi K2, filters to only those containing actual invoices
    Classify each invoiceExtracts type (expense/income), vendor, amount, date, and period covered
    Upload to Google DrivePlaces each invoice into the correct folder hierarchy, creating folders if needed
    Log resultsRecords what was processed, what was skipped, and flags anything that needs review

    No manual steps. No human in the loop. The accountant's only job is to open Google Drive at month-end.


    Choosing the Right Brain: Model Selection

    Before we built, we tested. The invoice detection and classification steps are where accuracy matters most — a misclassified invoice or a missed expense costs real money.

    We evaluated three models across a real dataset of invoices from the client's inbox.

    ModelInvoice Detection AccuracyStructured Output ReliabilityCost per 1M TokensVerdict
    Claude HaikuGoodReliableLowSlightly weaker on edge-case invoice formats
    Gemini FlashModerateInconsistent on messy PDFsVery lowStruggled with multilingual and scanned invoices
    Kimi K2ExcellentConsistent every timeVery lowWinner — best accuracy-to-cost ratio
    Why Kimi K2 won: After testing across a real invoice dataset — including scanned PDFs, multilingual invoices, and emails with confusing subject lines — Kimi K2 consistently outperformed. It detected edge-case invoices that Gemini Flash missed. It returned clean structured JSON every single time, without prompt engineering tricks. And it cost dramatically less than comparable alternatives. The decision was easy: best accuracy, lowest cost, zero fuss.

    This wasn't a promo decision. It was a data decision. We tested what mattered — real invoices, real edge cases, real structured outputs. Kimi K2 won on the metrics that mattered at production scale.

    The criteria we used:

  • Accuracy on real-world invoice detection — not synthetic benchmarks
  • Reliability of structured output — does it consistently return the JSON schema we defined?
  • Handling of edge cases — multilingual invoices, scanned PDFs, unusual formats
  • Cost at scale — this agent runs every week, processes hundreds of documents monthly

  • How Modal.com Runs It All

    The agent doesn't live on a server. It doesn't need one.

    Modal.com runs the entire agent as a scheduled serverless job. No infrastructure to manage. No servers to maintain. No ops overhead. The agent spins up at 7:00 AM every Monday, runs for a few minutes, and disappears.

    The scheduling is one line of configuration. The deployment is a single command. The monitoring is built in. If something fails, we know immediately.

    Zero infrastructure, zero maintenance: Modal.com handles compute allocation, cold starts, secret management, and logs automatically. We define what the agent does. Modal handles where and when it runs. This is how modern backend infrastructure should work.

    The economics are striking. The agent runs for a few minutes a week, processes a few hundred documents a month, and costs pennies. Compared to the hours of staff time it replaces, the ROI is immediate and obvious.


    The After: The Accountant Opens Google Drive

    Here's what changed for the client.

    The accountant opens Google Drive at month-end. Every invoice is there. Every one is named correctly. Every one is in the right folder — sorted by year, quarter, month, and type. Expenses here. Income there. Nothing missing. Nothing misfiled.

    The person who used to spend Friday afternoons moving files? They're doing something that actually matters.

    BeforeAfter
    3–4 hours of manual work every weekZero — fully automated
    Invoices missed or misfiledNear zero error rate
    Accountant prepares for hours at month-endOpens Drive, everything done
    Staff frustrated by repetitive tasksStaff focused on high-value work

    That's the outcome. Not "AI did something interesting." AI eliminated a real cost, freed a real person, and made a real accountant's job easier.


    What This Unlocks

    Here's the truth: every business has this problem. The names change. The systems change. But the pattern is always the same.

    A smart person doing repetitive work because no one has automated it yet.

  • Finance teams processing invoices manually
  • Sales teams copying leads from forms to CRMs
  • Operations teams moving data between systems that don't talk to each other
  • HR teams onboarding new hires by hand
  • Every one of these is an agent waiting to be built. An Email Reader Tool, a Classifier Tool, an Uploader Tool — and a scheduling layer that makes it happen automatically.

    The technology exists. The cost is negligible. The ROI is immediate.

    The only question is: which workflow do you want to automate first?


    Ready to Automate Your Workflows?

    At Noblerr, we build workflow agents that eliminate manual processes for businesses that have better things to do.

    If you have a repetitive workflow eating hours every week — invoice processing, lead management, data entry, report generation — we can build an agent that handles it automatically.

    Get in touch and tell us what you want to automate. We'll show you exactly what's possible.

    Tags:AI AgentInvoice AutomationMicrosoft 365Kimi K2Modal.comWorkflow Automation

    Georgi Nikolov

    Founder & CEO at Noblerr

    At Noblerr, we help businesses transform through technology, automation, and effective processes.

    Share this on LinkedIn

    We've prepared a ready-to-post version for you. Just click to copy!

    Let's Work Together

    Ready to implement the strategies discussed in this article? Contact us for a free consultation and see how we can help transform your business.

    Get in Touch