Agent Mode Overview
APD includes an AI-powered Agent Mode that helps you design and build portals through natural language conversation. The agent can create actions, templates, and content by understanding your requirements and using built-in tools.
What is Agent Mode?
Agent Mode is a conversational AI assistant that:
- Understands portal design requirements
- Creates and modifies actions, templates, and content
- Queries Business Central tables and fields
- Compiles actions automatically
- Maintains context across sessions
Supported AI Providers
APD supports multiple AI providers:
| Provider | Description | Best For |
|---|---|---|
| Azure OpenAI | Microsoft Azure-hosted OpenAI | Enterprise with Azure subscription |
| ChatGPT OpenAI | Direct OpenAI API | General use |
| Anthropic (Claude) | Anthropic's Claude models | Complex reasoning tasks |
| LM Studio | Local AI model hosting | Offline/privacy requirements |
Agent Capabilities
The agent has access to these tools:
Action Management
| Tool | Description |
|---|---|
list_actions |
List all existing actions |
get_action |
Get details of a specific action |
new_action |
Create a new action |
update_action |
Update a field on an action |
compile_action |
Compile a specific action |
compile_all |
Compile all actions |
Template Management
| Tool | Description |
|---|---|
list_templates |
List all templates |
search_templates |
Search templates by name and HTML body |
get_template |
Get HTML content of a template |
save_template |
Save HTML content to a template |
Content Management
| Tool | Description |
|---|---|
list_content |
List all content items |
get_content |
Get content (markdown) |
save_content |
Save content |
Script Management
| Tool | Description |
|---|---|
get_script |
Get the script source of a Script-type action |
save_script |
Save and compile the script of a Script-type action |
Security
| Tool | Description |
|---|---|
add_profile |
Create a security profile (used by the <?profile?> tag and on action security settings) |
Business Central Discovery
| Tool | Description |
|---|---|
get_tables |
Search for BC tables by name |
get_fields |
Get all fields in a specific table |
How Agent Mode Works
┌─────────────────────────────────────────────────┐
│ Your Request │
│ "Create a customer list page with name, │
│ city, and balance columns" │
└─────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ AI Processing │
│ Agent understands requirements and plans │
│ tool calls │
└─────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ Tool Execution │
│ 1. get_tables('Customer') │
│ 2. get_fields(18) │
│ 3. new_action('CUSTOMER-LIST') │
│ 4. save_template(...) │
│ 5. update_action(..., 'HTML Template') │
│ 6. compile_action('CUSTOMER-LIST') │
└─────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ Result │
│ Action and template created and compiled │
└─────────────────────────────────────────────────┘
Agent Knowledge
The agent understands:
- APD template tag syntax (
<?field()?>,<?loop()?>, etc.) - Navigation between actions (
<?action()?>) - Template composition with
<?parse()?>includes - Expression syntax and functions
- Table and field naming conventions
Session Memory
The agent maintains notes across sessions through a special content item ai.progress. This allows the agent to:
- Remember project context
- Track what has been built
- Maintain consistency in naming
Custom Instructions
You can provide project-specific instructions by creating a content item called ai.instructions. The agent will include these in its context for every conversation.
Example Instructions
# Portal Instructions
This is a customer self-service portal.
## Design Guidelines
- Use Bootstrap 5 for styling
- All pages should include the header and footer templates
- Customer data must be filtered to the logged-in customer
## Naming Conventions
- Actions: Use KEBAB-CASE (e.g., CUSTOMER-LIST)
- Templates: Use lowercase with hyphens (e.g., customer-list)
Getting Started
- Configure Agent Setup
- Open Agent Development page
- Start conversing with the agent
- Review and test generated components