Fig. 04 · Multi-agent cost cutting for SMEs
Costrym
Pulls a company's accounting data from Xero, QuickBooks, Zoho Books, sevDesk and Expensify, categorises it, and generates cost-cutting tasks that a person approves before anything is scheduled.
- Role
- Lead engineer
- Team
- 3 engineers
- When
- Nov – Dec 2025
- Stack
- Laravel 12, Inertia + React, LarAgent, OpenAI, Pipedream, Firecrawl, Ably, Stripe
- Links
- GitHub repo
01The problem
Small companies know they overspend on SaaS, cloud and marketing, but the data sits across accounting tools, and analysing it means a finance person exporting spreadsheets by hand.
02How it works
6 steps01 · System moves data
Ingest
A Laravel job batch runs one job per provider through Pipedream's managed OAuth and lands everything in one financial-records table.
02 · AI proposes
Categorise
Starts only when the whole batch is done. Twenty records at a time into a fixed list of 18 categories, re-queuing itself until nothing is left.
03 · AI proposes
Plan
An orchestrator proposes 5–7 prioritised tasks with estimated savings.
04 · Person approves
Approve
Every task waits as pending until a person approves it. Approval schedules it by priority band.
05 · Rules decide
Route
Deterministic capability scoring picks the specialist agent for each task: cheap, predictable and easy to debug.
06 · AI proposes
Deep analysis
A five-stage pipeline: baseline, cost decomposition, web benchmarking, cost-efficiency ratio, cost-value alignment. Each stage hands a context document to the next, and the arithmetic runs in tool code, not in the model.
- AI proposes
- Rules decide
- Person approves
- System moves data
03Hard problems
3 of themOrdering a multi-provider chain
Job batches with a completion callback mean categorisation starts only after every provider finishes, and a self-chaining categoriser stays inside token limits.
Routing tasks without another LLM call
Generated tasks arrive without an owner. A scoring function matches task text against each agent's declared capabilities, so routing is free and debuggable.
Context across a five-stage pipeline
Each stage writes a structured result into a shared document the next stage reads, and each stage is persisted as its own report so every number can be traced back.
04By the numbers
Tested end to end on synthetic transactions.- agent classes
- 19
- accounting integrations
- 5
- stages in the deep-analysis pipeline
- 5
- from first commit to full pipeline
- 4 wks
05What I'd do differently
19 agents was more than the problem needed. The baseline, decomposition and ratio stages are pure arithmetic and should be plain code feeding one or two reasoning agents. I'd also lock integrations to read-only actions, with a separate approval for any write.