Expand description
sgr-agent-tools — reusable file-system tools for sgr-agent based AI agents.
11 universal tools parameterized by FileBackend trait:
| # | Tool | Category |
|---|---|---|
| 1 | ReadTool | observe |
| 2 | WriteTool | act |
| 3 | DeleteTool | act |
| 4 | SearchTool | observe |
| 5 | ListTool | observe |
| 6 | TreeTool | observe |
| 7 | EvalTool | compute (feature “eval”) |
| 8 | ReadAllTool | observe (batch) |
| 9 | MkDirTool | act (deferred) |
| 10 | MoveTool | act (deferred) |
| 11 | FindTool | observe (deferred) |
§Usage
ⓘ
use sgr_agent_tools::{FileBackend, TreeTool, ReadTool, SearchTool, WriteTool};
// Implement FileBackend for your runtime
impl FileBackend for MyBackend { ... }
// Create tools
let b = Arc::new(MyBackend::new());
let registry = ToolRegistry::new()
.register(ReadTool(b.clone()))
.register(WriteTool(b.clone()))
.register(SearchTool(b.clone()))
.register(TreeTool(b.clone()))
.register_deferred(MkDirTool(b.clone()));Re-exports§
pub use backend::FileBackend;pub use delete::DeleteTool;pub use find::FindTool;pub use list::ListTool;pub use mkdir::MkDirTool;pub use move_file::MoveTool;pub use read::ReadTool;pub use read_all::ReadAllTool;pub use search::SearchTool;pub use tree::TreeTool;pub use write::WriteTool;pub use helpers::backend_err;pub use helpers::has_matches;pub use helpers::unique_files_from_search;pub use search::auto_expand_search;pub use search::expand_query;pub use search::fuzzy_regex;pub use search::is_regex;pub use search::smart_search;pub use trust::infer_trust;pub use trust::wrap_with_meta;
Modules§
- backend
- FileBackend trait — the abstraction over filesystem operations.
- delete
- DeleteTool — delete one or more files (batch delete support).
- find
- FindTool — find files/directories by name pattern.
- helpers
- Shared helpers for tool implementations.
- list
- ListTool — list directory contents.
- mkdir
- MkDirTool — create a directory.
- move_
file - MoveTool — move or rename a file.
- read
- ReadTool — read file contents with trust metadata.
- read_
all - ReadAllTool — batch read all files in a directory.
- search
- SearchTool — smart search with query expansion, fuzzy matching, and auto-expand.
- tree
- TreeTool — show directory tree structure.
- trust
- Trust metadata — tag file reads with trust level for LLM safety.
- write
- WriteTool — write content to a file with JSON auto-repair.