What's New: Coding Business Central Agents with AI Development Toolkit
Coding custom Business Central agents in AL with the AI development toolkit APIs: the agent project template in the VS Code extension, agent types, interfaces, setup pages, instances, tasks and messages, multi-turn interactions, agent session events, and exposing agents to other apps. Slide walkthrough with code examples, 16 minutes, published 2026-02-27.
- Introduction and Getting Started
- Agent Type Design and Setup
- Agent Interfaces and Message Validation
- Agent Types versus Instances
- Setup Pages and Configuration
- Agent Management and KPI Pages
- Tasks and Messages API
- Multi-turn Interactions and Task Triggers
- Getting Task Results and Agent Sessions
- Exposing Agents to Other Apps
Overview
The video shows how to use the APIs in Business Central to code your own agents in AL. It starts with the agent type, which acts as a blueprint and is defined through enum extensions for the agent metadata provider and the Copilot capability, plus three interfaces: agent factory, agent metadata and task execution. These cover default settings, runtime behavior and message validation.
It then covers agent instances, which are also users in Business Central, and how to create them with setup pages and the agent setup codeunit, tracked in your own table. The second half covers the tasks and messages API, multi-turn interactions, triggering tasks, getting task results, agent session events, and exposing an agent to other apps through public codeunit functions.
Key points
- Agents are modeled as instances, which are also users in Business Central. Each instance keeps its own permissions, profile, user settings and instructions.
- An agent type is defined with enum extensions for the agent metadata provider and Copilot capability. It uses the agent factory, agent metadata and task execution interfaces.
- The task execution interface supports input and output message validation. Examples are relevance checks, warnings on input messages, and adding a signature to output messages.
- You must make your own table to track agent instances, and it needs user security. Instances can be created from a setup page or programmatically through the agent codeunit, but only within a user session.
- Tasks are units of work bound to one agent instance. Multi-turn interactions are done by adding several input messages. The external ID field on messages ties them to something like an email thread.
- Polling the agent task status field to wait for results is suited to unit testing and non-production scenarios. Events that fire only in agent sessions are also covered, along with the is-agent-session procedure.
- By default the AL API only works with agents defined in your own app. To share an agent, expose public functions in a codeunit that other apps can call.
Features
Every feature below: status not stated, demoed.
| Feature | At |
|---|---|
| Agent Type Definition | 0:55 |
| Agent Factory Interface | 2:14 |
| Agent Metadata Interface | 2:47 |
| Task Execution Interface | 3:10 |
| Message Validation API | 3:36 |
| Agent Instances | 4:48 |
| Agent Setup Page | 5:45 |
| Agent Setup Codeunit | 7:12 |
| Programmatic Agent Creation | 8:34 |
| Agent Instructions | 9:11 |
| Agent KPI Pages | 9:32 |
| Tasks API | 10:02 |
| Task and Message Model | 10:26 |
| Message Attachments | 11:46 |
| Multi-turn Agent Interactions | 12:20 |
| External ID for Messages | 12:35 |
| Agent Task Triggering | 12:56 |
| Agent Task Codeunit Management | 13:17 |
| Task Result Polling | 13:31 |
| Agent Session Events | 13:56 |
| Is Agent Session Procedure | 14:26 |
| Exposing Agents via API | 14:44 |
AL objects mentioned
As heard in the captions. A name that matches one object page by exact type and name links to it; the others stay as named.
- enum “agent metadata provider enum” at 1:10
- enum “Copilot capability enum” at 1:23
- interface “agent factory interface” at 2:14
- interface “metadata interface” at 2:47
- interface “task execution interface” at 3:10
- codeunit “agent setup code unit” at 7:28
- codeunit “agent code unit” at 8:44
- codeunit “agent task code unit” at 10:13
- codeunit “task builder code unit” at 11:17
- codeunit “message builder code unit” at 11:59
- codeunit “agent session code unit” at 14:26
- table “setup table” at 11:17
Not found in BC28-30: enum “agent metadata provider enum”, enum “Copilot capability enum”, interface “agent factory interface”, interface “metadata interface”, interface “task execution interface”, codeunit “agent setup code unit”, codeunit “agent code unit”, codeunit “agent task code unit”, codeunit “task builder code unit”, codeunit “message builder code unit”, codeunit “agent session code unit”, table “setup table”.
Quotes
- 0:05 “Today we will see how we can use the APIs provided in Business Central to code our own agents.”
- 0:17 “you can get the latest version of the VS Code extension. And use the new project command to access our templates.”
- 5:02 “In Business Central, agents are modeled via instances which are also users in Business Central.”
- 7:12 “you will need to make your own table to track your own instances. It needs to be a table that has the user security”
- 10:26 “For tasks, you can imagine them as units of work for the agent. They are bound to a specific agent instance.”
- 10:59 “Multi-turn interactions are also supported because you can insert multiple input messages, and the agent might answer multiple times.”
- 14:44 “By default, the AL API only supports interacting with agents defined in your own app.”
Presenters (as heard): Unknown Speaker.
