Skip to content

About

A small invoice chase agent in Python. Reads unpaid invoices from a CSV and from images with Claude vision, drafts reminders and follows up on client replies. Own agent loop on the Anthropic Messages API, fake mailbox, offline replay tests.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

invoice chase agent

a small agent that chases unpaid invoices for an agency. it reads invoices from a csv and from images, drafts polite reminders and follows up on replies.

all data is fake. the mailbox is a json file. no real email is sent.

how it works

  • plain code loops over the ledger.
  • each invoice gets its own agent run. the loop is our own code on the anthropic messages api. no agent sdk.
  • the agent calls six tools: list_unpaid, extract_invoice, draft_reminder, send_email, check_reply, mark_paid.
  • images are read by claude vision. each result has a confidence field.
  • tests use a stub model with fake token usage. they run offline.

quick start

pip install -r requirements.txt
python make_samples.py        # builds the fake data
pytest                        # offline, no key needed
python agent.py --demo        # offline run with a rule-based stub model
python agent.py --reset       # clears state.json and outbox.json

live run:

cp .env.example .env          # then fill in ANTHROPIC_API_KEY and ANTHROPIC_MODEL
python agent.py --only INV-001       # one invoice first
python agent.py --only inv_clean.png # one image
python agent.py                      # the whole ledger

each tool call prints as it runs. add --quiet for the summary only.

a live run allows up to 50 model calls per invoice and uses your api credit. try the demo first.

files

file purpose
agent.py the agent loop, model adapters, stub models, cli
tools.py the six tools, shared context, injectable clock
extract.py image to invoice fields. real extractor and an offline one
make_samples.py builds invoices.csv, inbox.json, invoices_in/, samples_labels.json
test_replay.py replay tests with stub models

data files:

  • invoices.csv: 36 fake invoices. read-only seed data.
  • inbox.json: scripted client replies.
  • invoices_in/: 8 fake invoice files. clean, blurry, rotated, two currencies, a duplicate, a missing due date and a pdf.
  • samples_labels.json: the expected fields for each sample.
  • state.json and outbox.json: written at run time.

About

A small invoice chase agent in Python. Reads unpaid invoices from a CSV and from images with Claude vision, drafts reminders and follows up on client replies. Own agent loop on the Anthropic Messages API, fake mailbox, offline replay tests.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages