# How to add AI agents to Dynamics 365 Finance and Supply Chain

> Source: https://netray.co/integrations/dynamics-365-fscm-ai-agents
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

Build agents as a thin reasoning layer over a governed tool set: OData data entities and custom services for reads, business events as triggers, and a human approval step before any write. Microsoft ships its own Copilot and agent features, so decide first whether those cover your process or whether you need a custom agent over your own model.

## System

Microsoft Dynamics 365 Finance and Supply Chain

## Capability

ai-agents

## Intro

Most Dynamics 365 Finance and Supply Chain Management (FSCM) teams already feel the pain agents target: planned order firming that nobody has time to review, purchase order confirmations chased by email, and vendor invoices that stall in workflow because one line does not match. The planners know the rules, but the volume of exceptions outruns the people.

An agent here is not a chat window. It is a loop that watches for a trigger, pulls context through the supported integration surface, reasons about it, and proposes an action that a named person approves. FSCM is a good host for this because its data entities, role-based security and business events give you a clean boundary between what the agent may see and what it may change.

The practical question is build versus buy. Microsoft is steadily adding Copilot and agent capabilities inside the product and in Power Platform, and the exact set varies by release wave. For standard finance and procurement tasks those may be enough. Custom agents earn their place when you need a different model, on-prem inference, cross-system context, or process logic the standard features do not model.

## Use Cases

### Planned order exception triage

**Description:** After master planning runs, the agent reads action messages and planned orders, groups them by cause (late supply, missing lead time, capacity), and drafts a ranked worklist for the planner instead of a flat list.

### Purchase order expediting

**Description:** For confirmed POs approaching a delivery date with no vendor confirmation, the agent drafts a chase email, checks the open production orders that depend on the line, and flags the ones that will actually starve.

### Three-way match resolution

**Description:** When a vendor invoice fails matching against product receipt and PO, the agent identifies the variance type (price, quantity, unit of measure) and proposes a fix or a hold reason for the AP clerk to accept.

### Production order shortage chasing

**Description:** The agent checks released production orders for BOM line shortages, finds on-hand in other warehouses or open transfer orders, and proposes a transfer or substitution.

### Quality order disposition drafts

**Description:** On a failed quality order, the agent assembles test results, lot trace and open orders consuming that batch, then drafts a nonconformance summary for the quality manager.

### Month-end accrual review prep

**Description:** Before close, the agent lists received-not-invoiced receipts and unusual postings by legal entity so the controller reviews exceptions rather than the whole ledger.

## System Surface

OData v4 data entities exposed under the environment /data endpoint, such as released products, purchase order headers and lines, and production orders. Entity names and availability vary by version, so enumerate them from the $metadata document.

Custom services written in X++ and exposed as JSON endpoints under the /api/services path, useful when the agent needs a business action rather than raw CRUD.

Business events, which can publish to Azure Service Bus, Event Grid, Power Automate or an HTTPS endpoint, giving the agent real triggers instead of polling.

Authentication through a Microsoft Entra ID app registration with a service principal mapped to a Finance and Operations user, so the agent inherits that user's security roles and data entity permissions.

The data management framework (DMF) and its package API for bulk export or import, and Synapse Link or Fabric Link for analytical reads where the agent needs history without hitting transactional load.

Service protection and priority-based throttling on the OData layer, which constrain how aggressively an agent may call in production.

## How It Works

### Pick one narrow process

**Detail:** Start with a single exception queue, such as PO confirmations overdue by more than a set number of days. A narrow scope makes the tool list short and the evaluation measurable.

### Register a dedicated Entra app and FSCM user

**Detail:** Create a service identity with a purpose-built security role holding only the entities the agent needs. Never reuse an admin or a human user.

### Define the tool layer

**Detail:** Wrap OData queries and custom services as typed tools: get_open_po_lines, get_production_order_bom, get_vendor_history. Keep reads and writes in separate tool groups.

### Wire triggers from business events

**Detail:** Subscribe the agent to a business event endpoint so it wakes on the condition, instead of scanning the whole database every hour.

### Add a proposal and approval step

**Detail:** The agent writes its proposed action to a queue or a Teams adaptive card. A person approves, then a separate write tool performs the change under that person's context where possible.

### Log every call and decision

**Detail:** Store the prompt, tool calls, entity keys read and the final proposal. This is your audit trail and your evaluation dataset.

### Evaluate on historical cases

**Detail:** Replay a month of past exceptions and compare the agent's proposals with what the planner actually did before enabling it live.

## Example Flows

### Late PO expedite

**Trigger:** A scheduled check finds confirmed PO lines due in 3 days with no vendor confirmation date.

**Steps:**

