AI Agents · Ai

Explainability for AI Agents

Explainability for AI Agents is the work that defines the next phase of enterprise software. ERP systems hold the most valuable business data in the company — customers, orders,.

John Kihiu12 min read

The moment an AI agent touches an ERP — approving a vendor bill, flagging an AR account for collections, answering "why is this order on hold" — someone eventually asks why it made that call. In finance and operations, "the model said so" is not an answer an auditor accepts, and it is not one that helps the AP clerk who has to defend the decision to a vendor. Explainability here is not a nice-to-have UI feature; it is the difference between an agent people trust with real transactions and one that gets quietly switched off after the first bad surprise.

Why black-box decisions fail in ERP contexts

ERP workflows are already governed by audit trails, approval hierarchies, and SOX-style controls that assume every action has a traceable cause: a user, a rule, a threshold. Drop an LLM into that workflow and you break the assumption — "the model inferred it was probably a duplicate invoice" is not a control, it's a shrug. Regulators and internal auditors don't need the agent to be right 100% of the time; they need to know, after the fact, what evidence it used and whether that evidence was reasonable. Without that, every agent-driven action becomes a liability the business can't defend in a review.

The stakes are asymmetric, too. A recommendation engine on a retail site can be wrong for cheap. An agent that auto-approves a bill, adjusts a credit limit, or flags a customer for collections is touching money and relationships — the cost of an unexplainable wrong answer is a chargeback, a lost customer, or a failed audit finding.

Explanation versus post-hoc justification

This is the distinction that trips up most implementations. If you ask an LLM "why did you flag this invoice," it will happily generate a fluent, plausible-sounding paragraph — even if that paragraph has nothing to do with the actual computation that produced the flag. LLMs are good at writing justifications on demand; they are not introspecting their own weights. A confabulated explanation that sounds reasonable is worse than no explanation, because it's convincing enough to pass a cursory audit while being disconnected from the truth.

Real explainability has to be architectural, not requested after the fact. That means capturing the actual evidence and steps at the time the decision is made — not asking the model to narrate itself retroactively.

Don't trust self-reported reasoning

"Explain your reasoning" prompts produce narrative, not audit trail. If the only record of why an agent did something is a paragraph the same model generated on request, you have a justification, not an explanation. Log the actual tool calls, retrieved documents, and scores instead.

Provenance for RAG-backed answers

For agents built on retrieval-augmented generation — answering "what's the payment status on PO-4471" by pulling from Acumatica's AP and GL tables — the practical fix is showing the retrieved source alongside the answer, not just the answer. Every response should carry a citation: which record, which field, which timestamp the number came from. If the agent says a bill is overdue, the UI should let a user click through to the actual AP Bill screen entity it read, not just trust the sentence. This turns "trust the model" into "verify the source," which is a check a non-technical AP clerk can actually perform.

The same applies to any tool-calling step. If the agent queried a generic inquiry or called an OData endpoint to get a balance, log the query and the raw response next to the generated summary. When the summary and the underlying data disagree — which happens, because summarization is still generation — that log is what catches it before the number reaches a customer.

Logging the reasoning chain and tool calls

Treat every agent turn as an event to persist: which tools were called, with what arguments, what each tool returned, and what the model did with that result before producing the final output. This is standard observability practice — the same discipline you'd apply to a distributed system — applied to a component whose internal reasoning is otherwise opaque. Store it against a request ID so a support ticket like "why did the agent deny this discount" can be answered by pulling the actual trace instead of asking the model to reconstruct its own history from memory (which it also can't reliably do).

For classical ML components sitting alongside the LLM — a credit-risk score, a duplicate-invoice classifier — this part is easier and already well understood. SHAP or feature-attribution methods can tell you which inputs pushed a gradient-boosted model's score up or down, and that attribution is faithful to the actual computation, not a guess. Where the pipeline mixes an LLM front end with a classical model doing the actual scoring, surface the classical model's attribution directly rather than letting the LLM paraphrase it — paraphrasing is where confabulation creeps back in.

Confidence scores and when to defer

An honest confidence signal is more useful than a longer explanation. If the agent can expose a calibrated confidence — from retrieval similarity scores, from ensemble agreement, or from a classifier's predicted probability — use it to gate autonomy: high confidence and clean provenance can auto-execute, anything below threshold routes to a human review queue with the evidence attached. This also sidesteps the confabulation problem: a low-confidence flag doesn't need a persuasive story, it just needs a human to look at the same sources the agent looked at.

Design the UI around provenance, not prose

Show the source record, the retrieval score, and the tool call log by default; keep the generated explanation as a secondary, clearly-labeled summary. Users learn quickly which one to trust when something looks wrong — make sure the trustworthy one is the one they see first.

Wrapping up

Explainability for ERP-facing agents is mostly an engineering and logging problem, not a prompting problem. Capture real provenance — retrieved records, tool calls, confidence scores — at generation time, keep it separate from anything the model narrates about itself, and give classical components (which actually support attribution) the credit for decisions they made. Do that and an auditor's question stops being a scramble and becomes a query against a trace you already have.

John Kihiu
Acumatica ERP Developer · Laravel Engineer

Independent software engineer in Nairobi specialising in Acumatica customisations, Laravel backends, and tax fiscalisation integrations across East and Southern Africa.