Answering "which account?" for a mining group, in two languages and with the evidence attached
A conversational assistant that tells finance and operations staff which account to post against, in either language, with the evidence behind every suggestion.
Client details removed
This engagement is covered by a non-disclosure agreement. The client, the product, the vendors and anything that could identify them have been intentionally removed or generalised. Everything described about the problem, the engineering and the outcome is real.

Executive summary
A resources group ran around ten operating entities on one shared chart of accounts, and the errors that reached month-end close almost never came from the ledger itself. They came from the moment someone had to pick an account, in an ERP that accepts a wrong code as readily as a right one. We built a multi-agent assistant that reads the question in Indonesian or English, retrieves candidate accounts across both the account master and the group's own policy documents, states how confident it is, and shows the evidence a suggestion rests on. When it cannot resolve a case it says so and routes it to a person rather than guessing.
Business context
The group runs around ten operating entities across mining, hauling and support services, all posting against one shared chart of accounts. That shared chart is what makes consolidated reporting possible, and it is also what makes the daily work hard: an account written for the group as a whole has to be applied by somebody at a pit, a workshop or a procurement desk, whose vocabulary is nothing like the account name. Two constraints shaped everything that followed. First, the assistant sits in front of an accounting decision, so being quietly wrong is far worse than being loudly unhelpful, and every answer has to carry the evidence it rests on. Second, the people asking write in a working mix of Indonesian and English, often inside one sentence, while the account master they are searching is written in a third register again. Retrieval had to cross that gap rather than assume it away.
The challenge
The same account meant slightly different things at different sites, and the people posting transactions were rarely the people who wrote the policy. A pit supervisor recording fuel usage and a procurement officer recording a fuel purchase are looking at the same word and need two different accounts, and nothing in the ERP tells them so. A wrong code is accepted silently, surfaces weeks later during close, and costs more to unwind than it ever cost to enter. Guidance did exist, spread across spreadsheets, policy documents and the memory of a handful of senior staff, and none of it was available at the moment the decision was made.
Objectives
- Put the right account in front of the person posting, at the moment they post
- Answer in the language the question was asked in, including a mix of both
- Show the evidence behind every suggestion, never just the conclusion
- State uncertainty out loud instead of ranking a guess first
- Route what the assistant cannot resolve to a person, with the context attached
Solution architecture
We split the problem into reading intent and finding evidence. A router agent names what the user is actually asking and which facts a correct answer needs, then asks one clarifying question when a required fact is missing rather than assuming it. Retrieval runs unfiltered across two stores: the account master, embedded and searched by vector distance, and the group's own policy documents, chunked and indexed separately. Only once candidates are back does the system infer which ledger the question belonged to. A confidence band then decides what the user actually sees: a direct answer, a short list with a caveat, or a question.
End-to-end workflow
- User
A question arrives in mixed Indonesian and English
- AI
Intent and required facts extracted
The router names what is being asked and which facts a correct answer depends on: which entity, which location, and whether this is a purchase or a usage.
- AI
One clarifying question when a fact is missing
Asked once, and never asked again immediately after the person has just answered it. Re-clarifying is how an assistant stops feeling like it is listening.
- System
Unfiltered retrieval across both stores
Candidates come back from the account index and the document index without a ledger pre-filter narrowing the field first.
- System
Ledger inferred from what came back
The source is decided after retrieval, from the candidates themselves, rather than guessed before the search runs.
- System
Confidence banded high, medium or low
The band depends on how close the top match is and how far ahead of the runner-up it sits, not on how certain the model says it feels.
- AI
Answer returned with its evidence
The account, why it fits, and the source the reasoning came from, streamed as it is produced so the person can start reading before it finishes.
- External
Unresolved cases escalated to the support desk
- System
Turn, cost and feedback recorded
Engineering challenges and decisions
Guessing the ledger before searching it
The first design asked the model which ledger a question belonged to, then used that answer as a hard filter on the search. When the guess was right the results were excellent. When it was wrong the correct account was not merely ranked low, it was unreachable, and the assistant went on to answer confidently over a candidate set that never contained the truth. That failure is invisible from the inside: every downstream stage behaves exactly as it would on a good day.
Decision
We inverted it. Retrieval runs unfiltered, and the ledger is inferred afterwards from the candidates that actually came back. The model's hint survives as an advisory signal used to break ties, and the prompt now tells it to prefer saying nothing over guessing wrong.
Trade-off
Every turn now ranks a wider candidate set, so each answer costs more tokens and a little more latency. We took that trade without much debate: a cheap answer built on the wrong shortlist is not a cheaper answer, it is a liability that arrives faster.
Retrieval that failed across two languages
People ask in a working mix of Indonesian and English, and the account master is written in neither register consistently. Somebody asking about safety shoes and an account named in Indonesian are describing the same thing, but the vector distance between them sat just outside the similarity threshold we had set. The tight threshold was doing exactly what it was configured to do, and it was throwing away correct answers as noise.
Decision
We widened both the candidate window and the distance threshold, and changed what an account is embedded from. The worked examples of transactions that use an account turned out to describe it far better than its formal name does, so they now dominate the embedded text, with the description next and the account name last.
Trade-off
A looser threshold lets more near-misses through, so the noise the threshold used to reject now has to be rejected further down the pipeline. That pushed real weight onto the confidence banding, which stopped being a nicety and became the thing standing between a plausible match and a posted transaction.
"Probably" is not an answer in accounting
A ranked list with no notion of certainty invites everybody to take the top row. In a search box that is fine. In front of a posting decision it converts a retrieval margin nobody can see into a number in the ledger, and the person acting on it has no way to tell a near-certain match from a coin flip that happened to sort first.
Decision
Confidence became a first-class output rather than a debugging aid. The system answers outright only when the top match is both close in absolute terms and clearly ahead of the runner-up, and only when the facts the answer depends on are all present. Otherwise it returns a short list with a stated caveat, or asks one question.
Trade-off
The assistant asks more questions and reaches a first answer more slowly, which reads as friction and was raised as one. We kept it: an assistant that is occasionally slower is a tool, and one that is occasionally confidently wrong about an account is a source of work for whoever finds it at close.
Deterministic rules kept migrating out of prompts and into code
Classification policy started life as prompt instructions, which is the natural place for it and held up well until the edge cases arrived. Each one was legitimately deterministic: a stated rule with a stated outcome that must not be re-interpreted per turn. One by one they moved into the orchestrator as explicit branches, and over a few months that file became the centre of gravity for the whole backend.
Decision
We accepted the migration rather than fighting it. Accounting policy is deterministic by nature and belongs somewhere it can be read, tested and pinned, not in text that is re-read by a model on every turn. Generation stayed in the prompts; the rules that must always fire the same way moved into code with tests behind them.
Trade-off
One file grew far past a comfortable size and now holds knowledge the finance team cannot change without us, which is the opposite of what the declarative agent design was for. Naming the boundary is the real lesson: without somebody defending it, every ambiguous rule drifts toward code, because code is where it is easiest to make it behave.
Indexing that ran on the request path
Ingesting a policy document means parsing the pages, reasoning over page images to recover diagrams and hierarchy, chunking, embedding and indexing. That is minutes of work, and it originally ran inside the upload request. It held while documents were few and failed exactly as the corpus grew, hitting platform request timeouts at the moment the feature started being used properly.
Decision
Ingestion moved off the request path into a durable orchestration with named activities for each stage, so a failure resumes from the stage that failed instead of restarting the document. Progress streams back to the console while it runs, which is what made an asynchronous upload acceptable to the people using it.
Trade-off
Upload stopped being a single request with a single answer, and needed a job record, a progress channel and a retry path that did not previously exist. The page-image reasoning also went through three generations before settling, trading resolution against how much context fits in one call.
Results and lessons
- ~10Operating entities covered
- 11Specialist agents
- 2Knowledge stores searched
- AlwaysConfidence stated per answer
Account guidance moved out of tribal knowledge and into a system that answers in seconds, in the language the question was asked in, and shows its working. Eleven specialist agents cover routing, clarification, lookup, search, recommendation, document search, capability explanation and summarisation, each defined as a prompt file rather than as code, so a wording change from the finance team does not need a deployment. Cases the assistant cannot resolve leave it deliberately, as an email to the support desk, instead of ending in a shrug.
The most durable outcome was not the answers but the record of them. Every turn stores what was asked, which accounts came back, which confidence band fired and whether the person marked the answer useful, which turns the assistant's own failures into the dataset for improving it. The questions it cannot answer are now a list somebody can read, rather than a vague sense that people are still asking around.
Lessons learned
- An advisory hint beats a hard filter: a wrong pre-filter removes the right answer before anything can rank it
- What an item is embedded from matters more than which embedding model reads it
- Confidence is a product feature, not a debugging aid, wherever an answer becomes an action
- Deterministic policy belongs in code and generative work belongs in prompts; the boundary drifts unless somebody defends it
- Anything measured in minutes does not belong on a request path, however few documents there are on day one
Production considerations
A correlation id is minted in the browser and carried through the proxy layer, the API and every downstream call, so one identifier reconstructs a whole turn across three services. Token cost is recorded per turn rather than in aggregate, which is what made the effect of widening the candidate set measurable instead of arguable. The console reports latency distribution, active users and, most usefully, an unanswered rate: the share of turns where the assistant declined to answer. Every message can be marked useful or not, and that judgement is stored next to the retrieval that produced it. Secrets resolve from a managed vault with environment fallback, and the assistant is reachable only behind corporate sign-on.
What we would do next
The unanswered log is the most valuable unused dataset in the system. Each declined turn is a labelled example of a question the corpus cannot yet serve, and each thumbs-down next to a retrieval is a labelled example of a match that looked right and was not. Feeding both back would let the confidence thresholds tune themselves per question type rather than being set once by hand against a spreadsheet of test cases. The other open thread is the boundary that keeps drifting: giving the finance team a way to author deterministic rules themselves, in a form that is still testable, so the orchestrator stops being the only place a policy change can land.
Technologies
08- Azure AI Foundry
- Microsoft Agent Framework
- Azure AI Search
- Cosmos DB vector search
- Azure Durable Functions
- Azure Document Intelligence
- FastAPI
- Next.js
