feat(agent): add explore sub-agent and expand task agent capabilities#2989
feat(agent): add explore sub-agent and expand task agent capabilities#2989dcu wants to merge 4 commits into
Conversation
…e guidelines Improve agent_tool.md with comprehensive usage instructions, when to use and when not to use guidance, and parallel usage tips. Rewrite task.md.tpl with structured search methodology, efficiency guidelines, output format requirements, and anti-patterns for read-only agents. 💘 Generated with Crush Assisted-by: Crush:accounts/fireworks/models/kimi-k2p6
| Launch a specialized read-only agent to thoroughly search and explore the code and documentation. | ||
|
|
||
| This agent has access to `glob`, `grep`, `ls`, `view`, and `sourcegraph`. It is optimized for finding files, searching code and documentation, and analyzing architecture — but it **cannot edit files or run commands**. | ||
|
|
There was a problem hiding this comment.
agent_tool is intended for running subagents, not necessarily for exploring the codebase as it does now.
In the future, we may add custom agents, and then this prompt would confuse the model.
Essentially, this is a description for the task subagent.
| You do NOT have access to file editing tools (`edit`, `multiedit`, `write`). | ||
| You do NOT have access to command execution (`bash`). | ||
| You do NOT have access to web fetching (`fetch`, `agentic_fetch`). |
There was a problem hiding this comment.
The model already sees which tools are available to it in every prompt.
I don’t think we should hardcode everything so strictly here, because changes in the buildTools logic would then become tightly coupled to this prompt.
|
|
||
| <efficiency> | ||
| - Spawn **multiple parallel tool calls** whenever searches are independent (e.g., glob for `*.go` AND grep for `func main` at the same time). This is required, not optional. | ||
| - Don't read entire files — use `offset` and `limit` to read only the sections you need. |
There was a problem hiding this comment.
- Prefer not to read entire files when it's unnecessary. Use `offset` and `limit` to inspect only the relevant sections when the file is large or when you already know where to look.
We should leave the model room to choose.
- Add strengths, guidelines, and completion-report expectations to coder - Add when-not-to-use guardrails to task agent - Add writing-the-prompt guidance with "never delegate understanding" rule - Add trust and intent-clarity notes to task efficiency section 💘 Generated with Crush Assisted-by: Crush:accounts/fireworks/models/kimi-k2p6
|
@vadiminshakov review again please |
| <strengths> | ||
| - Searching for code, configurations, and patterns across large codebases | ||
| - Analyzing multiple files to understand system architecture | ||
| - Investigating complex questions that require exploring many files | ||
| - Performing multi-step research tasks | ||
| </strengths> |
There was a problem hiding this comment.
I think this is the responsibility of the task agent.
There was a problem hiding this comment.
hey @vadiminshakov do you think it makes sense to create a specific exploration task?
| <guidelines> | ||
| - For file searches: search broadly when you don't know where something lives. Use `view` when you know the specific file path. | ||
| - For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results. | ||
| - Be thorough: Check multiple locations, consider different naming conventions, look for related files. | ||
| - NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. | ||
| - NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested. | ||
| </guidelines> |
There was a problem hiding this comment.
I think frontier models know better how to perform search. We shouldn’t constrain them with our own instructions just to better guide weaker models.
| Your job is to use the tools available to you to complete the assigned task fully and report back concisely. You can use whatever tools are appropriate for the task at hand, subject to what is available in your toolset. | ||
|
|
There was a problem hiding this comment.
If that’s the case, then we should adjust the task agent’s AllowedTools.
There was a problem hiding this comment.
what tools would you suggest for it?
There was a problem hiding this comment.
All tools except agent
There was a problem hiding this comment.
@vadiminshakov so I've been using this with plan mode and it sometimes uses the task agent to write even in plan mode. how do you suggest tackling that? maybe allowing to scope the agent tool like agent:explore and agent:task
There was a problem hiding this comment.
agent:explore and agent:task
Yes, that’s one possible approach. Scopes are a better design choice. Another option would be to disallow task usage in plan mode by returning an error from the agentTool call.
That said, I’m not sure it makes much sense for us to decide this without input from the maintainers.
Add a new "explore" task type to the agent tool alongside the existing task agent. The explore agent is designed for fast read-only codebase search with a dedicated prompt template and configuration. - Add AgentTaskExplore constant and explore prompt template - Update agent tool to dispatch between task and explore agents - Add AgentExplore config key support - Update golden testdata for GLM-5.1 💘 Generated with Crush Assisted-by: Crush:accounts/fireworks/models/kimi-k2p6
|
@kujtimiihoxha @taciturnaxolotl hello, can you guys take a look at this? according to the log you were the last people working on this also if you can take a look at plan mode which is related to this ticket. #2822 let me know how can I help thanks in advance |
Simplify agentTool signature to only accept ctx and fixedTask, using embedded description and deriving the tool name from the task. Add IsAgentTool helper for identifying agent tool variants. Include tests for scoped tool names and buildTools inclusion. 💘 Generated with Crush Assisted-by: Crush:accounts/fireworks/models/kimi-k2p6
Summary
feat(agent): add explore sub-agent for fast read-only codebase search
exploretask type to theagenttool alongside the existingtasktyperesolveExploreToolsto give the explore agent a focused read-only toolset:glob,grep,ls,sourcegraph,viewfeat(agent): enable full toolset for task sub-agent
resolveTaskTools, granting it:edit,multiedit,writebashfetch,agentic_fetch,downloadlsp_diagnostics,lsp_references,lsp_restarttodosglob,grep,ls,sourcegraph,viewlist_mcp_resources,read_mcp_resourcecrush_info,crush_logs,job_output,job_killdocs(agent): update sub-agent tool and task templates
agent_tool.md: updatetaskdescription to explicitly mention editing files, running commands, fetching data, and multi-step investigationstask.md.tpl: add explicit capabilities statement so the task sub-agent knows it can modify statecoder.md.tpl: add context-length guidance for sub-agent delegation and parallel tool usage rulesrefactor(config): split
resolveReadOnlyToolsintoresolveExploreToolsandresolveTaskToolsload_test.goassertions to match the new tool listsTest plan
go test ./internal/config/— 225 passedgo test ./internal/agent/— 81 passedgo test ./...— 1743 passed across 65 packages💘 Generated with Crush