Skip to main content

Crate pe_tools

Crate pe_tools 

Source
Expand description

§pe-tools — Tool system for Potential Expectations

Provides the tool abstraction and execution infrastructure:

§Usage

// Register tools
let mut registry = ToolRegistry::new();
registry.register(my_search_tool)?;
registry.register(my_calculator_tool)?;

// Create a ToolNode for the graph
let tool_node = ToolNode::<MyState>::new(Arc::new(registry));

// Wire into ReAct pattern
graph.add_node("tools", tool_node);
graph.add_conditional_edge("chat", tools_condition::<MyState>);
graph.add_edge("tools", "chat");

Re-exports§

pub use conditions::tools_condition;
pub use inject::InjectedState;
pub use inject::InjectedStore;
pub use interceptor::PassthroughInterceptor;
pub use interceptor::ToolCallInterceptor;
pub use registry::ToolRegistry;
pub use selector::AllToolsSelector;
pub use selector::ToolSelector;
pub use tool::FunctionTool;
pub use tool::StructuredFunctionTool;
pub use tool::Tool;
pub use tool::ToolFunc;
pub use tool::ToolFuture;
pub use tool::ToolResult;
pub use tool::ToolResultFuture;
pub use tool_node::ToolNode;

Modules§

conditions
Routing conditions — standard functions for tool-call routing.
inject
Dependency injection markers — types that inject runtime context into tools.
interceptor
Tool call interception — hooks that run before tool execution.
registry
Tool registry — stores and retrieves tools by name.
selector
Tool selection — mechanism for filtering available tools before an LLM call.
tool
Tool trait — the interface every callable tool implements.
tool_node
ToolNode — built-in graph node that handles tool execution.