MMOOZZGG.com

How to build an AI agent

AI agent for document processing: contracts, invoices, requests and reports

5 min read6 sources

An AI agent for document processing reads incoming contracts, invoices and requests, pulls out the data, checks it against your records and prepares a draft. A simple version is built from open parts, while a link to 1C and the document management system needs a developer: we run it as a pilot from $1,499, 14 days.

On this page · 4 sections

A developer is needed

What the agent does with documents

A document agent does four kinds of work: it reads a file, extracts the fields it needs, checks them against your records and prepares a draft. A person signs the draft. The agent speeds up review, but the employee stays responsible for the signature.

Typical tasks: check an incoming invoice against the order and the contract, find where a supplier’s contract differs from your template, turn an emailed request into items and quantities, and collect a summary from delivery acts for a report.

For questions about contracts and policies, the agent gets a document base. Before it answers, it searches the base for the right fragments and answers from them with a reference to the clause. This method is called RAG and was described by Lewis and colleagues in 2020; how to build such a base is covered on the page on the RAG agent.

A simple version needs no developer: the agent gets a contract, compares it with your template and sends a list of differences. It writes nothing to your records, so its mistake costs only the lawyer’s time to recheck.

Checks and drafts need something else: access to your records. The agent no longer only reads; it compares with data in 1C, and money depends on the accuracy of that comparison.

Extracting data from scans

Files come in two kinds. A PDF from accounting software already contains text and needs no model: n8n has an “Extract From File” node with an “Extract From PDF” operation that turns the file into data.

A scan or a photo holds only a picture. A model with image support reads it: according to the Ollama documentation, such models accept an image together with text and answer questions about what they see.

To avoid a free-text answer, the model gets a structure: a list of fields with types, such as invoice number, date, supplier tax ID and amount. Ollama has a format parameter that takes a JSON schema, and the model answers strictly in that schema, even from an image.

Scans will have errors: a blurred stamp, a handwritten correction, two pages in one file. So a field the agent did not read with confidence goes to an employee for review, not into your records.

Check reading quality before launch. Take 30 real scans from last month, fill in the fields by hand and compare them with the agent’s answers: you will see at once which fields it reads reliably and which need a person.

An open model for scans runs on your own server through Ollama. Then contracts and invoices never leave the company, and you do not have to decide whether they may go to an outside service.

Checking against your records

A check compares the fields of a document with your records: does the contract exist, does the invoice amount match the order, was the invoice paid before. For this the agent needs access to 1C, the CRM or the bank.

Access comes through tools. Since 25 November 2024 there has been an open standard for this, the MCP protocol (Model Context Protocol), one way to connect AI to data and services: you connect each system once, and the agent sees it as a set of actions.

People write the matching rule. The model finds the fields and explains the mismatch, but a program decides “the amount matches” by a rule the accountant approved. This way a model error does not become an error in your records.

The agent does not fix mismatches by itself. It writes in a task what did not match and where, and an employee decides who is right: the supplier, the manager or the records.

Contracts and invoices hold personal data: full names, passport details, phone numbers. Under 152-FZ, Russia’s personal data law, data of Russian citizens is stored in databases in Russia, and before any transfer abroad the operator notifies Roskomnadzor, the Russian data protection regulator. How we store such data is described on the page on data security.

Integration with 1C and document management

A simple agent reads files from a folder or a mailbox and sends a summary. An agent that creates documents in 1C itself and sends them for approval works inside the accounting system, and that needs a developer.

The developer creates a separate 1C user for the agent with limited rights, decides which documents the agent may create only as drafts, and writes the checks. How the agent reads and writes data in 1C is shown on the page on integration with 1C.

In document management the route matters. The agent puts the draft in the right folder or task and assigns a reviewer, while a person signs and posts the document.

We build such an agent as a pilot: from $1,499, 14 days, on one document flow, such as incoming invoices. The metric in the contract: the share of documents that went through without manual entry and the number of errors found in review.

A typical document agent is built from open parts: a model, a file loader, a field schema and a link to your records. If someone prices it as a one-of-a-kind development, ask what the price is made of.

Sources and fact-checking

Checked by the editors on 16 October 2026.

  1. arXiv 2005.11401, 22 May 2020 (arxiv.org)
  2. Anthropic, 25 November 2024 (anthropic.com)
  3. Brace Law Firm, 9 July 2023 (brace-lf.com)
  4. Ollama Docs, Vision and Structured outputs, 2026 (docs.ollama.com)
  5. n8n documentation: Extract From File, checked 16 October 2026 (docs.n8n.io)
  6. Ollama documentation: Vision, checked 16 October 2026 (docs.ollama.com)

Found a mistake? Tell us

Publications

Contact us