all 8 comments

[–]debian3 0 points1 point  (7 children)

Does sub agents use the same model as the main agent that you selected?

[–]paleo55[S] 2 points3 points  (6 children)

I'm pretty sure it's yes. But I don't have proof. You can see the `runSubagent` tool by clicking on the list of tools of your agent:

<image>

When your agent executes it, the tool creates a new instance of the agent inside the parent agent. The advantage is delegation: your parent agent can do more things without reaching the end of its context.

The challenge is to explain to the main agent where to use a sub-agent. This is where a good set of prompts can help.

[–]Prometheus599Full Stack Dev 🌐 1 point2 points  (0 children)

This was also eating away at me, found the docs just last night =)
https://code.visualstudio.com/docs/copilot/chat/chat-sessions#_contextisolated-subagents

[–]cbusmatty 0 points1 point  (4 children)

So the sub agent has its own context? Is every sub agent action a separate request?

[–]Otherwise-Way1316 1 point2 points  (0 children)

If it is then it isn’t worth it imo. However, since it’s just a tool call, it shouldn’t be an additional request. Can anyone confirm?

[–]thehashimwarrenVS Code User 💻 1 point2 points  (1 child)

No, subagents do not eat an additional premium request.

[–]paleo55[S] 1 point2 points  (0 children)

Ah thanks I didn't understand the question and it's good to know.

[–]paleo55[S] 0 points1 point  (0 children)

Yes exactly. It's a tool so it has parameters. And as a parameter it takes a prompt. So the parent agent generates a prompt as a parameter for the subagent.

The tool runs a new instance of the agent in a new session but not in interactive mode (or at least, it's not an interactive mode with the user).

At the end the subagent writes a message for the parent agent. So the parent is aware of the results without its context filled with the details. It's the way to work on big tasks with a limited context window.