Getting Started
Get the apps, declare dependencies, then call GenerateText from AL.
Get from zero to a working GenerateText call: install the apps, declare dependencies, then call "AIOS Client" with a provider model.
Prerequisites
- Install the AL Language extension.
- Ensure Business Central Application symbols are available (Application 28.x).
- Have a sandbox or dev environment you can publish extensions to.
Source repository: GuillemPM/AL-AI-Toolkit (MIT).
Get the apps
The SDK ships as several standalone Business Central extensions. You can install the packaged apps, or clone the repository and build them yourself.
| Route | Use when |
|---|---|
| Download a release | You want to consume the SDK from your own app |
| Build from source | You want to change the SDK, or run the demo and tests |
Download a release
Packaged .app files are published on the Releases page. Download the apps you need, then upload them in Business Central under Extension Management, using Manage > Upload Extension.
Install in dependency order, because Business Central rejects an app whose dependencies are not present yet:
- AI Open SDK (core).
- AI Open SDK Provider Utils, if you install OpenAI, OpenCode Zen, or OpenAI Compatible.
- The provider apps you call.
Build from source
Clone the repository once, then package and publish the stack to your environment:
git clone https://github.com/GuillemPM/AL-AI-Toolkit.git
cd AL-AI-ToolkitEvery folder under apps/ is a standalone AL extension with its own app.json and src/. Open AL-AI-Toolkit.code-workspace for the whole stack, or open a single app folder if you only work on one.
-
Open
apps/AIOpenSDK.Core, point.vscode/launch.jsonat your environment, then run AL: Download Symbols once. This fills the shared.alpackages/. -
From the repository root, package core and Provider Utils so the provider apps can resolve them:
./scripts/prepare-deps.sh # Linux or macOS.\scripts\prepare-deps.ps1 # Windows -
Publish core, Provider Utils, and the providers to your dev endpoint:
$env:BC_USERNAME = 'YOUR_USER' $env:BC_PASSWORD = 'YOUR_PASSWORD' .\scripts\publish-apps.ps1The target comes from
apps/AIOpenSDK.Core/.vscode/launch.json. Override it withBC_SERVER, or with-Serveron the script. There is apublish-apps.shfor Linux and macOS.
Alternatively, open a single app and use Package and Publish from VS Code. Full workflows, including provider-only development, live in docs/DEVELOPMENT.md.
Choose apps
Provider adapters ship as separate Business Central apps. Your extension depends on core plus each provider you call. "AIOS Mock" lives in core, so tests need no extra app.
| Need | Depend on |
|---|---|
| Client + Mock tests | AI Open SDK (core) |
| Anthropic | Core + AI Open SDK Anthropic |
| OpenAI chat / image | Core + AI Open SDK OpenAI |
| OpenCode Zen | Core + AI Open SDK OpenCode Zen |
| Any Chat Completions URL | Core + AI Open SDK OpenAI Compatible |
OpenAI, OpenCode Zen, and OpenAI Compatible also require AI Open SDK Provider Utils; that dependency is declared on the provider app, so you usually do not list it yourself.
Example app.json fragment for Anthropic:
"dependencies": [
{
"id": "f624c4ac-75e8-4ce4-9a31-c2d6ff2a05a1",
"name": "AI Open SDK",
"publisher": "Guillermo Padilla",
"version": "0.1.0.0"
},
{
"id": "b6caa435-9837-4155-9932-0b591bdeb4d1",
"name": "AI Open SDK Anthropic",
"publisher": "Guillermo Padilla",
"version": "0.1.0.0"
}
]App Ids match the published toolkit packages. Prefer the Ids from your symbol feed or the release you installed if they differ.
Approve the provider and assign permissions
Two setup steps in Business Central stop the first call from failing. Do them once per company before you call a live provider.
-
Approve the privacy notice. Each provider app registers a privacy notice, because it sends data outside Business Central. Open Privacy Notices Status, find the provider (for example AI Open SDK Anthropic), and agree to it. Until then, calls to that provider fail with an
InvalidRequesterror."AIOS Mock"needs no approval. To check the approval from AL, see Error handling. -
Assign permissions. Users who run your AI features need the SDK permission sets for the provider they call. Each provider set already includes core:
Provider Assignable permission set Anthropic AIOS Anthropic User OpenAI AIOS OpenAI User OpenCode Zen AIOS OCZen User OpenAI Compatible AIOS Compatible User Mock only (tests) AIOS User Mock
To give users one permission set for your whole feature, include the non-assignable object sets in your own. For OpenAI, OpenCode Zen, and OpenAI Compatible, also include AIOS ProvUtils Objects:
permissionset 50100 "MYAPP AI User"
{
Assignable = true;
Caption = 'My App - AI User';
IncludedPermissionSets =
"AIOS Objects", // core client, schema, tools
"AIOS Anthropic Objects", // the provider you call
"MYAPP Objects"; // your own objects
}
First call
Load the API key into SecretText, bind a model from the provider factory, and call "AIOS Client":
Anthropic: Codeunit "AIOS Anthropic";
Client: Codeunit "AIOS Client";
Result: Codeunit "AIOS Generate Result";
ApiKey: SecretText;
begin
// Load into SecretText from Isolated Storage / setup
Result := Client.GenerateText(
Anthropic.Model('claude-fable-5', ApiKey),
'Hello');
Message(Result.Output());
end;
GenerateText returns "AIOS Generate Result" and errors on failure, so there is no status code to check on the happy path. Result.Output() holds the reply text, and the Message above shows something like:
Hello. How can I help you today?The same result carries the raw response and usage alongside the text, which is what you inspect while wiring things up:
| Accessor | Example value |
|---|---|
Result.Output() | Hello. How can I help you today? |
Result.HttpStatusCode() | 200 |
Result.GetStepCount() | 1 |
Result.GetTotalInputTokens() | 9 |
Result.GetTotalOutputTokens() | 12 |
Full surface: AIOS Generate Result.
Keep API keys as SecretText end to end (hidden in the debugger; HTTP headers use the SecretText overloads).
What to try next
| Goal | Start here |
|---|---|
| Structured JSON | Structured output |
| Tool calling | Tools |
| Temperature, length, reasoning | Request options |
| Handle failures | Error handling |
| Unit tests without keys | Mock |
| Provider setup | Providers |
Interactive samples live in the toolkit repo under apps/AIOpenSDK.Examples/ (demo page "AIOS Toolkit Demo" and usage codeunits).