How to build an autonomous agent in Copilot Studio

Copilot Studio Power Platform How-to Autonomous Agents

In this post you build a Customer Escalation Agent in Microsoft Copilot Studio. It listens for new mail, runs the body through AI Builder sentiment analysis, looks up the sender in Dataverse, and posts a short Teams alert to the account manager (or a Support Leads channel if there is no match). You can optionally create a Case in Dynamics 365 Customer Service as well.

An autonomous agent listens for an event trigger, receives a payload, reasons over the data, and acts without a user chat prompt. You already know the trigger-and-action idea from Power Automate. The difference is that the agent can interpret the payload and choose tools at runtime, instead of following only the branches you hard-coded.

That does not make agents a replacement for Power Automate. If the logic is the same every time and does not need judgement, keep a cloud flow. Flows are usually cheaper and easier to scale. Use an agent when the path depends on classification, sentiment, or data the agent must fetch before it knows who to notify. For a product-style example on the sales side, see Sales Close Agent in Dynamics 365.

What you need in the environment

Turn on generative orchestration in the Copilot Studio environment. Event triggers depend on it. Every connector the agent uses must have working maker authentication, because event triggers run as the maker, not as the person who sent the email. If a connection expires, the agent can stop without a clear error. I check connection status before every publish and I re-authenticate on a schedule rather than waiting for a silent failure.

You also need:

Microsoft documents connector authentication in Copilot Studio in more detail.

The scenario: escalate a customer complaint

A customer writes to a shared mailbox. The agent fires on the new email, passes the body to the Sentiment analysis tool, and continues only when the label is negative or mixed. It finds a Contact whose email matches the sender, walks to the parent Account, reads the account manager, and sends a Teams message with the customer name, subject, and a one-sentence summary. If no Contact matches, it posts to a Support Leads channel instead. Optionally it creates a Case in Dynamics 365 Customer Service.

That is the end-to-end path we configure below.

Create the agent and turn on generative orchestration

Sign in to Copilot Studio. In the left navigation, open Agents and choose New agent. Name it something clear, for example Customer Escalation Agent. On the overview, confirm that generative orchestration is enabled so the agent can choose tools from the payload instead of only walking a fixed topic tree.

If you are still sorting out instructions, topics and tools, read Copilot Studio topics, instructions, and actions explained first.

Add the email event trigger

Open the Triggers area for the agent, select + Add trigger, and choose an event trigger. For this scenario use When a new email arrives (Outlook), or a Dataverse-based path if your organisation already turns mail into Dataverse rows. Point the trigger at the mailbox you intend to monitor, set folder filters if you need them, and decide whether attachments matter for this design.

The trigger produces a payload (sender, subject, body, timestamp, and related fields). You can also put directions inside that payload so this trigger only gets instructions that apply to mail, not to every other event you might add later. Out-of-the-box triggers also cover Dataverse row changes, SharePoint items, OneDrive files, Planner tasks and recurrence; see Microsoft’s event triggers overview.

Give the agent its tools before you write long instructions

On the Tools tab, add the connectors and models the agent must call. Do this before you polish the instructions, so you are not describing tools that are not there yet.

Each tool needs a healthy connection. If status is Not connected, open the connection and sign in again with an account that has rights to those systems.

If your support team keeps escalation notes in SharePoint, you can also add SharePoint as a knowledge source so the agent can lean on those pages when it summarises or routes the complaint.

Write agent instructions that call tools, not reinvent them

Open the agent Instructions panel. Tell the agent how to order the tools. Do not restate the full behaviour of AI Builder or Dataverse inside the prompt. A working pattern looks like this:

You are a customer escalation agent. When you receive an email, pass the email body to the Sentiment analysis tool. The tool returns a label: positive, negative, neutral, or mixed. Only proceed when the label is negative or mixed. Look up the sender’s email address in the Contact table in Dataverse, retrieve the parent Account record and the account manager. Send a Teams message to the account manager with the customer name, email subject, and a one-sentence summary. If no matching contact exists, post the message to the Support Leads channel.

The AI Builder Sentiment analysis model returns labels and confidence scores at document and sentence level. Your instructions should say “call the tool and act on the label,” not “decide whether the customer sounds upset.” That is more stable when the same email could be read two ways by a model left on its own.

Keep the instruction set short enough that the agent does not chain endless actions. Microsoft recommends staying under about 15 consecutive actions or topics so you do not hit orchestration limits.

Agent instructions versus payload instructions

Copilot Studio gives you two places for directions, and you should separate them as soon as you have more than one trigger.

Agent instructions live on the agent overview. They apply to every trigger and conversation: role, default tools, and the overall workflow (for example, “you are a customer escalation agent”).

Payload instructions sit on the trigger itself. They travel with that event’s data. When you add or edit a trigger, you can put directions in the payload message field so the agent knows what this event is for.

Microsoft’s own duplicate-check example uses the split well: the agent instruction describes what to do when a duplicate exists; the payload instruction on the Dataverse trigger says to look for duplicate account names in that table. One layer is “what to do about it,” the other is “what this event is asking.”

If you later add a high-priority Case trigger next to the email trigger, keep email-only wording in the email payload. If everything sits in the agent instructions, the agent may apply mail logic to a Case event or the other way round. Conflicting payload and agent text can produce errors or odd runs; Microsoft calls that out in the same triggers documentation.

Rule of thumb: shared behaviour goes in agent instructions; trigger-specific behaviour goes in the payload.

Test and publish

The test chat panel does not drive event triggers. It only handles conversational input. To test this agent, publish (or enable the trigger), send a clearly negative test email to the monitored mailbox (or create the matching Dataverse row if that is your trigger), then open Analytics > Activity. The activity map shows the payload, the instructions followed, and the actions taken. That page is where you debug, not the chat canvas.

What to watch in production

Each trigger payload counts toward Copilot Studio message consumption. Firing the agent on every message in a busy general inbox gets expensive quickly, even when sentiment is positive and nothing else runs.

I recommend a dedicated shared mailbox for complaints rather than a catch-all inbox. In rough numbers:

Watch usage under Power Platform admin centre > Licensing > Copilot Studio. Load limits can throttle the agent and queue triggers. Admins can also block event triggers with DLP at environment level.

For this design I would keep Dataverse access as tight as the job allows (read Contact and Account for the lookup), limit Teams to the channels you intend, and do not let the agent create Cases in production until a person has reviewed the pattern. Microsoft’s autonomous agents guidance covers least privilege, validation, logging and human oversight in more formal language.

If you already own similar work in Power Automate, agent flows can be converted from cloud flows (one-way). Test after conversion. Generative orchestration does not always behave like a fixed condition branch.

Next steps

Start with the dedicated mailbox, maker connections you trust, and Teams alerts only. Add Case creation when the alert quality is good enough. For certification study, this path touches Dataverse, connectors and automation themes that show up on PL-200. More Power Platform material sits under Power Platform guides on this site.