web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Using SubAgent to mani...
Copilot Studio
Suggested Answer

Using SubAgent to manipulate Output

(0) ShareShare
ReportReport
Posted on by


Hey,


I would like to use a subagent within my agent to manipulate the output (for example capitalize everything).
MainAgent does only use its knowledge base without any websearch!


Here is an example
Input: "Which Ice cream can you buy in Berlin?"
*Main Agent searches for answer*
*Sub Agent capitalizes answer*
Output: "IN BERLIN YOU CAN BUY ONLY CHOCOLATE ICE CREAM"


This works (see image 1)


But as soon as I remove the first output of the main agent, the sub agent starts to repeat the input (see image 2).


This is the prompt of the sub_agent:


You are an assistant who only transforms text.
Task:
Take the following text.
Return exactly the same text, but all letters must be capitalized.
You may not change the content, add anything, or omit anything.
Just return the transformed text without explanation.
Text: {{answer}}


What can I do?; What's my mistake?

1.png
2.png
I have the same question (0)
  • Suggested answer
    Sayali-MSFT Profile Picture
    Microsoft Employee on at
    Hello,
    The issue occurs because when the main agent stops outputting the knowledge-base answer in a visible Message node, the variable containing that answer (Answer) is no longer explicitly grounded in the conversation flow. As a result, when the sub-agent expects the input variable {{answer}}, Copilot Studio cannot resolve it and automatically falls back to using the user’s last message (Activity.Text). This causes the sub-agent to transform the user’s question instead of the knowledge-base answer.

    The root rule is that if a sub-agent input variable is not explicitly bound, Copilot Studio defaults to the user’s last message. The correct fix is to explicitly map the variable when calling the sub-agent (e.g., answer = Answer).
    Alternative workarounds include keeping a hidden Message node to materialize the variable or adding a Set Variable step before invoking the sub-agent. The recommended pattern is to explicitly set and pass variables between steps so sub-agents behave like pure functions with clearly defined inputs and outputs


     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 277

#2
11manish Profile Picture

11manish 206

#3
sannavajjala87 Profile Picture

sannavajjala87 156 Super User 2026 Season 1

Last 30 days Overall leaderboard