Erik's ToolBox Documentation
Index

Overview

Erik's ToolBox ships two AI agents: the ToolBox Agent on the Interactive Code page and the SQL Agent on the SQL Workbench. Each one is a chat panel that sits next to the editor it works on. You describe what you want in plain language, and the agent does the work through tools: it reads and rewrites the program or statement in the editor, compiles and runs it, looks up tables and fields in your environment, and saves or reopens your programs and statements. You watch the result appear in the editor while the conversation continues.

Both agents are built on the AL AI Services app, a separate Hougaard app that provides the provider setup, the chat panel, the conversation store, and the connection to the AI providers. This page explains how the pieces fit together, what the agents can do, and what to consider before you turn them on.


What Changed in Version 5

Earlier versions of the ToolBox had an "Agent Mode" that turned the output console into a chat and offered a "Use the code from this reply" button. Version 5 replaces it:

Earlier versions Version 5
Configured on the ToolBox Setup page (Use Coding Agent, Provider, Endpoint, Key, Model) Configured on the AI Providers page shared by all Hougaard apps; the old setup fields are obsolete and hidden
The console became the chat The chat is a FactBox panel next to the editor; the console keeps showing output
The model pasted code into the chat and you clicked a button to apply it The agent calls tools that change the editor directly, compile, run, and look up data
Four providers Twelve providers including Google Gemini, xAI Grok, Mistral, DeepSeek, Moonshot Kimi, Alibaba Qwen, Zhipu GLM, and MiniMax
The conversation was lost when the page closed Conversations are saved automatically and can be resumed later
One agent on the Interactive Code page Two agents: the coding agent and a SQL Agent on the SQL Workbench

If you upgraded from an earlier version, your old provider settings are not carried over. Enter them again on the AI Providers page as described in Setup.


The Three Apps

Erik's ToolBox is installed as three Business Central apps. The agents live in the middle layer.

App App ID Role in the agents
AL Compiler and Interpreter de0ad312-13dc-48bc-9aa4-eec46e388ee0 Compiles and runs the programs the coding agent writes; runs the SQL engine the SQL Agent uses
AL AI Services 9095ed8c-5bff-4b5f-84db-c487250959b3 The AI Providers page, the chat panel, the conversation store, and the HTTP calls to the AI providers
Erik's ToolBox fe7b0b6a-e183-4606-882d-6adff0ce9401 Hosts the two agents, defines their tools, and writes the instructions (system prompts) that tell the model how ToolBox programs and ToolBox SQL work

AL AI Services is a dependency of the ToolBox app and is installed automatically with it. Because the HTTP calls to the AI providers are made by AL AI Services, the Allow HttpClient Requests setting must be enabled for that extension, not only for the ToolBox. See AL AI Services App.


The Two Agents

ToolBox Agent SQL Agent
Page Erik's ToolBox - Interactive Code SQL Workbench
Panel caption ToolBox Agent SQL Agent
Works on The AL program in the editor, the output console, saved programs, the Excel data sheet The SQL statement in the editor, the result grid, saved SQL statements
Can run Compile and run ToolBox programs (with your permissions) Execute SQL through the ToolBox SQL engine (with your permissions)
Looks up Tables, pages, reports, codeunits, queries, XMLports, enums; table fields and keys; sample rows; the catalog of functions the interpreter supports Tables, fields, keys, and sample rows
Conversation scope toolbox-al toolbox-sql

Both agents use the same provider row: the one on the AI Providers page with the ToolBox Agent toggle on. A conversation started with one agent can only be resumed in that agent.

Each agent is described in detail on its own page: Coding Agent and SQL Agent.


How an Agent Works

An agent is a loop between the chat panel, the AI provider, and the tools the ToolBox exposes. Every step runs in your own Business Central session.

  1. You type a message in the panel and press Enter.
  2. The request is sent to the provider. It contains the agent's instructions, the conversation so far, any files you attached, and the list of tools the agent may call.
  3. The model answers with text, with one or more tool calls, or both. Text appears in the chat immediately. Tool calls appear as small indicators with the tool name and a preview of the parameters.
  4. The ToolBox runs each tool call in your session, with your permissions and your ToolBox access level, and sends the result back to the model. A tool can read the editor, replace its contents, compile, run, query the data model, or read and write saved programs and statements.
  5. The loop repeats until the model answers without asking for more tools. Each completed tool gets a check mark; a run of several tools collapses into one line you can expand.
  6. The editor catches up. The page checks about every two seconds whether a tool changed something and then loads the new source or statement, shows output in the console, or shows a result in the grid.
  7. The conversation is saved as soon as the reply is complete, so you can close the page and pick it up again later.

The agent does not see your editor by magic. Its instructions tell it to start every task by calling a "get" tool that returns the current program or statement, its name, whether it has unsaved changes, and what happened the last time it was run. Because that tool is called at the start of each task, the agent works on what is in the editor now, including edits you made by hand since its last reply.


Supported AI Providers

The AI Providers page offers one row per provider. All twelve support tool calling, which the agents require.

