topic hubAL Developmentofficial - Microsoftunreviewed - model text not yet checked

Coding agents in AL

Coding agents in AL (preview) covers building custom Business Central agents in AL code. It answers questions about defining and registering agents, setup pages, programmatic configuration, converting prototyped agents to AL, creating and managing agent tasks, and AI model selection.

Path: Integration with AI > Designing and coding agents (preview) > Coding agents in AL · tier official · system development · narrative unreviewed (model text not yet checked)

Overview

This section is for developers who want to build agents in AL instead of only configuring them in the UI. It centers on three core interfaces (IAgentFactory, IAgentMetadata, IAgentTaskExecution) and a quick-start template. All pages are marked preview.

The pages follow the build sequence. Start with “Coding agents in AL” for the overview and template. Then “Define and register an agent programmatically” covers extending the Agent Metadata Provider enum and registering the Copilot capability. “Create agent setup pages” and “The ConfigurationDialog Page Type” explain the setup UI. “Configure agents programmatically” covers the Agent codeunit. If you already prototyped an agent, “Convert an agent to AL code” shows how to export its settings and package them in an app.

After the agent exists, “Managing agent tasks programmatically” covers creating tasks from page actions, business events and email triggers, plus attachments and lifecycle. “AI Models for Agents” explains model selection, lifecycle and overrides.

Key points

  • Core interfaces for a custom agent: IAgentFactory, IAgentMetadata and IAgentTaskExecution, registered by extending the Agent Metadata Provider enum and registering the Copilot capability.
  • Setup pages use the ConfigurationDialog page type, a modal dialog with OK and Cancel system actions, temporary data sources, and the Agent Setup Part, with reversible changes and persisted configuration.
  • The Agent codeunit configures instances in code, with methods such as Archive, IsArchived, SetInstructions, SetDisplayName, SetProfile and UpdateLocalizationSettings.
  • Converting a prototyped agent means exporting its settings, then implementing instructions, permission sets, default profile, user settings and triggering logic in an AL app.
  • Agent tasks can be created programmatically from page actions, business events and email triggers, with attachments, message tracking and external ID tracking.
  • The agent task builder API and task lifecycle control are covered, including cross-agent operations.
  • AI models for agents support auto model selection, agent-level model specification and task-level override, and the page describes the lifecycle from preview to retirement (2026 release wave 2).
  • Versions named in the pages are 27.4 and 28.1 for the coding and registration features.

Learn pages

Videos, posts and code changes

Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 8 Learn pages