Skip to content
Governed learning loop Context Graph Processing Graph Governed corpus How To? 10 reference agents Proof Documentation GitHub Open source Get started
01 / Operations

Invoice to accounting

An accounts-payable desk that turns corrections by email into next week’s operating knowledge.

What this example teachesThe complete adaptive-agent pattern

One content-addressed plan, implemented in Python, TypeScript, and Rust.

Reference agent / keylessCI asserted
Before

Invoices arrive by email, approvals disappear into reply chains, and every correction dies in someone’s sent folder. The desk repeats the same vendor and attachment mistakes because its history never becomes usable policy.

With Areev

Invoices post with a named approver on every row. Corrections travel around a bounded review cycle by email reply, while deduplication prevents the same message from starting the same payment twice.

The processing graph

The job, the gate, and the learning path.

The plan is content-addressed. Each run becomes a journal. The person is an explicit node—not an optimistic note in the system prompt.

01 Invoice email Gmail, Outlook, or committed fixtures
02 Parse + extract Fail loudly when the document is unreadable
03 Validate Apply client rules and remembered aliases
04 Approve or revise A named person answers by reply
05 Post the row Idempotent write to the books
06 Learn from runs Corrections and failures become evidence
Where it becomes adaptive

Production history changes the next run—after review.

A misspelled vendor corrected in week one becomes a fact used automatically in week three. Repeated scanned-attachment failures become an evidence-cited recommendation that a person can approve or reject.

History→Evidence→Proposal→Person→Next run↺
What the example proves

Assertions, not a happy-path demo.

The repository runs the keyless floor on every release. The exact fixtures and expected outcomes are committed beside the agent.

  1. 01

    Three language bindings mint the same content-addressed plan.

  2. 02

    Self-approval and duplicate delivery are refused structurally.

  3. 03

    The keyless smoke and improvement acts run in CI on every release.

Use it as a pattern

What you will learn by rebuilding it.

  • How to separate run, session, and subject identity.
  • How CAL assembles the plan, tools, facts, thread, and learned lessons under a token budget.
  • How human corrections become durable context without granting the agent authority to change itself.
Run the two actsno API key required
$ git clone https://github.com/AreevAI/areev
$ cd areev/examples/agents/invoice-to-accounting
$ python/smoke.sh
$ python/improve.sh
committed fixtures deterministic floor human gates asserted
Read the complete README