Exercise - Create a task notification agent and workflow
In this exercise, you create the Contoso Task Alert Agent, a standalone workflow that sends task notification emails, add the workflow to the agent as a tool with end-user confirmation, and run all four required test paths.
This exercise takes approximately 55 minutes to complete.
Prerequisites
To complete this exercise, you need:
- A Microsoft Entra work or school account.
- Access to Microsoft Copilot Studio.
- Permission to create an agent in a Power Platform environment.
- A Microsoft 365 account with an Outlook mailbox. The Outlook connection uses this account to send email.
- Access to a solution in the environment, if your organization requires agents and workflows to be created in a solution.
Note
Building and testing an agent powered by the GitHub Copilot harness might consume Copilot Credits.
Part 1: Create the agent
Task 1.1 - Create and configure the Contoso task alert agent
Go to Microsoft Copilot Studio at
https://copilotstudio.microsoft.com/and sign in.Confirm that the correct environment is selected.
On the Home page, select Agent. Alternatively, select Agents in the left navigation, and then select New agent.
In the Name field, enter
Contoso Task Alert Agent <your initials>. Replace<your initials>with your initials or another unique value.If your organization requires a solution, in the upper-right corner, select More options (...), and then select Settings. In Agent settings > Agent details, select the solution provided for the exercise from the Solution list.
In Instructions, enter the following text:
You are the Contoso Task Alert Agent. You help operations team members send task notification emails. ## Your role - Help users send task notification emails with consistent, accurate content. - Answer questions about the notification process. - Do not send a notification unless the user explicitly asks you to. ## When a user asks to send a task notification 1. Identify the following required details from the conversation: - Complete work or school email address - Task title - Task details or description - Due date 2. If any required detail is missing, ask the user for it before proceeding. 3. Summarize the notification details for the user and ask them to confirm before sending. 4. When the user confirms, use the Send task notification email tool to send the notification. 5. After the workflow runs, relay the confirmation to the user. ## Boundaries - Do not guess or infer the recipient email address. Always confirm it with the user. - Do not send notifications to multiple recipients in a single workflow call. - If the user cancels at any point, acknowledge the cancellation and do not send the email.Select Save.
Part 2: Create the workflow
Task 2.1 - Create the send task notification email workflow
In the left navigation, select Workflows.
Select New workflow.
Select the Start trigger on the canvas.
On the right panel, set Trigger type to When an agent calls the workflow. Confirm that the canvas contains both the When an agent calls the workflow trigger and the connected Respond to the agent action. If the response action is missing, add Respond to the agent after the trigger.
Task 2.2 - Rename the workflow
Select the Workflow name on the top left of the designer canvas.
For Workflow name, enter:
Send Task Notification Email <your initials>Replace
<your initials>with a unique identifier, such as your initials. For example:Send Task Notification Email CS.Select Save.
Continue working on the workflow canvas.
Task 2.3 - Configure the trigger inputs
Select the When an agent calls the flow trigger to open its configuration panel on the right side of the designer canvas.
Select + Add an input and configure the first input:
Field Value Type Text Input name Recipient EmailDescription The complete work or school email address of the person who should receive the task notification. Do not guess or infer this value.Select + Add an input and configure the second input:
Field Value Type Text Input name Task TitleDescription The short title of the task that the notification is about.Select + Add an input and configure the third input:
Field Value Type Text Input name Task DetailsDescription A brief description of what the task involves, including any relevant context.Select + Add an input and configure the fourth input:
Field Value Type Text Input name Due DateDescription The due date of the task, stated as the user provided it, such as October 15, 2026.Select Save to save your progress.
Task 2.4 - Add the send an email (V2) action
Select the + icon between the When an agent calls the flow step and the Respond to the agent step to insert a new action.
In the search field, enter
Send an email.From the results, select the Send an email (V2) action under the Office 365 Outlook connector.
If this is the first time you use this connector, Copilot Studio prompts you to sign in. Sign in with the Microsoft 365 account that has the Outlook mailbox you want to use for sending notifications.
Note
If a browser pop-up is blocked, allow pop-ups from
https://copilotstudio.microsoft.comand then select sign in again.In the To field, select the Insert dynamic content icon and select Recipient Email.
In the Subject field, enter the following, inserting dynamic content where indicated:
Task notification: [Task Title]To compose this:
- Type
Task notification:followed by a space as static text. - In the Subject field, select the Insert dynamic content icon (lightning bolt) to open the dynamic content panel.
- Under When an agent calls the flow, select Task Title.
- Type
In the Body field, compose the following email body. Use static text for the labels and dynamic content references for the values:
Task notification Task: [Task Title] Details: [Task Details] Due date: [Due Date] This notification was sent by the Contoso Task Alert Agent.To compose this:
- Enter
Task notificationon the first line, then add a blank line. - Enter
Task:followed by a space and insert the Task Title dynamic content. - Enter
Details:followed by a space and insert the Task Details dynamic content. - Enter
Due date:followed by a space and insert the Due Date dynamic content. - Add a blank line, then enter the closing text as static text.
- Enter
Leave all other fields at their default values.
Select Save.
Task 2.5 - Configure the response outputs
Select the Respond to the agent step to open the configuration panel.
Select + Add an output and configure the first output:
Field Value Type Text Output name StatusOutput value Enter the static text: Email sentSelect + Add an output and configure the second output:
Field Value Type Text Output name ConfirmationOutput value Combine Task notification sent to:followed by a space with the Recipient Email dynamic content reference from the trigger inputs.In the Respond to the agent configuration panel, select More options (...), and then select Settings.
Expand Networking and confirm that Asynchronous response is set to Off. If it is on, turn it off so the workflow waits for the response outputs and returns them to the agent in real time.
Select Save.
Task 2.6 - Publish the workflow
Select Publish in the upper-right corner of the workflow designer.
Wait for the publishing process to complete.
Return to the Workflows list by selecting Workflows in the left navigation.
Verify that the workflow you created shows a status of Published.
If the status shows Error, select the workflow and review the error details on the Overview tab before continuing.
Part 3: Add and configure the workflow tool
Task 3.1 - Add the workflow as a tool
Select Agents in the left navigation and open the Contoso Task Alert Agent you created in Part 1.
On the Build tab, select the Tools section to open the Add a tool dialog.
In the Add tool dialog, select the Workflows filter.
Select the Send Task Notification Email workflow that you published. Confirm the name matches the one you created.
In the Tools section, select the workflow to open its configuration panel.
Task 3.2 - Configure the tool name and description
In the Name field, verify or update the name to:
Send task notification emailIn the Description field, enter:
Sends a formatted task notification email to a specified recipient. Use when the user asks to send a notification about a task and all required details are available and confirmed: recipient email, task title, task details, and due date.
Task 3.3 - Configure the inputs
In the Inputs section, configure each input:
For Recipient Email, set How is this filled? to AI. Confirm the description reads:
The complete work or school email address of the person who should receive the task notification. Do not guess or infer this value.For Task Title, set How is this filled? to AI. Confirm the description reads:
The short title of the task that the notification is about.For Task Details, set How is this filled? to AI. Confirm the description reads:
A brief description of what the task involves, including any relevant context.For Due Date, set How is this filled? to AI. Confirm the description reads:
The due date of the task, stated as the user provided it, such as October 15, 2026.
Task 3.4 - Configure the workflow outputs
On the Outputs tab, review the workflow outputs.
Verify that the workflow includes the Status and Confirmation output parameters.
The agent uses the Status and Confirmation outputs to compose a natural confirmation response.
Task 3.5 - Save the configuration
Select Save to apply the tool configuration.
Make sure you are on the Build tab to update the agent instructions.
Task 3.6 - Reference the tool in agent instructions
In the Instructions section, locate the line that reads:
4. When the user confirms, use the Send task notification email tool to send the notification.Place your cursor on
Send task notification emailand replace it with the exact name of the connected tool: Send Task Notification Email.Select Save.
Part 4: Test the agent and workflow
Open the Preview tab in Copilot Studio. Use the following tasks to run all four test paths.
Task 4.1 - Test the success path
At the top of the Preview pane, start a new conversation session.
Enter the following message exactly:
Replace
<your email address>with your own work or school email address.Send a task notification to <your email address> for the task "Server Patch Update." The task involves applying monthly security patches to production servers. It's due October 15, 2026.Expected behavior:
- The agent extracts the recipient email, task title, task details, and due date from the message.
- The agent presents the confirmation prompt you configured.
Approve the confirmation when prompted.
Expected behavior after approval:
- The agent calls the workflow.
- The workflow runs the Send an email (V2) action.
- The agent responds with a confirmation that uses the
StatusandConfirmationoutputs.
Verify success by checking the inbox of the email account you specified as the recipient. Confirm:
- The subject line reads
Task notification: Server Patch Update. - The body contains the task title, task details, and due date.
- The closing line reads
This notification was sent by the Contoso Task Alert Agent.
- The subject line reads
Completion criteria for Task 4.1: The email arrives with the correct subject, body, and formatting, and the agent confirms the action in the conversation.
Task 4.2 - Test the missing-information path
Start a new conversation session in the Preview tab.
Enter the following message:
Send a notification for the task "Backup Validation."Expected behavior:
- The agent recognizes that required information is missing.
- The agent asks for the missing inputs, including the recipient email address and due date.
Provide each piece of missing information as the agent asks for it. Use these values:
- Recipient email: Your own work or school email address.
- Task details:
Verify that nightly backups completed successfully and review the backup logs. - Due date:
October 20, 2026
When the agent presents the confirmation prompt, approve it.
Expected behavior after approval:
- The workflow runs and the email is sent.
- The agent confirms the action.
Completion criteria for Task 4.2: The agent asks for missing inputs rather than guessing or skipping them, and the workflow runs successfully after all required information is provided.
Task 4.3 - Test cancellation at the confirmation prompt
Start a new conversation session in the Preview tab.
Enter the following message:
Replace
<your email address>with your own work or school email address.Send a task notification to <your email address> for "Access Review." The task involves reviewing and removing inactive user accounts. It's due November 1, 2026.When the agent presents the confirmation prompt, decline it by entering:
Cancel, don't send the email.Expected behavior:
- The agent acknowledges the cancellation.
- No email is sent.
- The agent remains ready for the next message in the same conversation.
Verify that no email arrives. Open the workflow's Activity tab and confirm that cancellation didn't create a workflow run.
Completion criteria for Task 4.3: The agent cancels cleanly, does not send the email, and remains responsive in the conversation.
Task 4.4 - Test a controlled failure path
This test runs the workflow directly with a deliberately malformed email address. You then inspect the Activity panel to understand the failure.
Note
This test intentionally produces a failure. The purpose is to practice using workflow activity to diagnose problems. No real email is sent to a real address.
In the left navigation pane, select Workflows, and then select the Send Task Notification Email workflow to open it in the workflow designer. On the top of the page, select Run.
Enter these test values:
Input Value Recipient Email not-an-emailTask Title Incident ReportTask Details Document the root cause of a recent service outage.Due Date November 5, 2026Select Run. The workflow encounters an error at the Send an email (V2) step because
not-an-emailisn't a valid address.After the failed attempt, inspect the workflow activity:
- In the workflow designer, open the Activity tab.
- Filter the runs by Failed.
- Select the most recent failed run to load its step details on the canvas.
- Identify the step that failed (the Send an email (V2) action) and read the error message.
What to look for:
- The Recipient Email input received
not-an-email, which confirms the workflow test used the value you entered. - The Send an email (V2) step shows a validation or delivery error because the address is malformed.
- All preceding steps, including the trigger, ran without error.
Note the error type and the step that failed. This is the information you use to decide whether to add input validation, update the input description, or adjust the confirmation prompt.
Restore normal operation by returning to the agent's Preview tab, starting a new conversation, and completing the success path test again with your own email address.
Completion criteria for Task 4.4: You can locate the failed run in the Activity panel, identify the step that failed, and read the error details.
Part 5: Verify and reflect
Task 5.1 - Review the full configuration
After completing all four test paths, review the configuration as a whole:
- Open the agent's Build tab and select the Send Task Notification Email tool.
- Confirm the tool description accurately reflects what the workflow does and when to use it.
- Confirm AI is selected under How is this filled? for all four inputs.
- Confirm the confirmation prompt is clear and informative.
Task 5.2 - Optional: Refine based on test results
If any test path revealed a problem, such as the agent guessing the recipient email instead of asking or presenting an unclear confirmation prompt, make one targeted change and retest the affected path.
Common refinements:
- Agent guessed the recipient email: Update the Recipient Email input description to include:
Do not guess or infer this value; ask the user if it is not provided. - Confirmation prompt was unclear: Update the prompt to show the specific values the workflow uses, such as the recipient address and task title.
- Agent didn't select the tool: Review the tool description and the agent instructions. The description may be too vague or may not match the language users are likely to use.
Clean up
After completing the exercise, remove the assets you created to keep your environment tidy.
Remove the workflow from the agent:
- Open the agent, select the Build tab, select Tools, find the Send Task Notification Email tool, and remove it.
Delete the workflow:
- In the left navigation, select Workflows.
- Select the ellipsis (...) next to the Send Task Notification Email workflow you created.
- Select Delete and confirm the deletion.
Delete the agent:
- In the left navigation, select Agents.
- Find the Contoso Task Alert Agent you created, select the ellipsis (...) next to it, and select Delete.
- Confirm the deletion.
Note
Deleting the workflow before removing it from the agent may show an error. Remove the workflow from the agent first, then delete the workflow.