Erik's ToolBox Documentation
Index

Using the Agent Panel

Both ToolBox agents use the same chat panel from the AL AI Services app. This page explains the panel itself: sending messages, reading tool indicators, attaching files, interrupting, and managing conversations. What each agent can do with your editor is covered on the Coding Agent and SQL Agent pages.


Where the Panel Is

The panel is a FactBox on the right-hand side of the page:

  • Erik's ToolBox - Interactive Code: the FactBox captioned ToolBox Agent.
  • SQL Workbench: the FactBox captioned SQL Agent.

It is only shown when a provider row with the ToolBox Agent toggle exists at the moment the page opens (see Setup). Use the Business Central FactBox controls to collapse or expand it; the panel resizes with the FactBox pane.

When a conversation is empty, the panel shows an intro: a title (ToolBox Agent or SQL Agent), a subtitle naming the page, and a hint such as "Ask me to write, fix or explain your program!".


Sending a Message

  1. Click into the text box at the bottom of the panel ("Type a message...").
  2. Type your request. Enter sends it. Shift+Enter inserts a line break. The box grows with your text up to a few lines.
  3. Or click the Send button (the paper plane).

Your message appears as a bubble on the right. Three animated dots show that the provider is working. The agent's reply appears as a bubble on the left, rendered from Markdown: headings, bullet lists, tables, bold text, and code blocks all display formatted.

There is no need to paste your program or statement into the chat. The agent reads the editor itself with a tool at the start of each task.


Tool Indicators

When the model decides to use a tool, the panel shows an indicator line for each call:

What you see Meaning
Spinner, tool name, and a short parameter preview (for example get_table_info table_no: 18) The tool is about to run or is running
Check mark in front of the line The tool finished and its result went back to the model
N tools used followed by the tool names and a small arrow Two or more consecutive tools finished; click the line to expand or collapse the individual calls
Red cross in front of the line You interrupted while this tool was pending

The parameter preview is shortened to a few dozen characters per value. It is there so you can follow what the agent is doing, for example that it is reading the Customer table before writing code against it, or that it is about to run the program.

Tools run one after another, each followed by another round trip to the provider, so a task that needs several lookups takes a few seconds per step. The Tool Reference lists every tool and what it does.


Watching the Editor

Tool calls change the page you are looking at, not the chat:

  • A program or statement the agent writes appears in the editor within about two seconds.
  • Output of a program the coding agent runs appears in the console; the result of a statement the SQL Agent runs appears in the result grid.
  • A program the agent loads or saves changes the page caption to the program name.

A program written by the agent is treated as unsaved work: the page asks for confirmation if you close it or start a new program without saving. Saving through the agent or through the Save action clears that state.

You can keep editing by hand while the conversation is open. The agent reads the editor again at the start of its next task, so your edits are taken into account.


Attaching Files

You can give the model an image or a document to look at, for example a screenshot of an error, a picture of a whiteboard sketch, or a PDF specification.

  • Click the paperclip button next to the text box and choose one or more files, or
  • drag files onto the panel; a "Drop files here" overlay appears while you hover.

Each file appears as a file bubble in the chat. The file is included in every request of the conversation from then on, so the model can refer to it later. Files are also stored with the saved conversation.

Which file types the provider accepts:

File type Accepted by
JPEG, PNG, GIF, WebP images All providers (Grok: JPEG and PNG only)
PDF documents Azure Open AI, ChatGPT Open AI, Anthropic (Claude), Google Gemini
Anything else (text, Excel, Word, ...) Not sent; the file bubble appears but the model does not receive the file

Keep attachments small. They are re-sent with every round trip and count toward the provider's token limits. Start a new conversation to drop them.


Interrupting

If you type a message while tool indicators are still spinning, the panel treats it as an interrupt:

  • The pending tool is marked with a red cross and the remaining tool calls of that turn are cancelled.
  • Your new message replaces the unfinished work as the agent's next instruction.

Use this when you see the agent heading in the wrong direction, for example reading the wrong table or about to run a program you did not want executed. Changes a tool already made before the interrupt (a replaced program, an executed statement) stay in place.


New and Resume Conversation

The panel's action menu has two actions:

Action Effect
New Conversation Clears the chat, drops attached files, and starts fresh with the agent's instructions. The previous conversation stays saved and can be resumed later.
Resume Conversation Opens a list of your earlier conversations with this agent. Pick one; the chat is rebuilt from its transcript and you continue where you left off.

Conversations are saved automatically after every completed reply. Details, including the AI Conversations page and what is stored, are on the Conversations page.


Errors in the Chat

A failed provider call shows up as an assistant bubble starting with ERROR Happened: followed by the provider's message. Typical causes are a blocked HttpClient setting, a missing or invalid key, a wrong endpoint or model name, or a network problem; the Setup page lists the messages and fixes. The conversation is still intact; fix the setup, reopen the page, resume the conversation, and send your message again.

A failed tool (for example a program that does not compile, or a table that does not exist) is not an error in the chat. The tool result tells the model what went wrong, and the model fixes its input and tries again or asks you. You see this as another tool indicator or as an explanation in the reply.


Writing Good Requests

  • State the outcome, not the code. "List customers with a balance over 10,000 sorted by balance" gives the agent room to look up the right fields. It still writes the program.
  • Name the objects you know. Table names, report names, and field captions save discovery round trips. The agent verifies them anyway.
  • Say whether to run. "Write it" leaves the program in the editor for you. "Run it and show me" makes the agent execute it after checking it compiles.
  • Be explicit about data changes. "Update the posting group on these 12 customers" is a write. The agent will ask before running; answer clearly.
  • Point at the error. "Why did the last run fail?" is enough: the agent reads the last run's diagnostics and console output from the editor page.
  • Ask for explanations. "Explain what this program does" or "What does this ON clause do?" works on whatever is in the editor.
  • Refer to saved work. "Open my program Customer Balances and add an Excel export" or "Reuse the query I saved as Open Orders" makes the agent use the saved programs and statements.
  • One task at a time. Several small tasks in sequence beat one long request. Each reply verifies its own step.

Cost and Token Use

Every round trip sends the agent's instructions, the tool definitions, the whole conversation so far (including every tool result), and your attachments. That has consequences:

  • Long conversations cost more per message. Start a New Conversation when you change topic.
  • Tool results add up. Reading 50 sample rows or a 250-field table puts that text into every later request of the conversation. The tools cap their output for this reason.
  • Anthropic prompt caching is applied automatically to the instructions, the tool definitions, and the unchanged prefix of the conversation, which reduces the cost of the repeated part considerably on that provider.
  • A reply is capped at the provider's output limit (40,000 tokens on Anthropic). Replies that would exceed it are cut off; ask the agent to continue.
  • Rate limits (HTTP 429) are retried up to ten times with a ten-second pause. Each provider call waits at most five minutes.

The ToolBox does not show token counts in the panel. Use the provider's dashboard to track spend.


Quick Reference

Action How
Send a message Type and press Enter (Shift+Enter for a new line)
Attach a file Paperclip button, or drag the file onto the panel
See what a tool did Read the indicator; click a N tools used line to expand it
Stop the agent Type a new message while tools are running
Start over New Conversation in the panel's actions
Continue earlier work Resume Conversation in the panel's actions
Manage saved conversations Search for AI Conversations
Change provider or model AI Providers action, then reopen the page