Introducing the AI Accountant App

Allow me to introduce a new app we have been working on, the AI Accountant. This App is an AI that can work as a clerk in an accounting department. This app enables you to define your AIs and have them perform the work. Check out the video:

https://youtu.be/mjakzoDDQYA


In this video, Erik introduces his new AI Accountant app for Business Central — a prompt-driven AI system that orchestrates multiple AI “workers” to handle accounting tasks like posting credit card expenses, processing bank transactions, and executing manual journal entries. The app doesn’t just automate one specific thing; it lets you define your own AI workforce and give them plain-English instructions to handle repetitive accounting work.

The Backstory

Erik has been working on several AI-related projects, including an AI for the Simple Object Designer. But the inspiration for the AI Accountant came from a very practical need — he suddenly found himself without an accountant and had a pile of transactions that needed to be posted. Looking at the work, he thought: “An AI should be able to do this.”

The challenge was that you couldn’t easily get an AI to do general-purpose work inside Business Central. Microsoft’s current agents are specialized for specific tasks, and their approach doesn’t let you write custom instructions or prompts — the magic just happens behind the scenes. Erik needed the ability to write explicit instructions saying, “Here’s what you need to do,” and have the AI follow them.

Important: OpenAI, Not Copilot

The app currently runs on OpenAI’s API directly, not on Microsoft’s Copilot resources. You’ll need an OpenAI API account to use it. Erik noted that Microsoft’s Copilot resource setup is complicated, and he didn’t have the patience to work with it at this stage. This may change in the future.

On his heaviest testing days, Erik has spent about $4 USD in AI credits — so the operational cost is quite reasonable.

How the App Works

The app’s design is both simple and powerful. At its core, it’s an orchestration layer — the app manages data flow in and out of Business Central and coordinates between multiple AI agents, while the actual accounting logic lives entirely in plain-English prompts. There’s no model training or knowledge base required.

Defining Your Workforce

You start by defining your AI workforce — the individual AI agents that will collaborate on your accounting tasks. Erik has defined four, but you could define more or fewer depending on your needs:

  • Finley — The head accountant. Finley knows about the other AIs, understands document types, and coordinates the overall workflow. If there’s something specific Finley needs to know, you write it in plain English.
  • Kenzie — The knowledge worker. Kenzie can look up information in Business Central: bank accounts, expense accounts, customer entries, open invoices, and more.
  • Lawa — The journal preparer. Lawa takes data and puts it into the general journal. Importantly, the app doesn’t post anything automatically — it prepares journals that you review and post yourself (in the current beta).
  • Wisely — The auditor. Wisely reviews completed transactions and evaluates whether the team has done its work correctly, checking against accounting principles. Erik pasted Canadian accounting principles into Wisely’s instructions.

Each AI agent has two layers of instructions: what the other AIs are told about this agent (its role in the team), and instructions given directly to the agent itself (its detailed operating procedures).

Defining Work Types

Because accounting involves a lot of repetitive tasks, you define work types — templates for recurring work. For example, a “Credit Card” work type that comes in every week with the same processing instructions. Each work type specifies:

  • Which AI should be the initial agent to start working on it
  • Whether to use the Excel splitter (which breaks a large spreadsheet into individual tasks — one per row — for more reliable processing)
  • Plain-English instructions specific to that type of work

The Excel splitter is a key design decision. Rather than sending 100 lines to the AI and hoping it keeps track of where it is, the app splits the file into 100 individual workloads and processes each one separately. This is far more reliable.

Demo: Processing a Credit Card Statement

Erik walks through processing a credit card file step by step using the debug/slow-motion mode:

  1. Splitting: The Excel file is uploaded and automatically split into 12 child workloads (one per transaction). The app extracts column headings and transaction data from each row.
  2. Finley analyzes: For a transaction at “Storebælt for biler” (a bridge toll in Denmark), Finley breaks down the transaction — it’s a negative amount on a credit card statement, meaning it’s an expense. Finley identifies it as a toll/bridge crossing fee and recognizes that Storebælt is the Great Belt Bridge in Denmark.
  3. Kenzie looks up accounts: Finley asks Kenzie for available expense accounts. Kenzie returns the list, and Finley selects account 61300 (Travel) as the most appropriate since there’s no specific toll or parking account.
  4. Kenzie finds the bank account: Finley asks Kenzie for bank accounts, and the credit card account is identified.
  5. Lawa prepares the journal: With all the information gathered, Finley instructs Lawa to prepare the general journal entry — debit to the travel expense account, credit to the credit card account.
  6. Wisely audits: Wisely reviews the entire transaction against Canadian accounting principles — checking source data, objectivity, debit/credit accuracy — and concludes the entry is correct with no changes required.
  7. Task complete: Finley wraps up with a summary, and the workload is marked complete.

Demo: Processing a Bank Statement Payment

