An AI bookkeeping assistant for sole proprietors
Invoices are typed up by hand, and receipts get lost in chats until the end of the quarter. A Telegram agent issues an invoice from one message and files documents itself.
Outcome
- An invoice from one message: the agent finds the client, takes the price from the catalogue and asks only for what is missing
- The number, the total and the amount in words are calculated by code, so the PDF matches what you approved
- A receipt photo, a PDF or an album of shots becomes a bookkeeping record, with the amount and date shown to you first
- A document sent twice is recognised, and the agent asks instead of recording it again
- Role
- Full cycle: spec, development, deployment
- Updated
- 2026-09-25
The problem
A sole proprietor deals with two streams of paperwork. Outgoing invoices: each one has to be drafted, numbered, totalled, with the amount written out in words. Incoming receipts, bills and acts: they have to be kept somewhere, so that the end of the quarter is not spent digging through chats and the phone gallery.
This is the job of a part-time bookkeeping assistant. It is simple but daily, so it either gets done in the evening instead of resting, or gets put off until the last day, when some of the receipts are already gone.
What I built
An agent in Telegram. You write in plain words: «invoice Romashka LLC, consulting 3 hours at 800 and a website audit 2500». The agent finds the client in the catalogue, drafts the invoice and shows it with buttons. After ✅ it assigns a number and returns a PDF with the business details, the stamp and the amount in words.
Incoming documents you simply send: a receipt photo, an invoice PDF, a phone screenshot or several photos as one album. The agent reads the supplier, number, date, amount and currency, suggests an expense category and saves the document once you confirm it.
When it fits
- Invoices are typed up by hand in Word or Excel. The number is taken from «the previous one», the amount in words is written manually, and the client is the one who spots the mistake.
- Receipts and acts live in the gallery and in chats. At the end of the quarter they are collected one by one, and some cannot be found.
- It is too early to hire an assistant. There is not much of this work, but it comes every day.
What makes it an agent
The model chooses the action itself from a set of tools: find a client, draft an invoice, add a service to the catalogue, register a document, list issued invoices. The action is carried out by code in the business's own database, and the same code checks that it makes sense.
The model never does anything irreversible. An invoice number, saving a document, deleting one: each of these happens only after your button.
The key decision: the model guesses, the code checks
The model does no arithmetic. It returns quantities and prices, and the code multiplies, adds up and writes the amount in words. The number is assigned only after ✅ and under a lock, so two invoices approved at the same moment cannot get the same number. The draft you see is built from the database, not from the model's text: the screen shows exactly what goes into the PDF.
The model cannot make things up either. A client's tax code is accepted only if you typed it yourself. If the model replies «draft updated» without having done anything, the code notices and makes it perform the action instead of describing it.
These rules did not come from theory. Almost every mistake that real documents uncovered was closed by a check in code rather than one more line in the prompt: the model does not always follow a rule written in the prompt.
Documents: the agent does not trust itself
The amount and the date are always shown on a card, and only ✅ saves the document. A date that cannot be seen on the document is never replaced with today's date: the field stays empty, and you see that on the card.
The payer never becomes the supplier. Once, reading a bank letter, the model recorded the account holder as the supplier and their personal ID number as the supplier's code. Now the code rejects such a record, just like a Ukrainian tax code on a foreign receipt, where one cannot exist.
Duplicates are caught in three layers. The same file is recognised before the model is called and costs nothing. The same photo sent again from the gallery is recompressed by Telegram, so the file is different, and the agent compares the image itself. The same payment in two documents, such as a bank PDF and a photo of the bank's letter, matches on date, amount and currency. In the last two cases the agent asks rather than blocks: a new receipt from the same shop looks almost identical, and silently rejecting it would be worse.
How it was tested
On real documents rather than invented examples: a faded receipt from 2016, shop receipts in two languages, invoices from foreign services as PDFs and screenshots, a bank payment confirmation and a photo of the same bank letter, a receipt captured in two screenshots. Every mistake they uncovered became a test.
These documents plus a few generated ones make up a reference set: 15 documents with answers checked against the originals. The model that reads documents was chosen by measuring on it, and the chosen one read all 160 fields correctly. An agent reply in conversation costs about a hundredth of a cent on average, a document about a tenth.
What works now and what is in progress
Invoices from text to PDF work, and so do incoming documents from photos, PDFs and albums. The business details in the PDF are fictional for now and marked «DEMO».
In progress: payments from Monobank, where the agent sees that a client has paid, closes the invoice and prepares a reminder for those who have not. After that, the single tax limit and a morning summary. A try-it-yourself sandbox will come separately: the working bot answers only its owner, because it holds real documents.
Common questions
Can the agent send an invoice to a client or delete a document on its own? No. The invoice comes to you as a PDF file, and you forward it to the client. Deleting a document also needs your confirmation, and a deleted one stays in the database with a mark, as bookkeeping requires.
What if the model misreads the amount on a photo? The amount and the date are always shown to you before saving. One message fixes it, for example «amount 1340.50», and the agent changes that exact document, not the one next to it.
Does this replace an accountant? No. Tax documents and reporting are out of scope. The agent takes the daily routine off your hands and gives the accountant invoices and documents already collected.
Stack
- Python
- aiogram 3
- LLM
- Tool calling
- SQLite
Got a similar task?
Describe it in two sentences. I'll tell you if it can be automated and roughly what it costs.