Expand description
§Trinkets
Tool registry and execution system for AI agents - goblin loot and treasures.
This crate provides:
- Tool trait: Interface for implementing tools
- Registry: Central registry for tool discovery
- Router: Routes tool calls to appropriate handlers
- Orchestrator: Coordinates parallel/sequential execution
§Architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Agent │────▶│ Router │────▶│ Handler │
│ │ │ │ │ │
└─────────────┘ └──────┬──────┘ └─────────────┘
│
┌──────┴──────┐
│ Registry │
│ (schemas) │
└─────────────┘§Example
ⓘ
use trinkets::{Tool, ToolRegistry, ToolContext};
struct MyTool;
#[async_trait]
impl Tool for MyTool {
fn name(&self) -> &str { "my_tool" }
fn description(&self) -> &str { "Does something useful" }
async fn execute(&self, ctx: &ToolContext, args: Value) -> Result<ToolOutput> {
// Implementation
}
}
let mut registry = ToolRegistry::new();
registry.register(MyTool);Re-exports§
pub use tool::Tool;pub use tool::ToolSchema;pub use tool::ToolOutput;pub use registry::ToolRegistry;pub use router::ToolRouter;pub use orchestrator::ToolOrchestrator;pub use context::ToolContext;pub use error::ToolError;
Modules§
- builtins
- Built-in tools that ship with Lair
- context
- Execution context for tools
- error
- Tool error types
- orchestrator
- Tool orchestrator - coordinates parallel/sequential execution
- registry
- Tool registry for managing available tools
- router
- Tool routing - dispatches tool calls to handlers
- tool
- Core tool trait and types