Inspiration

Chasing money you are owed is quiet, constant, expensive work. An invoice goes past due, and someone has to draft the reminder, log the contact, wait for the customer, resume days later, decide when to escalate, and keep a record they can defend. A dashboard shows an aging report; it cannot safely own the asynchronous work of doing the chase.

CollectLoop is the accounts-receivable mirror of ProofLoop, our accounts-payable agent. Together they cover both sides of the cash cycle with agents that complete real operational work while refusing to cross the lines that must remain human.

What it does

CollectLoop receives an overdue-invoice event and runs a bounded collections loop. It drafts a professional reminder with Gemini 3.5 Flash, logs the contact, and persists an AWAITING_CUSTOMER_REPLY checkpoint. Repeated events are ignored to prevent duplicate actions. A later customer reply resumes the workflow: a promise-to-pay is recorded without changing the amount owed, while disputes escalate to a human.

The most important feature is what CollectLoop cannot do. It cannot offer a discount, waive a fee, alter the amount due, change bank details, or write off a debt. Those actions are denied structurally with HTTP 403 and recorded in the audit trail. Case closure remains human-only.

How we built it

CollectLoop uses a FastAPI service on Google Cloud Run with durable state in Firestore. Gemini 3.5 Flash runs through Google ADK 2.8 and Vertex AI to draft reminder language. A deterministic policy layer—not the model—governs authority. Secret Manager protects administrative endpoints, while the public dashboard and evidence route let judges inspect the workflow without credentials.

The deployment uses dedicated least-privilege build and runtime service accounts. Every case records its state, checkpoint, model provenance, permitted actions, and denied attempts.

Challenges we ran into

The hard part was not generating fluent text. It was preventing the model from widening its own authority. We built deny-by-default policy enforcement, immutable debt amounts, idempotent event handling, durable checkpoints, and explicit model provenance.

Deployment also surfaced real integration issues: current Google ADK requires a chat or task execution mode, and Cloud Run source builds now require carefully scoped build identities. We fixed and verified both against the live service.

Accomplishments that we're proud of

  • A complete, inspectable action loop—not a chatbot
  • Real Gemini 3.5 Flash execution through Google ADK 2.8
  • Durable Firestore state and resumable checkpoints
  • Duplicate-event suppression
  • Human-only closure
  • Hard financial-action denial with visible HTTP 403 evidence
  • A judge-facing dashboard deployed on Cloud Run

What we learned

Reliable enterprise agents need explicit authority boundaries, durable state, idempotency, recovery paths, human accountability, and evidence a reviewer can inspect quickly. The useful innovation is not a model deciding more; it is a system that completes more operational work while refusing to cross the lines that should remain human.

Try it out

Scope and data disclosure

All customers, invoices, and cases are fictional and synthetic. The service has no ERP, bank, or payment integrations and cannot move money. CollectLoop is a separate submission from ProofLoop; it reuses the governance pattern but shares no code, data, or deployment.

What's next for CollectLoop

The next step is to turn CollectLoop from a focused proof into a production-ready receivables operations layer. We would connect it to accounting and ERP platforms, email and messaging channels, and configurable enterprise approval policies—while keeping payment terms, discounts, write-offs, bank details, and case closure under explicit human control.

We also plan to add portfolio-level prioritisation, multilingual reminders, configurable escalation paths, delivery and reply analytics, stronger identity and tenant isolation, and evaluation suites that continuously test both task completion and policy refusal. The long-term goal is a deployable SaaS product for finance teams: an agent that owns the repetitive follow-up loop, produces audit-ready evidence, and earns trust by making its limits as visible as its capabilities.

Built With

  • adk
  • fastapi
  • firestore
  • gemini
  • google-cloud-run
  • pydantic
  • pytest
  • python
  • secret
  • uvicorn
  • vertex-ai
Share this project:

Updates