1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Built-in agent tools.
/*
ARCHITECTURE: tools/ — the standard toolkit for coding agents
This module provides 6 built-in tools that together cover the core operations
of a coding agent:
`BashTool` — run shell commands (most powerful; the agent's hands)
`ReadFileTool` — read file contents
`WriteFileTool` — write or overwrite a file
`EditFileTool` — precise text replacement within a file
`ListFilesTool` — list directory contents
`SearchTool` — grep / content search across files
`default_tools()` returns all six in a `Vec<Arc<dyn AgentTool>>` — the canonical
"batteries included" tool set. Callers that want a subset can build their own Vec.
RUST QUIRK: `pub mod` vs `pub use`
`pub mod bash;` — declares the `bash` submodule and makes it publicly accessible.
This loads `tools/bash.rs` and exposes it as `tools::bash::*`.
`pub use bash::BashTool;` — re-exports `BashTool` at this module's level.
Without this re-export, callers would write `tools::bash::BashTool`.
With it, they write `tools::BashTool` — cleaner public API.
RUST QUIRK: `Vec<Arc<dyn AgentTool>>` — shared heterogeneous tool collection
All 6 tools are different concrete types, but they share the `AgentTool` trait.
To put different types in one `Vec`, we need "type erasure" via trait objects:
`Arc<dyn AgentTool>` — reference-counted, vtable-dispatched, concrete type erased
`Arc::new(BashTool::default())` — allocates `BashTool` on the heap behind an Arc.
Arc allows tools to be shared across parallel agent branches (evaluational parallelism)
without copying — each branch gets a cheap reference-count increment.
Python analogy: a list of objects that all implement an abstract base class.
*/
pub use BashTool;
pub use EditFileTool;
pub use ;
pub use ListFilesTool;
pub use ;
pub use ToolRegistry;
pub use ;
pub use SearchTool;
use crateAgentTool;
use Arc;
/// Get the standard set of coding agent tools.
///
/// Returns all 6 built-in tools ready for use with `Agent::with_tools()` or
/// `AgentLoopConfig`. Each tool is heap-allocated behind an `Arc<dyn AgentTool>`,
/// which allows them to be shared across parallel agent branches at zero copy cost.