The second demo processes a bank deposit — a wire transfer of $29,360. The bank statement description includes “TT1/Adam”, and Erik’s work type instructions specify that “TT” indicates a wire transfer from a foreign customer, with the customer name after the slash.

  1. Finley recognizes the pattern: The TT prefix indicates a wire payment, and “Adam” is the customer.
  2. Kenzie finds the customer: Customer number 10,000 is identified.
  3. Kenzie retrieves open invoices: A list of open customer ledger entries is returned.
  4. Finley matches the payment: The closest open invoice is PSC-103232. The payment is $6 less than the invoice — likely a bank fee or short payment. Finley decides to apply the payment to the invoice with the remaining amount left open.
  5. The journal is prepared and audited: Lawa creates the entry, Wisely approves it, and the task completes.

Demo: Free-Form Instructions

For ad-hoc work, Erik has a “MISC” work type — basically “do what you’re told.” He creates a new workload and simply types:

“On February 25th, debit $3,400 from wages and credit the checking bank account.”

This time he clicks Process instead of stepping through debug mode. The app shows a live status of what’s happening, and within moments the journal entry is created — wages debited, bank account credited, dated February 25th.

Under the Hood: The AL Foundation

The source code reveals the underlying AI integration framework that powers the app. At its core is a flexible AI codeunit that can communicate with multiple AI providers:

Codeunit 50105 AI
{
    procedure Setup(Provider: Enum "AI Provider"; URL: Text; AccessKey: Text)
    begin
        CurrentProvider := Provider;
        _Key := AccessKey;
        _URL := URL;
        _temperature := 0.7;
        _top_p := 0.95;
        _maxtokens := 4000;
    end;

    procedure AddSystem(Msg: Text)
    begin
        _System.Add(Msg);
    end;

    procedure AddUser(Msg: Text)
    begin
        _User.Add(Msg);
    end;

    procedure GetText(): Text
    var
        Result: Text;
    begin
        _JsonObjectMode := false;
        if TryCall(Result) then
            exit(Result)
        else
            error(GetLastErrorText);
    end;
}

The framework supports three providers through an enum:

enum 50100 "AI Provider"
{
    value(0; AzureOpenAI)
    {
        Caption = 'Azure Open AI';
    }
    value(1; ChatGPTOpenAI)
    {
        Caption = 'ChatGPT Open AI';
    }
    value(10; LMStudio)
    {
        Caption = 'LM Studio';
    }
}

The TryCall procedure handles the HTTP communication, building the appropriate headers depending on the provider (API key for Azure, Bearer token for ChatGPT) and parsing the standard OpenAI response format:

case CurrentProvider of
    CurrentProvider::AzureOpenAI:
        if _Key <> '' then
            Headers.Add('api-key', _Key);
    CurrentProvider::ChatGPTOpenAI:
        if _key <> '' then
            Headers.Add('Authorization', 'bearer ' + _Key);
end;

The payload is built using the standard chat completion message format with system and user messages, and it supports both text and JSON response modes — the latter being useful for structured data extraction:

procedure GetJson(): JsonToken
var
    t: JsonToken;
    Result: Text;
    parts: List of [Text];
begin
    _JsonObjectMode := true;
    if TryCall(Result) then begin
        if Result.Contains('```json') then begin
            parts := Result.split('```');
            t.ReadFrom(parts.get(2).Substring(5));
        end else
            t.ReadFrom(Result)
    end else
        error(GetLastErrorText);
    _JsonObjectMode := false;
    Exit(t);
end;

Note the pragmatic handling of JSON responses — the code accounts for the fact that AI models sometimes wrap JSON in markdown code blocks (```json), stripping those markers when present. This is a nice example of the kind of real-world robustness needed when working with LLM outputs.

The Philosophy Behind the App

The key insight behind the AI Accountant is that it’s not designed to solve one specific problem. Instead, it provides a framework where you describe your accounting procedures in plain English — just like you would in an instruction manual for a human accounting clerk.

Erik draws the analogy: in a perfect accounting department, no clerk would do anything without a written description of what to do. You’d have instructions for handling intercompany turnover, month-end work-in-progress postings, or any other recurring task. The AI Accountant follows the same principle — you define the instructions, and the AI workforce executes them.

This approach is especially valuable when your data sources are less than reliable. Erik’s own use case involved a bank whose online export tools were constantly breaking due to two-factor authentication issues. With the AI Accountant, you can take whatever data you can get — even messy exports — and let the AI figure out how to process them based on your instructions.

Real-World Results

Erik has already used the app to process several months of accounting data for iHooah.com. The AI prepared the journals, and after minimal checking and corrections, his real accountant reviewed them and said, “That’s fine — post it.” That’s a compelling validation of the approach.

Summary

The AI Accountant app represents a genuinely different approach to AI in Business Central. Rather than building specialized agents for narrow tasks, Erik has created a prompt-driven orchestration framework where multiple AI agents collaborate — one looks up data, one prepares journals, one audits the results — all coordinated by a lead AI that follows your plain-English instructions. The app is currently in beta, requires an OpenAI API account, and is available for testing through the link in the video description. Whether you think this is brilliant or insane, Erik welcomes your feedback either way.