Inspiration The gig economy is booming, but the financial tools available to freelancers, rideshare drivers, and independent contractors are stuck in the past. Unlike corporate employees, gig workers don't have an HR or finance department. They deal with volatile income, complex tax write-offs, and hidden expenses that eat into their margins. We realized that gig workers are essentially "businesses of one" and desperately need an enterprise-grade financial backend. This inspired us to build the Expense-Optimizer-Agent—a proactive, AI-driven financial brain designed specifically to protect and maximize a gig worker's hard-earned money.

What it does The Expense-Optimizer-Agent is an autonomous AI assistant that acts as a 24/7 financial advisor. Instead of just showing users a pie chart of their past spending, it proactively optimizes their cash flow: Smart Receipt Ingestion: Users snap a photo of a receipt or forward an email invoice. The agent automatically extracts the vendor, line items, total, and tax. Contextual Categorization: It knows the difference between a personal expense and a valid gig-economy tax deduction (e.g., identifying car maintenance or gas for an Uber driver). Waste Identification: It detects unused subscriptions, recurring fees, or overpriced services, alerting the user to wasteful spending. Actionable Recommendations: It actively searches for and suggests discounts on frequent expenses (like cheaper insurance, bulk gas discounts, or better phone plans).

How we built it We built a modern, event-driven architecture heavily leveraging Google Cloud Platform and Python: The Brain: We used Vertex AI (Gemini) as the core reasoning engine. We gave the agent a custom system prompt to analyze spending patterns and make financial decisions. Data Extraction: We integrated Google Document AI to process messy, unstructured receipts and invoices with high accuracy. Event-Driven Pipeline: When a user uploads a receipt, it triggers a Pub/Sub event. Cloud Tasks then queues the agent workflow so the user interface never freezes. Storage & Analytics: Real-time state and user profiles are stored in Firestore, while categorized transaction data is streamed into BigQuery to generate long-term analytics and spending insights.

Challenges we ran into Messy Real-World Data: Receipts are often crumpled, faded, or formatted weirdly. Getting consistent data out of them required fine-tuning our Document AI pipeline and using Vertex AI to logically infer missing fields. LLM Hallucinations in Finance: You can't have an AI making up numbers when dealing with people's money. We had to heavily iterate on our prompt engineering and use strict JSON-schema outputs to ensure the Agent's financial math and categorizations were 100% deterministic and safe. Orchestration Latency: Chaining together OCR, LLM reasoning, and database writes initially caused high latency. We had to move to an asynchronous architecture using Pub/Sub to keep the user experience snappy.

Accomplishments that we're proud of Successfully building a multi-agent orchestration pipeline where Document AI and Vertex AI seamlessly pass structured data back and forth. Achieving an incredibly high accuracy rate in identifying "hidden" tax deductions that standard accounting software usually misses for gig workers. Building a completely serverless, highly scalable backend on Google Cloud that costs pennies to run but delivers enterprise-level insights.

What we learned Prompt Engineering is a continuous process: We learned how to write robust, fail-safe prompts that force LLMs into strict analytical roles rather than conversational ones. The Power of GCP Ecosystem: We realized how efficiently Google Cloud services (Firestore, Pub/Sub, Vertex, BigQuery) integrate with one another. It allowed us to focus entirely on the AI logic rather than fighting with infrastructure. Financial Empathy: We gained a deep understanding of the thin financial margins gig workers operate on, and how much even a $20/month optimization can help.

What's next for Expense-Optimizer-Agent This agent is just the first module of our broader Gig Economy AI Financial Operating System. Moving forward, we plan to: Bank Integration: Integrate with the Plaid API for real-time bank and credit card transaction streaming. Autonomous Negotiation: Give the agent the ability to draft emails or make phone calls (via conversational AI) to negotiate bills or cancel subscriptions on the user's behalf. The Tax & Compliance Agent: Pipe the categorized data directly into a new Agent that automatically fills out quarterly estimated tax forms (Schedule C). Dynamic Micro-Lending: Use the highly accurate expense and income data stored in BigQuery to generate alternative credit scores, allowing us to offer fair, AI-powered micro-loans to gig workers who traditional banks ignore.

Built With

Share this project:

Updates