pe_tools/lib.rs
1//! # pe-tools — Tool system for Potential Expectations
2//!
3//! Provides the tool abstraction and execution infrastructure:
4//!
5//! - [`Tool`] trait — interface every callable tool implements
6//! - [`FunctionTool`] — wraps any async function as a tool
7//! - [`ToolRegistry`] — stores and retrieves tools by name
8//! - [`ToolNode`] — built-in graph node that handles parallel tool execution
9//! - [`ToolCallInterceptor`] — hook to inspect/modify tool calls before execution
10//! - [`InjectedState`], [`InjectedStore`] — dependency injection markers
11//! - [`tools_condition`] — standard ReAct routing condition
12//!
13//! ## Usage
14//!
15//! ```ignore
16//! // Register tools
17//! let mut registry = ToolRegistry::new();
18//! registry.register(my_search_tool)?;
19//! registry.register(my_calculator_tool)?;
20//!
21//! // Create a ToolNode for the graph
22//! let tool_node = ToolNode::<MyState>::new(Arc::new(registry));
23//!
24//! // Wire into ReAct pattern
25//! graph.add_node("tools", tool_node);
26//! graph.add_conditional_edge("chat", tools_condition::<MyState>);
27//! graph.add_edge("tools", "chat");
28//! ```
29
30pub mod conditions;
31pub mod inject;
32pub mod interceptor;
33pub mod registry;
34pub mod selector;
35pub mod tool;
36pub mod tool_node;
37
38// Re-export primary types at crate root
39pub use conditions::tools_condition;
40pub use inject::{InjectedState, InjectedStore};
41pub use interceptor::{PassthroughInterceptor, ToolCallInterceptor};
42pub use registry::ToolRegistry;
43pub use selector::{AllToolsSelector, ToolSelector};
44pub use tool::{
45 FunctionTool, StructuredFunctionTool, Tool, ToolFunc, ToolFuture, ToolResult, ToolResultFuture,
46};
47pub use tool_node::ToolNode;