Add General Purpose agent support#295494
Closed
digitarald wants to merge 6 commits intomainfrom
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds support for a built-in "General Purpose" agent to the runSubagent tool. The General Purpose agent allows the tool to invoke a subagent that inherits the parent agent's model, tools, and system prompt, providing a full-capability option when custom agents don't fit the task.
Changes:
- Made
agentNamea required parameter in the runSubagent tool schema, with defensive handling for models that omit it - Introduced the
GeneralPurposeAgentNameconstant as the canonical name for the built-in general-purpose agent - Modified automatic instructions to always include the General Purpose agent first in the agents list, followed by custom agents (when enabled)
- Updated tests to verify General Purpose agent behavior including undefined/empty string handling
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.ts | Added GeneralPurposeAgentName constant; made agentName required in schema; updated invoke and prepareToolInvocation to handle General Purpose agent as default; simplified onDidUpdateToolData to Event.None |
| src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.ts | Modified to always include General Purpose agent first in agents list, with custom agents conditionally added when config enabled |
| src/vs/workbench/contrib/chat/test/common/tools/builtinTools/runSubagentTool.test.ts | Added createTool helper; added tests for undefined/empty agentName handling as General Purpose; updated existing tests to expect agentName in schema and General Purpose agent name in results |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/computeAutomaticInstructions.test.ts | Updated test expectations to account for General Purpose agent being first; added test for disabled custom agents showing only General Purpose agent |
dmitrivMS
previously approved these changes
Feb 16, 2026
roblourens
reviewed
Feb 18, 2026
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @rzhao271Matched files:
|
DonJayamanne
previously approved these changes
Feb 24, 2026
6ec86e8 to
0be7e42
Compare
Collaborator
|
Moving this to 1.112 so that we can get the 1.111 milestone into good shape by the end of Thursday Please take this in as a candidate if it must go into 1.111 |
Contributor
Author
|
Continued in #306871 |
digitarald
added a commit
that referenced
this pull request
Mar 31, 2026
Reset promptsServiceImpl.ts and promptsService.test.ts back to main. These files contained an unrelated refactor (method renames, type simplifications) that was accidentally carried over during the port from PR #295494.
digitarald
added a commit
that referenced
this pull request
Apr 2, 2026
Reset promptsServiceImpl.ts and promptsService.test.ts back to main. These files contained an unrelated refactor (method renames, type simplifications) that was accidentally carried over during the port from PR #295494.
digitarald
added a commit
that referenced
this pull request
Apr 2, 2026
* Add General Purpose agent support behind experiment Add a built-in 'General Purpose' agent to the runSubagent tool, gated behind the 'chat.generalPurposeAgent' experiment treatment: - Add GeneralPurposeAgentName constant - Make agentName required and route undefined/GP names to built-in agent - Render GP agent in automatic instructions agents block - Clean up duplicate DI injection in RunSubagentTool - Add unit tests for GP agent paths * Address PR feedback: fix Event cast, add experiment Emitter, try/catch, deterministic tests - Replace unsafe 'configEvent as Event<void>' cast with dedicated Emitter (fixes tsgo typecheck CI failure) - Fire onDidUpdateToolData when experiment resolution changes the value - Add try/catch around getTreatment in computeAutomaticInstructions - Replace flaky setTimeout(0) in tests with Event.toPromise(onDidUpdateToolData) * Fix merge regression: restore fullLength in toolReferences range calculation The merge conflict resolution incorrectly replaced fullLength with name.length + 1 for toolReference OffsetRange calculation, and removed fullLength from variableReferences test expectations. Restore the original behavior from main. * Apply critical review fixes - Add error handler to _resolveExperiment() preventing unhandled promise rejections when getTreatment fails - Decouple GP agent from SubagentToolCustomAgents config gate so experiment works independently of custom agents setting - Fix redundant parens on Event listener arrow function - Add test for GP agent rendering without custom agents config * Remove unrelated promptsServiceImpl refactor from PR Reset promptsServiceImpl.ts and promptsService.test.ts back to main. These files contained an unrelated refactor (method renames, type simplifications) that was accidentally carried over during the port from PR #295494. * Fix GP agent description: inherit parent tools, not 'all tools'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes a built-in "General Purpose" subagent so the model always has a named agent for parallel execution, without requiring a config flag.
Refs microsoft/vscode-internalbacklog#6750
Changes
runSubagentTool.tsagentNameis now required in the tool schema (always present, not gated by config)GeneralPurposeAgentName) — when selected, inherits the parent's system prompt, model, and tools (same as the previous unnamed-agent behavior)invoke()/prepareToolInvocation()useisGeneralPurposecheck to branch between built-in and custom agent pathsBaseModelDescriptionalways includes the agent-name instructionIConfigurationServiceinjectionILanguageModelToolsServiceinjection into singlelanguageModelToolsServicecomputeAutomaticInstructions.ts<agents>XML block now renders wheneverrunSubagentToolis available (config gate removed)GeneralPurposeAgentNamefromconstants.ts(avoids cyclic dependency withrunSubagentTool.ts)constants.tsGeneralPurposeAgentName = 'General Purpose'constant (shared byrunSubagentTool.tsandcomputeAutomaticInstructions.ts)Setting removal (
SubagentToolCustomAgents)constants.tschat.contribution.tssettingsLayout.tsTests
runSubagentTool.test.ts: UpdatedcreateToolhelpers (removed dead DI args), added tests for undefined/empty/explicit General Purpose agentName handlingcomputeAutomaticInstructions.test.ts: Removed config setup calls, deleted "disabled custom agents" test, agents list test expects General Purpose firstTesting
checkCyclicDependencies.ts)