Hi Pradipta Nayak,
Thank you for your detailed
The key to achieving what you want in Copilot Studio is to use variables to act as the copilot's short-term memory. This allows you to store the output from one tool and reuse it later in the conversation.
Here’s how it would work for your leave application use case:
Store the Holiday List: When a user first asks for the company holidays, your GetHolidays
tool runs. You should immediately save its output (the list of holidays) into a conversation variable. Let's imagine you call this variable Conversation.Holidays
.
Check Before Calling: Now, when the user asks, "How many business days are between date A and date B?", your copilot needs to run the CalculateBusinessDays
tool. But before it does, it should perform a quick check: "Is the Conversation.Holidays
variable empty?"
Reuse or Fetch:
- If the variable is not empty, it means the copilot has already fetched the holidays. It can just take that list from memory and use it as an input for the
CalculateBusinessDays
tool. No need to callGetHolidays
again.- If the variable is empty, then the copilot knows it needs to run the
GetHolidays
tool first, save the result to theConversation.Holidays
variable, and then proceed to use it with theCalculateBusinessDays
tool.
- If the variable is empty, then the copilot knows it needs to run the
This simple "check-then-run" logic ensures that you're efficiently reusing data within a single user session, preventing redundant tool calls.
For more detailed guidance and the technical specifics, you can refer to Microsoft's official documentation. They have some great articles on variables and how to orchestrate plugins, which is the foundation for this kind of chaining.
Using Variables in Copilot Studio: This is a great starting point for understanding how to store and manage data during a conversation.
- [Microsoft Docs: Use variables] : https://learn.microsoft.com/en-us/microsoft-copilot-studio/authoring-variables
- Microsoft Docs: Create and orchestrate plugins : https://learn.microsoft.com/en-us/microsoft-copilot-studio/plugins-orchestration Plugin Orchestration: This documentation gets more into the specifics of how Copilot Studio decides which tool to run and how you can guide its logic, which is exactly what you're doing here.
Hope this helps clarify the approach! Let me know if you have any other questions.
Thanks,
Karan Shewale.
*************************************************************************
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.