How to Build an AI Agent

AI agent for Dynamics 365 planning session with a team mapping agent connections on a glass wall

Last updated: October 5, 2026

By ZapAI Team

TL;DR: Before you build an AI agent for Dynamics 365, check Microsoft’s prebuilt agents, because Sales, Service, and Business Central already ship several. If none fits, define one job and one metric, build in Copilot Studio, connect Dynamics data through Dataverse or Microsoft’s MCP servers, write tight instructions, test with evaluation sets, and pilot with a human approving every action.

To build an AI agent for Dynamics 365, define one task and metric, build it in Copilot Studio, connect data through Dataverse or MCP servers, add least-privilege actions, write instructions, test with evaluation sets, and pilot with human review.

Most first agent projects fail at the whiteboard, not in the code. Someone asks for an agent that handles sales, and three months later there’s a demo that does a little of everything and nothing well enough to trust. Narrow beats clever. Every time.

The good news is that building an AI agent for Dynamics 365 in 2026 is far more straightforward than it was even a year ago. Microsoft now exposes Dynamics data to agents through standard connectors and the Model Context Protocol, and Copilot Studio includes evaluation tools that used to require a data science team.

This is the eight-step process we use on client projects, with the official Microsoft documentation linked at each step so your team can verify every claim.

Should You Build an Agent at All?

Only after checking the prebuilt ones. Dynamics 365 Sales ships qualification, opportunity, close, and research agents, and Business Central ships sales order, payables, and expense agents. Building what Microsoft already maintains is wasted money.

An AI agent for Dynamics 365 is software that uses a language model to read Dynamics data, decide on steps, and take actions such as updating records or drafting quotes, usually with a person approving the result. That’s different from a Copilot chat answer, which only responds.

Microsoft’s list keeps growing. AI agents in Dynamics 365 Sales include a Sales Qualification Agent that researches and engages leads, a Sales Opportunity Agent that flags deal risks, a Sales Close Agent, and a Sales Research Agent for questions about pipeline data. Business Central has its own, covered in our guide to Copilot in Dynamics 365 use cases.

Build custom when your process is genuinely yours. A distributor-specific rule for allocating scarce stock across customers. A warranty check that touches Dynamics and a legacy service database. A field technician assistant that needs your parts catalog. Those are agent-shaped problems Microsoft won’t ship.

Single puzzle piece being placed, representing scoping an agent to one focused job

Step 1. Define One Job and One Metric

Write a single sentence describing what the agent does, for whom, and how you’ll measure it. If it takes two sentences, it’s two agents.

Good examples are concrete. Draft a sales quote from an emailed purchase request within five minutes, for the inside sales team, measured by quotes per day and edit rate. Answer field technicians’ warranty questions from Dynamics 365 Field Service and the warranty table, measured by calls to the support desk.

Bad examples sound like strategy. Help sales be more productive. Improve customer experience. You can’t test those. So you can’t ship them. Simple rule.

Step 2. Choose Your Build Path

Use Copilot Studio for most Dynamics 365 agents, Business Central’s agent designer for agents that live inside Business Central, and Microsoft Foundry when you need custom models or engineering-grade control.

Build pathBest forWho builds it
Copilot StudioSales, Customer Service, Field Service, and cross-app agents in Teams or Microsoft 365Makers with IT support
Business Central agent toolsAgents that work inside Business Central pages and permissionsBusiness Central partners and developers
Microsoft Foundry, code-firstCustom models, heavy retrieval, customer-facing apps outside Microsoft 365Software and AI engineers

Most of our Dynamics agents start in Copilot Studio. If you’re torn, our comparison of Copilot Studio vs custom AI agents walks through the five questions we use to decide.

Step 3. Connect the Agent to Dynamics 365 Data

Add Dataverse tables as a knowledge source for lookups, and connect Microsoft’s MCP servers, such as the Dataverse or Dynamics 365 Sales MCP server, when the agent needs to query, create, or update records.

Dynamics 365 customer engagement apps store their data in Dataverse, so that’s the front door. Copilot Studio can add Dataverse tables as a knowledge source, with synonyms and glossary terms that help the agent understand your column names. One catch in the docs worth knowing early. This knowledge source requires the agent to authenticate users with Microsoft, so anonymous website agents can’t use it.

For actions, MCP is now the cleanest route. Dataverse can act as an MCP server that exposes tools to query records, create and update rows, and describe tables, usable from Copilot Studio and other MCP clients. Dynamics 365 Sales has its own MCP server, and finance and operations apps have an ERP MCP server you add as a tool in Copilot Studio.

There’s a licensing upside buried in the documentation, too. Microsoft states that customers with Dynamics 365 Premium licenses or a Microsoft 365 Copilot user license aren’t charged for agents accessing Dynamics 365 data through these servers. Check your license mix before modeling agent costs. Our Dataverse services team usually tidies table and column descriptions at this stage, because agents read metadata the way new employees read a badly labeled filing cabinet.

Glowing lines connecting a central database to nodes, representing an agent connected to Dataverse through MCP

Step 4. Give It Only the Actions It Needs

