Inspiration

Our inspiration came from a simple observation: accounts receivable teams spend a significant amount of time handling repetitive email-driven workflows—processing invoices, validating purchase orders, responding to payment queries, and manually routing requests. These tasks are essential but often fragmented across emails, databases, and internal systems, making them time-consuming and prone to errors. We wanted to build a solution where AI could understand incoming requests, intelligently classify them, and trigger the right workflow automatically. By combining agentic AI, MCP, AWS services, and CockroachDB, our goal is to transform routine financial operations into a reliable, scalable, and context-aware system that reduces manual effort while improving accuracy and visibility.

What it does

We started with a simple question: what if finance teams didn’t have to manually figure out what every incoming email means and what to do next? Our system turns that idea into an automated workflow. Incoming emails are classified and routed into the right pipeline—invoice processing, helpdesk, or other requests. Invoice workflows extract structured information, detect duplicates, and validate purchase orders, while helpdesk requests can retrieve relevant information from CockroachDB and generate grounded responses. Instead of people jumping between emails, databases, and internal systems, the system connects these steps into one flow. The goal is simple: let humans handle decisions that actually need humans.

How we built it

We built the system around an agentic workflow where each stage has a clear responsibility instead of trying to make one model do everything. Emails enter through a common ingestion layer and are classified before being routed to specialized pipelines. Invoice processing combines document extraction, structured data handling, duplicate detection, and PO validation. For helpdesk queries, MCP provides a controlled interface for accessing relevant data from CockroachDB, allowing the agent to retrieve context before responding. CockroachDB became the foundation for our transactional and relational data, giving us strong consistency while supporting distributed workloads. AWS services connect the workers, queues, and processing stages into the overall system.

Challenges we ran into

The hardest part wasn’t getting the individual components to work—it was making them work safely together. Early on, we discovered how a seemingly harmless work ID could potentially be reused by someone other than the original sender. That forced us to rethink our routing logic and verify both the invoice reference and the sender before creating a helpdesk workflow. We also had to think about duplicate processing, worker failures, queue behavior, and what happens when an email doesn’t fit neatly into a category. These edge cases taught us that automation isn’t just about making things faster; it has to be predictable, secure, and recoverable.

Accomplishments that we're proud of

What we’re most proud of is that we didn’t stop at building a demo that moves data from one box to another. We built a complete workflow around a real operational problem. The system can take an unstructured email, determine the appropriate path, process invoices through multiple validation stages, and use database context to support helpdesk responses. We also deliberately focused on correctness—using CockroachDB for reliable transactional state, MCP for governed agent access, and verification checks to prevent unauthorized invoice lookups. Most importantly, the project gave us a foundation we can continue improving with better classification, observability, retries, testing, and intelligent fallback mechanisms.

What we learned

Building this project taught us that reliable automation is much harder than simply connecting an LLM to a database. The most important decisions often happen around the edges—what happens when an email is ambiguous, when the same request arrives twice, when a worker fails halfway through, or when a user tries to access information they shouldn’t. We learned to treat data consistency, security, and failure recovery as first-class parts of an AI system. CockroachDB also showed us how distributed SQL can provide a strong foundation for agentic workflows. Most importantly, we learned that good automation should know when to act, when to verify, and when to ask for help.

What's next for GAG_ka_RAG

We see this hackathon as the beginning rather than the finish line. Our next step is to make the system more resilient and intelligent without sacrificing the control we have built into it. We want to introduce an LLM-assisted fallback for emails that don’t fit deterministic rules, while keeping verification checks around sensitive actions. We also plan to add stronger observability, retries with backoff, dead-letter queues, idempotency, automated tests, and better visibility into the “other” queue. As the system matures, we want to move toward a fully production-ready platform where finance teams can trust agents to handle routine operations while humans focus on the exceptions that genuinely require their attention.

Built With

Share this project:

Updates

Submission history