Exercise - Edit a flow in the designer
In this scenario, a healthcare organization provides multiple levels of care and services to its patients. It wants to use Microsoft Copilot Studio to build an agent that helps patient diagnosis of various pains.
The agent captures the following information:
- Patient age
- Patient gender
- Primary symptom
The agent summarizes this information into a text string. The agent then sends this string to a generative service to check symptoms and provide a potential diagnosis.
You use an agent flow to summarize the information for better consumption.
Specify and configure an event to start the flow
First, select the trigger (event) that starts the flow. In this case, an agent triggers the agent flow. This setup enables you to call the flow in different topics.
Sign in to Copilot Studio by using your work or school account.
On the left pane, select Flows.
Select Start in designer.
Select Add a trigger box. Then search for and select When an agent calls the flow.
Select Add an Input.
Select Number and change the name from Number to Patient Age.
Select Add an Input again, select Text, and change the name from Input to Patient Gender.
Select Add an Input one last time, select Text, and change the name from Input to Primary Symptom.
Important
If you were creating a true symptom checker, you would capture multiple inputs to help the generated answers to be as accurate as possible. This exercise is a simplified demonstration.
Specify an action
Under the When an agent calls the flow trigger, select Insert a new step (+).
On the Add an action pane, search for and select Run a prompt.
On the Run a prompt pane, set the Prompt box to AI Summarize.
In the input text, select Dynamic value (lightning bolt).
Under When an agent calls the flow, select the following dynamic values:
- Patient Age
- Patient Gender
- Primary Symptom
Under the Run a Prompt step, select Insert a new step (+).
On the Add an action pane, enter Respond, and then select Respond to the agent.
Select Add an output.
Select Text.
Set the name of the output to Summarized Text.
In the Enter a value to respond with box, select Dynamic value (lighting bolt).
Search for and select Body.
Select Save draft.
Select the Overview tab.
In the Details section, select Edit.
Change the name from untitled to Summarize Symptoms.
Select the Save button.
Switch back to the Designer tab.
Select Publish.
Important
You might receive a warning that the Run a Prompt action doesn't have a content approval action after it. Normally, you would want to include this human interaction to ensure that the provided information is accurate. For the purpose of this exercise, you publish anyway.
You successfully built an agent flow that uses a patient's age, gender, and symptom to create a summary for a Copilot Studio agent. The next step in the process is to create the agent that captures this information and provides a potential diagnosis.
Create an agent
If necessary, open Copilot Studio.
On the left pane, select Agents.
Select New Agent.
Select the Skip to configure button.
In the Name box, enter Symptom Checker.
Select the Create button.
Before you move to the next step, wait until the agent is fully created. The process can take several minutes.
Select the Topics tab. (You can also use the Tools tab.)
Select Add a Topic. On the menu that appears, select From blank.
Change the name of the topic from Untitled to Check Symptoms.
Under describe what the topic does, enter: This topic captures symptoms that a patient is experiencing and provides a potential diagnosis. It can answer questions like "I want to check my symptoms."
Select the Add node button, and then select Send a message.
In the Message box, enter: I'm happy to help you. I just need to capture more details.
Select the Add node button, and then select Ask a Question.
For the question text, enter: How old are you?
Select the arrow next to Multiple Choice Options. On the Choose information to identify pane, select Age.
Under Save user response as, select Var1.
Change the variable name to Age.
Select the Add node button, and then select Ask a Question.
For the question text, enter: What was your gender at birth?
Select the arrow next to Multiple Choice Options. On the Choose information to identify pane, select User's entire response.
Under Save user response as, select Var1.
Change the variable name to Gender.
Select the Add node button, and then select Ask a Question.
For the question text, enter: Describe to me the symptoms that you're having.
Select the arrow next to Multiple Choice Options. On the Choose information to identify pane, select User's entire response.
Under Save user response as, select Var1.
Change the variable name to Gender.
Select the Save button and leave the Topics tab open.
Select the Add node button.
On the menu that appears, select Add an Action.
Select the Summarize Symptoms agent flow that you created earlier.
Configure the action as follows:
Patient Age (Number): Select the Age variable that you created earlier.
Patient Gender (String): Select the Gender variable that you created earlier.
Primary Symptom (String): Select the Symptoms variable that you created earlier.
Select the Add node button.
On the menu that appears, select Send a message.
Select the Insert variable {x} button.
Select Summarized text.
Select the Save button.
On the Test your agent pane, select the ellipsis (three dots), and then select Turn off Debug Mode.
In the Ask a question or describe what you need box, enter the following text: I have some symptoms that I want checked.
Enter an Age value, and then select the Enter key.
Enter a Gender value, and then select the Enter key.
When you're asked for your symptom, enter the following text: I'm experiencing severe sharp pain in my hands. The pain has been getting worse and is pretty much all the time.
Select the Enter key.
The agent summarizes your information and lists potential conditions.