Grant the narrowest set of tools and permissions that completes the job. An agent that drafts quotes doesn’t need to delete accounts, approve discounts, or email customers directly.

Agents act through tools, which are connectors, Power Automate flows, or MCP tools. Each one is a door. List the doors the job truly needs. Lock the rest. Run the agent under a service identity or the user’s own identity with a security role built for the purpose, not an administrator account someone created for testing and forgot about.

Draft, don’t commit. That’s our default for the first version of any Dynamics agent. Quotes are created as drafts, emails go to a review queue, and record updates land in a staging state a human confirms. You can loosen it later once the numbers earn trust.

Step 5. Write Instructions Like a Process Document

Give the agent a role, the exact steps, decision rules for edge cases, and the output format. Vague instructions produce vague agents.

  • Role and scope. You draft sales quotes for existing business customers in the US. You don’t handle returns.
  • Steps, numbered, in the order a good employee would follow them
  • Decision rules for edge cases, like what to do when an item is discontinued or a customer is on credit hold
  • Output. Which fields to fill, what to write in the internal note, when to stop and ask a human

Write it the way you’d brief a sharp new hire on their first day. Then hand the instructions to a person who knows the process and ask what’s missing. They’ll find three gaps in five minutes. Always three. Never zero.

Step 6. Test With Evaluation Sets, Not Vibes

Build a test set of real questions and expected answers, run it in Copilot Studio’s agent evaluation, and rerun it after every change to instructions, data, or tools.

Copilot Studio’s agent evaluation runs a set of test cases against the agent, compares responses with expected answers or quality criteria, and scores each one. Test sets can be written by hand, imported from a spreadsheet, or generated with AI, and evaluations can be triggered through APIs for CI/CD pipelines.

Pull test questions from reality. Old support tickets, real customer emails, the questions your inside sales team asked last month. Include the ugly ones, like the email with three products, two typos, and a delivery date that doesn’t exist. Fifty good test cases beat five hundred synthetic ones. Quality wins.

Specialist reviewing agent evaluation results on a laptop with a checklist

Step 7. Pilot With a Human in the Loop

Release to 5 to 15 users for four weeks with human approval on every action, track your metric against a baseline, and review failures weekly.

Watch three numbers. Volume handled, edit rate on drafts, and time saved per task. An edit rate that stays above 50% after two weeks usually means a data or instruction problem, not a model problem. Fix the cause. Rerun the evaluation set. Continue.

Step 8. Monitor, Then Scale Carefully

After the pilot, expand users gradually, keep evaluation runs in your release process, monitor consumption and failure rates monthly, and assign a named owner for every agent.

Agents drift as Dynamics data, products, and policies change. That’s why each one needs an owner, the same way a report or integration does. Budget a few hours a month per agent for review and tuning. No owner? Then no agent. That’s how a useful agent quietly becomes a liability.

Where Agent Projects Go Wrong

Scope creep, dirty data, broad permissions, and no evaluation set. Most failed Dynamics agent projects we’ve reviewed missed at least two of those four.

The quietest killer is ownership. A pilot succeeds, the project team moves on, and six months later nobody remembers why the agent behaves the way it does when the price list changes. Write the instructions down. Keep the test set. Assign the owner before go-live, not after the first incident.

Next Steps

Building an AI agent for Dynamics 365 is now mostly a process problem. Check the prebuilt agents, scope one job, connect data through Dataverse or MCP, lock down actions, test with real cases, and pilot with people in the loop.

ZapAI builds Dynamics 365 agents in Copilot Studio and Microsoft Foundry for teams in the US and India. If you have an agent idea, our Copilot Studio consultants can turn it into a one-page spec with a metric, data map, and test plan before anyone writes a single instruction.

What Teams Ask Before Their First Agent

How long does it take to build a Dynamics 365 agent?

Two to six weeks for a focused Copilot Studio agent, including data prep, testing, and a short pilot. Custom code-first agents with complex retrieval usually take longer.

Do we need developers?

Not always. Makers can build Copilot Studio agents with Dataverse knowledge and standard connectors. You’ll want IT involved for security roles, environments, and MCP connections, and developers only when you need custom code or Microsoft Foundry.

What’s MCP and why does it matter here?

Model Context Protocol is an open standard that lets AI agents call tools and data sources in a consistent way. Microsoft offers MCP servers for Dataverse, Dynamics 365 Sales, and finance and operations apps, so agents can query and update Dynamics data without custom integration code.

Will the agent see data users shouldn’t?

Only if you let it. Agents act with the identity and permissions you assign, so build a purpose-specific security role and avoid admin accounts. Dataverse knowledge sources also require Microsoft authentication, which keeps anonymous users out.

How do we know the agent is good enough to launch?

Set a pass mark on your evaluation set before you start, say 90% of test cases correct with zero harmful actions, then pilot with human approval. If the pilot’s edit rate drops steadily, you’re ready to widen access.

Can one agent handle sales and service?

It can, but it shouldn’t at first. Separate agents with narrow jobs are easier to test, secure, and fix. Connect them later if users want one front door.

Leave a Reply

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

Book a free consultation