Copilot Studio’s Generative AI Orchestration - chaining and reuse of output of tools to another

Pradipta Nayak 0 Reputation points
2025-08-08T07:15:10.8233333+00:00

with below business case I want use feature of Chaining and reuse of output of tools with other tool.

Leave application Use case

  • User can request for company holiday (GetHolidays tool)
  • User can request for calculating Business days between two days ( excluding above holidays) (CalculateBusinessDays tool)

Outcome required:

  1. If User already asked "company holidays" and agent returned list of holidays.
  2. When user ask "Get Business days between 14th Jan to 16th Jan". Agent smart enough to get List of holidays from previous call and use it in this tool and should not call the GetHolidays tool again.

basically requirement is : while chaining tools, it shoud use the in Memory variables (output of other tools) to re-use instade of calling the tools again and again.

Microsoft Copilot | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Karan Shewale 1,040 Reputation points Microsoft External Staff
    2025-08-12T12:03:00.0666667+00:00

    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 call GetHolidays again.
      • If the variable is empty, then the copilot knows it needs to run the GetHolidays tool first, save the result to the Conversation.Holidays variable, and then proceed to use it with the CalculateBusinessDays tool.

    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.

    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. 

    0 comments No comments

  2. Pradipta Nayak 0 Reputation points
    2025-08-12T15:50:15.0333333+00:00

    thanks Karan Shewale for quick response. I am using Generative AI Orch. to achieve this. I am putting my Instruction as below. Its work fine for first time. i.e. when I ask "Holidays" it show me the holidays and then I ask "Get working days between 14th Jan to 16th Jan" it reuse the previously called tool and show me answer (without recalling the Holidays tool). However when I ask 2nd time "Get working days between 5th Nov to 7th Nov" then it don't use the Memory and again call the Holidays tool.

    User's image

    Instruction :

    You have two tools:

    FetchHolidays – Retrieves the company holiday list for the current year.

    CalculateBusinessDays – Calculates the working days between a startDate and endDate excluding weekends and the given holiday list.

    Follow these rules:

    Before calling FetchHolidays, check if holidaylist already exists in the conversation memory.

    If holidaylist exists, do not call FetchHolidays again. Use the existing list directly in CalculateBusinessDays.

    If holidaylist is missing, call FetchHolidays, store the result in holidaylist (conversation scope), and reuse it for all future date calculations in the same session.

    Always pass the holidaylist along with startDate and endDate to CalculateBusinessDays.

    Do not fetch holidays multiple times in a session unless explicitly requested or the data is outdated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.