Provider Vendor Hosted Notes
Azure Open AI Microsoft Your Azure tenant Enterprise data residency; endpoint includes your deployment
ChatGPT Open AI OpenAI OpenAI cloud Default model gpt-5-mini
Anthropic (Claude) Anthropic Anthropic cloud Default model claude-haiku-4-5; prompt caching is used automatically
LM Studio Local Your own hardware No key required; no data leaves your network
Google Gemini Google Google cloud Default model gemini-2.5-flash
xAI Grok xAI xAI cloud Default model grok-4
Mistral Mistral AI Mistral cloud Default model mistral-large-latest
DeepSeek DeepSeek DeepSeek cloud Default model deepseek-chat
Moonshot Kimi Moonshot AI Moonshot cloud Default model moonshot-v1-8k
Alibaba Qwen Alibaba Cloud Alibaba cloud Default model qwen-plus
Zhipu GLM Zhipu AI (Z.ai) Zhipu cloud Default model glm-4-plus
MiniMax MiniMax MiniMax cloud Default model MiniMax-M2

Endpoints, keys, model names, and per-provider notes are on the Setup page. Agent quality depends heavily on the model: pick a current, capable model for coding work.


What the Agent Knows

Each agent starts every conversation with a set of instructions written by the ToolBox. They cover:

  • Where it is. The coding agent knows it is looking at an AL editor with a console; the SQL Agent knows it is looking at a statement editor with a result grid. Both know the user sees every change within a couple of seconds.
  • The dialect. The coding agent knows the structure of a ToolBox program (an optional var section, optional procedures, one main begin..end; block), which types and statements exist, how Message() reaches the console, how the Excel functions work, and that it should verify unfamiliar functions with a catalog tool. The SQL Agent knows the ToolBox SQL grammar, its lookup-join semantics, the literal rules, the row cap, and that writes go through the normal Business Central triggers with no undo.
  • A working method. Understand first (read the editor), discover (never guess a table or field name), write and check, run only when asked or clearly needed, save only when asked, and explain briefly. The editor is the output; the chat stays short.
  • Its tools. The full list with descriptions, so it can pick the right one. See Tool Reference.

It does not know your data until it looks. The discovery tools return live metadata (fields, types, option members, keys) and, on request, a handful of sample rows, so the code it writes uses the exact names that exist in your environment.


Permissions and Safety

  • Your permissions apply. Tool calls run in your session. A program the coding agent runs, or a statement the SQL Agent executes, can read, insert, modify, and delete data exactly as far as your Business Central permissions and your ToolBox access level allow. A ReadOnly ToolBox level makes writes fail at runtime.
  • The agent is told to ask. Its instructions require it to ask before running code that changes data, to run a SELECT before any UPDATE or DELETE, never to run an UPDATE or DELETE without a WHERE clause, and to check for unsaved changes before replacing the editor. Read what it proposes before you say yes.
  • The license applies. Running a program through the agent is subject to the same license check as the Run action.
  • You can interrupt. Typing while tools are running cancels the remaining tool calls.
  • Nothing is executed silently. Every tool call is visible in the chat, and every change to the editor is visible within two seconds.

Privacy Considerations

Using an agent sends data to the selected AI provider. Be aware of what is included:

  • Always: the agent's instructions, your messages, the model's replies, and the tool results. Tool results contain the program or statement in the editor, table and field metadata, and, when the agent asks for them, sample rows from your tables and the console output of a run.
  • When you attach them: files you drop into the chat (images, and PDFs for providers that accept them).
  • Never: your API keys, your password, or data the agent did not request through a tool.

The conversation, including tool results and attached files, is also stored in your Business Central database so it can be resumed. It is visible to you on the AI Conversations page and can be deleted there. See Conversations.

For the strictest control, use LM Studio (nothing leaves your network) or Azure Open AI (your own tenant). Review each cloud provider's data retention terms before you enable it, especially if your programs or query results contain personal or commercially sensitive data.


Limitations

  • Cost. Every round trip sends the whole conversation, including previous tool results, so long conversations cost more per message. Start a new conversation when the topic changes.
  • Rate limits. When a provider answers with HTTP 429, the call is retried up to ten times, ten seconds apart. Sustained heavy use may still hit provider limits.
  • Timeouts. A single provider call waits up to five minutes. Very long programs the agent runs block your session until they finish.
  • One agent-driven editor per session. If you open the Interactive Code page twice in the same session, the agent operates on the page you opened last.
  • Model quality. The agents check their work by compiling, running, and reading errors, but a weak model still writes weaker code. Use a current, capable model.
  • Dialect boundaries. The coding agent writes ToolBox AL, not full AL. Its check tool reports constructs the interpreter does not implement, and the agent is told to rewrite rather than retry. See Limitations and Differences.

Next Steps

  1. Setup: enter a provider on the AI Providers page and turn on the ToolBox Agent toggle.
  2. Using the Agent Panel: learn the chat panel, files, tool indicators, and conversations.
  3. Coding Agent and SQL Agent: what each agent does and example prompts.