- Agent reads the PO lines and vendor contact through OData.
- It queries production orders reserving that item to rank urgency.
- It drafts a vendor email and a one-line internal summary.
- The buyer approves in a card; the email is sent from the buyer's mailbox.

**Result:** Buyers touch only the lines that threaten production, with the email already drafted.

### Invoice variance proposal

**Trigger:** A vendor invoice lands in the pending invoice register with a match failure.

**Steps:**

- Agent fetches invoice lines, PO lines and product receipts.
- It classifies the variance and checks vendor price history.
- It proposes accept within tolerance, short-pay, or request credit note.

**Result:** The AP clerk confirms or overrides a pre-analysed case rather than starting from raw lines.

## On Prem

FSCM in the cloud and the on-premises local business data deployment differ here. For the cloud service, the agent can run anywhere that can reach the environment endpoint, including a private network with an open-weight model such as Llama, Qwen or gpt-oss served on your own GPUs through vLLM or Ollama, so prompts and ERP rows never go to a public model API. For on-premises deployments, authentication typically goes through AD FS rather than Entra ID, and the available features lag the cloud, so confirm which entities and business events your build supports before designing triggers. In both cases keep inference, vector stores and logs inside your network boundary.

## Security

- Use a dedicated service identity with least-privilege security roles; the agent can never exceed what that role can do.
- Keep write tools disabled by default and require explicit human approval for every posting, confirmation or status change.
- Respect legal entity and data area boundaries: pass the company explicitly and never let the model choose it.
- Redact vendor bank details and personal data before text reaches a model, and log what was sent.
- Rate limit tool calls to stay within service protection limits and avoid degrading interactive users.

## Options

### Use Microsoft Copilot and agent features inside Dynamics 365

**Fit:** Best when your processes match the standard scenarios and you are comfortable with Microsoft-hosted AI under your tenant agreement.

**Effort:** Configuration and licensing review, typically days to a few weeks.

### Build in-house on Azure AI or an open-weight stack

**Fit:** Fits teams with X++ and integration engineers who want custom logic and full control of the prompts and tools.

**Effort:** Several weeks for one process; the evaluation and approval UX is most of the work.

### Work with a partner such as Netray

**Fit:** Fits manufacturers needing private or air-gapped inference, or agents spanning FSCM and shop-floor or legacy systems, with a Dynamics partner handling configuration.

**Effort:** A scoped pilot over one process, then expansion once approval rates are measured.

## Pitfalls

- Letting the agent write directly to entities because the OData endpoint allows it; entity-level writes can bypass business logic you assumed ran.
- Polling transactional entities every few minutes and hitting throttling during peak posting hours.
- Ignoring company (legal entity) context so the agent reads the wrong entity's data and proposes plausible nonsense.
- Skipping evaluation: a fluent agent can be confidently wrong about unit of measure or lead time.
- Assuming a feature seen in the cloud docs exists in your on-premises or older build.

## Faq

### Does Dynamics 365 FSCM already include AI agents?

**Answer:** Microsoft includes Copilot features and is adding agent capabilities, but the exact set depends on your release wave and licensing. They cover common scenarios. Custom agents make sense when you need a different model, private hosting, or logic and cross-system context the standard features do not provide.

### Which interface should an agent use to read FSCM data?

**Answer:** OData data entities are the usual starting point for reads, with custom X++ services for business actions. For heavy analytical reads, use Synapse Link or Fabric Link so the agent does not load the transactional system. Choose per question, not one path for everything.

### Can an agent post transactions safely?

**Answer:** Only with controls. Keep reads and writes as separate tools, require human approval, run the write under an identity with narrow security roles, and prefer calling a service that enforces business logic over raw entity updates. Start read-only and enable writes per process after evaluation.

### How do business events help?

**Answer:** They let FSCM push a signal when something happens, such as a purchase order confirmation, to an endpoint like Service Bus or Power Automate. The agent reacts to events instead of polling, which cuts load and latency. The catalogue of events varies by version, so check what your environment offers.

### Can the model run on our own hardware?

**Answer:** Yes for the model and orchestration. The agent calls the FSCM endpoint over your network and uses an open-weight model on your GPUs. The ERP itself stays where it is hosted. This keeps prompts and extracted rows inside your boundary, which matters for export-controlled or customer-restricted data.

## Search terms

dynamics 365 finance and supply chain ai agents, d365 fscm ai agent, ai agents for dynamics 365 supply chain management, dynamics 365 finance operations agent, build ai agent dynamics 365 odata, dynamics 365 business events ai, dynamics 365 copilot agents manufacturing, dynamics 365 purchase order ai agent, automate dynamics 365 f&o with ai, dynamics 365 fscm automation agent

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
