Call a Copilot Studio agent from Power Automate and pass it the data it needs
Use Execute Agent and wait to send a Copilot Studio agent an email's subject, sender and received time from Power Automate, then act on its reply. Includes JSON replies, follow-up questions, which agents work and the limits.
Copilot StudioFix a problem13 min read
A new email arrives, and you want a Copilot Studio agent to read it and tell your flow what to do next. Is it sales or support? How urgent is it? Power Automate can call a published agent with one action, Execute Agent and wait, and pass the agent's answer to the next step. The catch is that the action has a single Message box, so the subject, the sender and the received time all have to travel in that one message.
Before you start
| You need | Why |
|---|---|
| An agent on the standard harness | The connector works with standard-harness agents. Agents on the GitHub Copilot harness need another route |
| The agent published | The action calls a published agent. Publish again after every change: Microsoft notes that unpublished changes don't reach the agent's users |
| A Microsoft Copilot Studio connection | You sign in with Microsoft Entra ID when you add the action. Microsoft marks this connection as not shareable, so decide whose account it uses before the flow goes live |
| A licence that can publish | Trial licences can't publish. See Copilot Studio licensing and Copilot Credits |
Two design points before you build:
- Write the agent to finish in one reply. Nobody is on the other end to answer a clarifying question, so the message has to carry everything the agent needs.
- Check what the agent can reach. Microsoft's pages for this action don't say whose permissions the agent uses for its knowledge and tools when a flow calls it. Run the flow with the account its connection uses, against real data, before you trust the answers.
New to building agents? Start with Your first agent: instructions, knowledge and testing.
The action, field by field
Execute Agent and wait sends a message to the agent and waits for its answer before the flow moves on.
| Field | Required | What it's for |
|---|---|---|
| Agent | Yes | The published agent to call |
| Message | No, but it's where your data goes | The instructions and the data for this run. Mix typed text with dynamic content from earlier steps |
| Locale | No | The language of the message, as a BCP-47 tag such as en-US or fr-FR |
| Conversation ID | No | An existing conversation to continue. See Ask a follow-up in the same conversation |
| Environment ID | No | The environment that contains the agent |
What comes back, as dynamic content:
| Output | What it holds |
|---|---|
| lastResponse | The agent's last text reply. Use this one in most flows |
| responses | The agent's text replies, as a list |
| conversationId | The conversation's ID, for follow-ups and for tracing a run |
The connector reference also lists fields named contentType, contentUrl, content, name and thumbnailUrl, without saying what they do. This guide doesn't use them.
Tip
When nothing later in the flow uses the answer, choose Execute Agent. The flow moves straight on, and the only output you get back is the conversation ID.
Pass several values in one message
Everything the agent needs goes into Message. Microsoft's documentation supports two ways to structure it.
Labelled lines
Type a short instruction, then one line per value, and insert each value from the dynamic content picker. Here, each name in square brackets is a value from the email trigger:
Triage this email. Reply with JSON only, using these keys:
category (Sales, Support or Other), priority (High, Normal or Low)
and summary (one sentence).
Subject: [Subject]
From: [From]
Received (UTC): [Received Time]
Preview: [Body Preview]
Labels let the agent tell the values apart, and they make the run history easy to read. Start here.
JSON
Microsoft's documentation for the same action, written for code apps, says the message can be a JSON string for structured data. Don't glue the JSON together from pieces of text: Microsoft's expression cookbook warns that a value containing quotes breaks it. Build the object in a Compose action instead, inserting each value from dynamic content. Written out with expressions, the Compose input is:
{
"subject": "@{triggerBody()?['subject']}",
"from": "@{triggerBody()?['from']}",
"receivedUtc": "@{triggerBody()?['receivedDateTime']}",
"preview": "@{triggerBody()?['bodyPreview']}"
}
Then set Message to this expression, which turns the object into text:
string(outputs('Compose'))
With JSON, the instructions belong in the agent itself, for example: "Messages from the email flow are JSON with the keys subject, from, receivedUtc and preview. Reply with JSON only, using the keys category, priority and summary."
Whichever way you choose, tell the agent what's coming. Microsoft's troubleshooting for this action lists a message in a format the agent doesn't expect as one cause of empty or unexpected replies.
Times arrive in UTC
The trigger's Received Time (receivedDateTime) is in UTC: Microsoft Graph defines that property as always UTC, and Power Automate works in UTC by default. Label it, as in the example, or convert it before you send it:
convertTimeZone(triggerBody()?['receivedDateTime'], 'UTC', 'Eastern Standard Time', 'yyyy-MM-dd HH:mm')
Replace Eastern Standard Time with your own time zone's Windows name, from Microsoft's Default Time Zones list. The functions reference notes that you might need to drop punctuation from the name.
Send the preview, not the whole body
Body Preview holds the start of the email as plain text; Microsoft Graph defines it as the first 255 characters. Body can be HTML (the trigger has an Is HTML output) and can be much longer. Send Body only when the agent needs the whole email.
Work through it
The example below triages new emails: an agent classifies each one, and the flow routes the urgent ones. It follows Microsoft's documentation. We haven't run this exact flow, so try it on a few real emails before you rely on it.
- A new email arrives
- Execute Agent and wait
- Parse JSON reads lastResponse
- A condition routes urgent email
Choose which emails reach the agent
- Create an automated cloud flow with the Office 365 Outlook trigger When a new email arrives (V3).
- Narrow it with the trigger's own filters, such as Folder, From, Subject Filter, Importance or Only with Attachments. Every email that gets through becomes a call to the agent, so filter here.
- Know what the trigger skips: emails larger than 50 MB or your Exchange limit, whichever is smaller. Protected emails can be skipped too, and so can emails whose body or attachments are invalid. If some emails never start a run, work through Why didn't my flow trigger?.
Call the agent
- Select +, then Add an action, and search for Microsoft Copilot Studio.
- Select Execute Agent and wait. Sign in if you're asked to.
- In Agent, choose the published agent.
- Build Message as shown in Labelled lines.
If you'd rather type expressions than pick values, these read the same fields, per Microsoft's expression reference:
triggerBody()?['subject']
triggerBody()?['from']
formatDateTime(triggerBody()?['receivedDateTime'], 'yyyy-MM-dd HH:mm')
triggerBody()?['bodyPreview']
They read the current email, so they assume each email starts its own run (the trigger's Split on setting). If one comes back empty, pick the value from dynamic content instead.
Turn the reply into fields
The agent answers in text, in lastResponse. Because the message asked for JSON, you can turn that text into fields:
- Add Parse JSON. For Content, choose lastResponse.
- Select Generate from sample, paste an example of the reply you asked for (below), and select Done.
- category, priority and summary now appear as dynamic content in later steps.
{
"category": "Support",
"priority": "High",
"summary": "The sender can't sign in after resetting their password."
}
Microsoft's own code example for this action also parses the agent's reply as JSON. For schema problems, see Dynamic content missing? Parse JSON, nested arrays and loops explained.
Act on the answer
Add a Condition that checks whether priority is equal to High. If it is, post the summary to your team's channel or create a case. If not, move the email to a folder for later.
Plan for a reply you can't use
Plan for a reply that isn't the JSON you asked for. Put Parse JSON and the steps that use it inside a Try scope. In Catch, send the email to a person with the agent's raw lastResponse, so nothing is lost. Try, catch and finally: error handling with scopes shows the pattern.
If replies often miss the format, move the format rules into the agent's instructions, check them in the agent's test pane, and publish again.
Ask a follow-up in the same conversation
To continue a conversation instead of starting a new one, pass the first call's conversationId into Conversation ID on a second Execute Agent and wait. For example, after the triage call, a second call with the message "Draft a two-line reply to the sender" carries on from the first.
Microsoft doesn't say how long a conversation stays available for this, so make follow-ups in the same flow run.
Which agents you can call
Microsoft's page on calling agents from Power Automate covers two harnesses:
- Standard harness: call the agent from a cloud flow with the Microsoft Copilot Studio connector, as in this guide.
- GitHub Copilot harness: the connector doesn't support these agents. Instead, build a workflow in Copilot Studio and add an agent node. Choose An existing agent, pick the published agent, and write Message with dynamic content from earlier steps. The workflow waits for the agent, and later steps use its response. Usage-based billing on this harness can apply while you build and test, as well as when it runs.
You choose the harness when you create an agent, and an agent can't be moved from one harness to the other later. If you plan to call an agent from Power Automate, create it on the standard harness.
A flow, or an event trigger on the agent?
Copilot Studio can also start an agent by itself when something happens, such as a new email, with an event trigger. You add the trigger on the agent, and you can edit it later in Power Automate. When the event happens, the trigger sends the agent a payload, the event's data plus any instructions you add, as a message.
Points to weigh, per Microsoft's documentation:
- On standard-harness agents, event triggers need generative orchestration turned on.
- They sign in with the agent author's credentials only. Once an agent with these triggers is published, the people who use it might reach information, or get the agent to take actions, with the author's credentials.
- Event trigger activity counts towards billing, payloads included.
- Admins can block event triggers with data policies.
Choose the flow when the steps after the answer must happen the same way every time: a condition, a case, a log entry. Choose an event trigger when you want the agent to decide what to do. The opposite direction, an agent calling a flow, is covered in Cloud flow, agent flow or desktop flow? Which one to build.
Cost and limits
- The flow itself uses Power Automate licensing, not Copilot Credits. Microsoft lists the Copilot Studio connector as Standard, and a flow without premium connectors can run on a Microsoft 365 licence.
- The agent's work is measured in Copilot Credits. Copilot Studio charges by the features an agent uses, for example 2 credits for a generative answer and 5 for an agent action. Microsoft's rate table has no separate line for calls from a flow. Copilot Studio licensing and Copilot Credits explains the rates.
- See the real cost per email. After a few runs, open the agent's Monitor page; billing data can take a few hours to appear. You can cap an agent's monthly credits in the Power Platform admin center, under Licensing > Copilot Studio > Manage Agents.
- If the tenant uses more than its prepaid capacity: when usage reaches 125% of it, Microsoft disables custom agents and rejects new attempts to invoke them until capacity is added or resets. Make sure a failed call alerts someone.
- Throttling: the connector allows 300 calls per connection every 60 seconds.
- Timeouts: Microsoft doesn't publish how long Execute Agent and wait waits for an answer.
When it doesn't work
| Symptom | What to check |
|---|---|
| The agent isn't in the Agent list | It must be published and on the standard harness. If you set Environment ID, it must be the environment that contains the agent |
| The reply is empty or off-topic | Microsoft's troubleshooting for this action: the agent is published, the message is in the format the agent expects, and the agent has topics set up to handle it. Try the same message in the agent's test pane |
| Parse JSON fails | The reply isn't the JSON you asked for. Tighten the format rules and catch the failure |
| Times are hours out | Received Time is UTC. Label it or convert it |
| Some emails never start a run | The trigger skips very large emails and may skip protected ones. See Why didn't my flow trigger? |
| Calls fail when many emails arrive at once | The connector allows 300 calls per connection every 60 seconds |
| Every call fails, for every email | The tenant may be over its prepaid Copilot Credits. Ask your admin to check Licensing > Copilot Studio in the Power Platform admin center |
The steps follow Microsoft's documented behaviour as of 11 October 2026. The example message, schema and routing are our own and haven't been run in a tenant.
Sources
- Microsoft Learn: Call Microsoft Copilot Studio agents from Power Automate
- Microsoft Learn: Microsoft Copilot Studio connector reference
- Microsoft Learn: Connect your code app to Microsoft Copilot Studio agents: message, response and troubleshooting
- Microsoft Learn: Office 365 Outlook connector reference: When a new email arrives (V3)
- Microsoft Learn: Trigger a cloud flow based on email properties
- Microsoft Learn: Microsoft Graph message resource type: receivedDateTime and bodyPreview
- Microsoft Learn: Expression cookbook for cloud flows
- Microsoft Learn: Reference guide to functions in expressions for Azure Logic Apps and Power Automate
- Microsoft Learn: Workflow Definition Language schema reference: expressions and string interpolation
- Microsoft Learn: Perform data operations in workflows: Compose and Parse JSON
- Microsoft Learn: Default Time Zones (Windows time zone names)
- Microsoft Learn: Customize or format date and time values in a flow
- Microsoft Learn: Convert a time zone in Power Automate
- Microsoft Learn: Schema reference for triggers and actions: Split on
- Microsoft Learn: Common ways to use a form in a flow: Parse JSON with Generate from sample
- Microsoft Learn: Key concepts: publish and deploy your agent
- Microsoft Learn: FAQ for Copilot Studio billing and licensing
- Microsoft Learn: Language support in Copilot Studio
- Microsoft Learn: Harnesses in Copilot Studio
- Microsoft Learn: Agents powered by the GitHub Copilot harness overview
- Microsoft Learn: Add an agent node to a workflow
- Microsoft Learn: Event trigger overview
- Microsoft Learn: Add an event trigger
- Microsoft Learn training: Make your agent autonomous in Copilot Studio
- Microsoft Learn: Copilot Studio billing rates and management
- Microsoft Learn: View an agent's billing consumption
- Microsoft Learn: Power Automate licensing FAQ
Did this fix it?
Comments
No comments yet. Share what worked for you.
Sign in to comment. Comments show under a display name you choose, never your email.