Built-in Tools Guide
August 14, 2026 · View on GitHub
A coding agent's power comes from efficient interaction with the environment. This guide covers all 26 built-in tools in agent_worker.json and how to prompt the agent to use them effectively.
Note:
agent_worker.jsonoverrides thetoolsfield viaextend: default, so only the 26 tools listed there are available.
Tool Overview
| Category | Tools | Typical Use |
|---|---|---|
| File & I/O | write, read, edit, glob, grep | Create, read, modify, search files |
| Code Execution | Run, Python, Bash, pwsh | Execute executables, bash / powershell commands, or Python code |
| Process Management | job_output | Read, list, export, or kill background tasks |
| Search & Info | fetch_url | Fetch web content |
| State & Tracking | todo_write, todo_update | Track progress |
| Sub-agent & Session Management | subagent, list_agents, interrupt_agent | Create, list, and close sub-agent sessions |
File & I/O
write
Write to a file. Modes: overwrite (default), append. For content >100 lines, split into multiple calls (first overwrite, rest append).
read
Read text files by line. Options: offset, limit, negative offset for tail reading. Long lines are auto-truncated. Read large files in chunks.
edit
String-level replacement in text files. Supports single/multi-line edits and replace_all. Preferred for minimal diffs — preserves formatting, comments, and blank lines.
glob
Wildcard file search (*, ?). Avoid ** prefix or very large directories.
grep
Regex content search (ripgrep-powered). Options: -i (case-insensitive), multiline, -B/-A/-C (context), type/include filters.
Code Execution & Process Management
Run
Execute programs or built-in mapped commands (100+ commands: cat, ls, grep, find, curl, git, etc.). Options: args, cwd, output_path, timeout (default 10s, range 3–180s). Exceeds timeout → background task with task_id.
Not a shell interpreter — runs executables directly or calls internal mapped command implementations for safer, more predictable behavior.
Bash
Execute commands or script snippets in a bash shell, supporting shell features such as pipes, redirection, and variable expansion.
- Platform: mainly Linux / macOS.
- Use cases: running shell scripts, combining commands with pipes, complex commands requiring shell interpretation.
- Interactive mode: set
interactive=Trueto start a persistent bash session. The tool returns atask_idimmediately. To continue, callBashagain withtask_id=<id>andcmdset to the input text; output is returned in the same call. Usewait_for_patternto block until a prompt appears. Sendexitto close the session.
pwsh
Execute commands or script snippets in PowerShell, supporting Windows-specific commands and pipelines.
- Platform: mainly Windows.
- Use cases: Windows management commands, calling .NET tools, handling cross-platform script compatibility on Windows.
- Interactive mode: set
interactive=Trueto start a persistent PowerShell session. The tool returns atask_idimmediately. To continue, callpwshagain withtask_id=<id>andcmdset to the input text; output is returned in the same call. Usewait_for_patternto block until a prompt appears. Sendexitto close the session.
Python
Execute Python code in a subprocess. Params: code (required), output_path, timeout (default 10s, range 3–60s). Exceeds timeout → background task. Max 8 concurrent Python processes. Code >30000 chars auto-saved to temp .py file.
job_output
Get output from background tasks. Supports blocking wait, polling, kill, and output_path export.
Interactive sessions with Bash, pwsh, and Run
These tools can start a persistent session and continue it in later turns using the same tool:
- Start:
Bash/pwshwithinteractive=True, orRunwithrun_in_background=True. The response includes atask_id. - Continue: call the same tool with
task_id=<id>andcmd/commandset to the input text. The input is sent to the process stdin and the accumulated output is returned in the same call. - Wait for a prompt: supply
wait_for_patternwith a regex; the tool blocks up totimeoutuntil the pattern appears. - Close: send the shell-specific exit command (e.g.,
exit) viatask_id+cmd/command.
job_output remains available as a fallback to read, list, export, or kill background tasks without sending input.
Search & Information
fetch_url
Fetch web content as Markdown via headless browser. Use for docs, API references, GitHub issues.
State & Tracking
todo_write
Track multi-step task progress. States: pending, in_progress, done. Always pass the complete list on update. For lightweight single-item edits, prefer todo_update.
todo_update
Update a single existing todo by title without rewriting the whole list. Supports status changes, notes edits, and renaming. Fuzzy matching is enabled by default.
Sub-agent & Session Management
subagent
Spawn an independent sub-agent for a specific subtask. Use for parallel work: code review, translation, module development.
list_agents
List all currently active sub-agent sessions. Use after spawning multiple sub-agents to see which are still running or waiting for input.
interrupt_agent
Close a specified sub-agent session and release its resources. Use when a sub-agent task completes or hangs abnormally.
Prompting Strategies
1. Direct Instruction
Explicitly name tools and their purpose.
"Use
globto find all.cppfiles undersrc/, thenreadeach to check fordeprecatedmarkers. Write results toreport.mdwithwrite."
2. Goal-Oriented
Describe the goal, let the agent choose tools.
"Find this project's entry point and its third-party dependencies. Search the codebase and report back."
3. Constrained Execution
Add explicit constraints.
"Change
MAX_RETRIESto5inconfig.py. Requirements:
- Use
editfor minimal changesreadfirst to confirm line numbersreadagain after editing to verify"
4. Step-by-Step Workflow
Break complex tasks into tool-annotated steps.
"1. Research:
glob+readexisting CLI commands 2. Implement:writeoreditfor new command 3. Verify:Runtests 4. Track:todo_writeto mark complete"
5. Meta-Prompting
Embed tool guidelines in system prompts.
"- Observe before acting:
read/grepbefore modifying
- Minimal changes: prefer
edit, avoid full-file overwrites- Async long tasks:
Run+job_outputfor >10s commands- Delegate: use
subagentfor independent subtasks"
Best Practices
Refactor a function safely:
grepfor all occurrencesreadto verify context (avoid string false-positives)editfor replacementsgrepagain to verify no leftoversRuntests
Interactive command:
Bash/pwsh/Runto start a session (timeout → background task)- Reuse the same tool with
task_idandwait_for_patternto exchange input/output job_outputas a fallback to read or kill tasks- Loop until complete
Multi-file feature:
glob+readto research existing structure- Draft implementation plan
edit/writechangestodo_writetrack subtasksRuntests
External document analysis:
fetch_urlfor web docs- Extract requirements
grep+readverify implementation- Output diff report
Plan Mode
Plan mode (/plan) is a two-stage workflow that separates planning from implementation:
- Generate — a specialized planner agent (loaded from
agent_planner.json) analyzes your requirement and writes a comprehensive plan to a Markdown file. - Implement — after you review the plan, a regular worker agent executes it.
Usage
/plan # writes to plan.md (default)
/plan:roadmap.md # writes to a custom file
After invoking the command, type your requirement. End input with /end, or cancel with /cancel.
Workflow
- Input requirement — describe what you want to build or refactor.
- Planner generates plan — the planner uses the Note tool to save the plan and auto-opens the file for review.
- Confirm implementation — answer
yto hand the plan to a worker agent; answernto enter the revision flow and describe changes for the Planner to update the plan; input/quitto abandon execution.
Why use Plan Mode?
- Complex features — multi-file refactors, architecture changes, or new modules benefit from upfront design.
- Review before commit — inspect the plan, adjust scope, or split work before any code is written.
- Delegation — the planner acts as a dedicated architect, while the worker focuses on execution.
Summary
- Observe first:
read/grep/globbefore modifying - Minimize changes:
editpreferred;writeonly for new files or full rewrites - Async long tasks:
Runtimeout → background, manage viajob_output - Integrate external info:
fetch_urlfor docs and references - Plan before build: use
/planfor complex tasks to separate design from implementation