-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(agent): add subagents flag for task/sage tool switching #2922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9034c3d
feat(agent): add enable_subagents feature flag for task/sage tool swi…
amitksingh1490 5289333
[autofix.ci] apply automated fixes
autofix-ci[bot] 07ebcbc
chore(agent): rename subagent_enabled to enable_subagents and scope t…
amitksingh1490 f09891a
[autofix.ci] apply automated fixes
autofix-ci[bot] ab1c0a1
chore(agent): refactor subagent tool configuration to use explicit li…
amitksingh1490 9ef4ca0
[autofix.ci] apply automated fixes
autofix-ci[bot] 0909560
Merge branch 'main' into chore/feature-flag-subagents
tusharmath 306914d
Merge branch 'main' into chore/feature-flag-subagents
amitksingh1490 556dff2
chore(config): rename enable_subagents to subagents
amitksingh1490 b16c327
[autofix.ci] apply automated fixes
autofix-ci[bot] 42401ce
Merge branch 'main' into chore/feature-flag-subagents
amitksingh1490 0e97d61
chore(config): rename enable_subagents to subagents
amitksingh1490 df1028d
chore(agent): conditionally insert task tool based on subagents featu…
amitksingh1490 3cfa2d7
Merge branch 'main' into chore/feature-flag-subagents
tusharmath 8775a71
Merge remote-tracking branch 'origin/main' into chore/feature-flag-su…
amitksingh1490 455233d
[autofix.ci] apply automated fixes
autofix-ci[bot] 5b9fb50
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ description: "Hands-on implementation agent that executes software development t | |
| reasoning: | ||
| enabled: true | ||
| tools: | ||
| - task | ||
| - sem_search | ||
| - fs_search | ||
| - read | ||
|
|
@@ -19,6 +18,8 @@ tools: | |
| - skill | ||
| - todo_write | ||
| - todo_read | ||
| - task | ||
| - sage | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not required. |
||
| - mcp_* | ||
| user_prompt: |- | ||
| <{{event.name}}>{{event.value}}</{{event.name}}> | ||
|
|
@@ -134,9 +135,10 @@ Choose tools based on the nature of the task: | |
|
|
||
| - **Read**: When you already know the file location and need to examine its contents. | ||
| - You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. Never use placeholders or guess missing parameters in tool calls. | ||
| - If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks. For example, if you need to launch multiple agents in parallel, send a single message with multiple {{tool_names.task}} tool calls. | ||
| {{#if tool_names.task}}- If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks. For example, if you need to launch multiple agents in parallel, send a single message with multiple {{tool_names.task}} tool calls.{{/if}} | ||
| - Use specialized tools instead of shell commands when possible. For file operations, use dedicated tools: {{tool_names.read}} for reading files instead of cat/head/tail, {{tool_names.patch}} for editing instead of sed/awk, and {{tool_names.write}} for creating files instead of echo redirection. Reserve {{tool_names.shell}} exclusively for actual system commands and terminal operations that require shell execution. | ||
| - When NOT to use the {{tool_names.task}} tool: Do NOT launch a sub-agent for initial codebase exploration or simple lookups. Always use semantic search directly first. | ||
| {{#if tool_names.task}}- When NOT to use the {{tool_names.task}} tool: Do NOT launch a sub-agent for initial codebase exploration or simple lookups. Always use semantic search directly first.{{/if}} | ||
| {{#if tool_names.sage}}- Use the {{tool_names.sage}} tool for deep research tasks that require comprehensive, read-only investigation across multiple files. Do NOT use it for code modifications — choose direct tools instead.{{/if}} | ||
|
|
||
| ## Code Output Guidelines: | ||
|
|
||
|
|
||
6 changes: 6 additions & 0 deletions
6
...s/forge_repo__agent__tests__parse_agent_file_preserves_runtime_user_prompt_variables.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| source: crates/forge_repo/src/agent.rs | ||
| expression: actual.user_prompt.unwrap().template | ||
| --- | ||
| <{{event.name}}>{{event.value}}</{{event.name}}> | ||
| <system_date>{{current_date}}</system_date> |
7 changes: 7 additions & 0 deletions
7
...e_repo__agent__tests__parse_agent_file_preserves_runtime_user_prompt_variables_tools.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| source: crates/forge_repo/src/agent.rs | ||
| expression: "apply_subagent_tool_config(actual, &ForgeConfig\n{ enable_subagents: true, ..Default::default() }).unwrap().tools" | ||
| --- | ||
| - read | ||
| - task | ||
| - mcp_* |
5 changes: 5 additions & 0 deletions
5
...o/src/snapshots/forge_repo__agent__tests__parse_agent_file_subagents_disabled_prompt.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| source: crates/forge_repo/src/agent.rs | ||
| expression: actual.system_prompt.unwrap().template | ||
| --- | ||
| Body keeps {{tool_names.read}} untouched. |
7 changes: 7 additions & 0 deletions
7
...po/src/snapshots/forge_repo__agent__tests__parse_agent_file_subagents_disabled_tools.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| source: crates/forge_repo/src/agent.rs | ||
| expression: actual.tools | ||
| --- | ||
| - read | ||
| - sage | ||
| - mcp_* |
7 changes: 7 additions & 0 deletions
7
...epo/src/snapshots/forge_repo__agent__tests__parse_agent_file_subagents_enabled_tools.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| source: crates/forge_repo/src/agent.rs | ||
| expression: actual.tools | ||
| --- | ||
| - read | ||
| - task | ||
| - mcp_* |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.