sgr-agent-tools 0.1.0

11 reusable file-system tools for sgr-agent based AI agents
Documentation

sgr-agent-tools

11 reusable file-system tools for sgr-agent based AI agents.

Generic over FileBackend trait — implement it for your runtime (RPC, local fs, in-memory mock) and get battle-tested tools out of the box.

Tools

# Tool Category Description
1 ReadTool observe Read file with trust metadata
2 WriteTool act Write file with JSON auto-repair
3 DeleteTool act Delete files (single or batch)
4 SearchTool observe Smart search: query expansion, fuzzy, auto-expand
5 ListTool observe List directory contents
6 TreeTool observe Directory tree structure
7 EvalTool compute JavaScript via Boa engine (feature eval)
8 ReadAllTool observe Batch read all files in directory
9 MkDirTool act Create directory (deferred)
10 MoveTool act Move/rename file (deferred)
11 FindTool observe Find files by name pattern (deferred)

Usage

use std::sync::Arc;
use sgr_agent_tools::{FileBackend, ReadTool, WriteTool, SearchTool, TreeTool};

// Implement FileBackend for your runtime
struct MyBackend;

#[async_trait::async_trait]
impl FileBackend for MyBackend {
    async fn read(&self, path: &str, number: bool, start_line: i32, end_line: i32) -> anyhow::Result<String> {
        todo!()
    }
    // ... other methods
}

// Create tools
let backend = Arc::new(MyBackend);
let read = ReadTool(backend.clone());
let write = WriteTool(backend.clone());
let search = SearchTool(backend.clone());

Or via sgr-agent with the tools feature:

[dependencies]
sgr-agent = { version = "0.6", features = ["tools"] }
# with JS eval:
sgr-agent = { version = "0.6", features = ["tools-eval"] }
use sgr_agent::tools::{FileBackend, ReadTool, SearchTool};

Features

  • eval — enables EvalTool (adds boa_engine dependency, ~5MB)

Architecture

sgr-agent-core          ← minimal: Tool trait, AgentContext, schema
    ↑              ↑
sgr-agent-tools    sgr-agent
(11 tools)         (framework, re-exports tools via feature "tools")