Building a Custom AI Agent in Business Central – Part 2: Writing the Prompt

In Part 1, we looked at the architecture behind a custom AI Agent in Microsoft Dynamics 365 Business Central.

In this part, we move to one of the most important parts of building an agent: writing the prompt and instructions.

For our example, we will use a Purchase Order Follow-Up / Overdue Agent.

The goal is simple: create an agent that can help users identify overdue purchase orders and follow up on them while keeping the user in control.

Why Are Agent Instructions Important?

When creating an AI Agent in Business Central, the code is only one part of the solution.

The instructions given to the agent are equally important.

A well-written prompt tells the agent:

  • What it is responsible for
  • What it should and should not do
  • How it should make decisions
  • When it should ask the user for help
  • When it should request approval
  • Which Business Central tools it should use

If the instructions are unclear, the agent may produce confusing or incorrect results.

Think of the prompt as the rulebook for your Business Central AI Agent.

Screenshot_4

A Simple Instruction Framework

A good Business Central agent prompt can be divided into three main sections:

  1. Responsibilities
  2. Guidelines
  3. Task Instructions

Let’s look at each one.

1. Responsibilities

The Responsibilities section defines what the agent is accountable for.

It establishes the scope and boundaries of the agent.

For example, a Purchase Order Overdue Agent could be responsible for:

  • Finding overdue purchase orders
  • Reviewing expected receipt dates
  • Identifying purchase orders that require follow-up
  • Providing relevant purchase order information to the user
  • Helping prepare follow-up actions

The important point is to keep the responsibility focused.

Don’t try to make one agent responsible for the entire Procure-to-Pay process.

A clearly defined scope helps the agent prioritize its work and reduces unintended behaviour.

2. Guidelines

Guidelines shape the agent’s personality, safety boundaries, and decision-making style.

This acts like your “rulebook.”

They can include:

  • Tone (e.g., professional, concise, polite)
  • When to ask for clarification
  • How to handle missing or incomplete information
  • How to present results

Guidelines are especially important in complex or multi-step processes.

Guidelines

2. Guidelines

This is where the agent receives concrete steps — the procedural knowledge.

Typical structure:

  • Ordered lists

  • Sub‑steps

  • Deep nesting for complex tasks

These instructions act as a workflow backbone.

The more explicit your instructions, the more reliable the agent becomes.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Instruction
5
6
7

The next blog will show how to create agent from Code

  1. Register Capability
  2. Extending Interfaces
  3. Writing code for creating Agent task

Until then, stay connected with me on LinkedIn and YouTube for more Business Central insights!

Leave a Reply

Your email address will not be published. Required fields are marked *