1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! Tool system for the Acton-AI framework.
//!
//! This module provides the infrastructure for tool registration and execution:
//!
//! - **Tool Registry**: Central actor that manages tool registration and dispatch
//! - **Tool Executor**: Supervised child actors for executing individual tools
//! - **Tool Actors**: Per-agent tool actors for isolated tool execution
//! - **Sandbox**: Interface for sandboxed code execution (Hyperlight integration)
//!
//! ## Architecture
//!
//! ### Per-Agent Tool Actors (Recommended)
//!
//! ```text
//! +-------------------------------------------------------------+
//! | Agent Actor |
//! | |
//! | tool_handles: HashMap<String, ActorHandle> |
//! | |
//! +-------------------------------------------------------------+
//! |
//! | supervises
//! v
//! +-------------------------------------------------------------+
//! | Tool Actor (per tool) |
//! | |
//! | ExecuteToolDirect --> execute(args) --> ToolActorResponse |
//! | |
//! +-------------------------------------------------------------+
//! ```
//!
//! ### Global Tool Registry (Legacy)
//!
//! ```text
//! +-------------------------------------------------------------+
//! | Tool Registry Actor |
//! | |
//! | RegisterTool --> tools: HashMap<String, RegisteredTool> |
//! | UnregisterTool |
//! | ExecuteTool --> Spawns ToolExecutor (Temporary) |
//! | ListTools --> Returns Vec<ToolDefinition> |
//! | |
//! +-------------------------------------------------------------+
//! ```
//!
//! ## Usage
//!
//! ### Per-Agent Tools (Recommended)
//!
//! ```rust,ignore
//! use acton_ai::prelude::*;
//!
//! // Configure agent with specific tools
//! let config = AgentConfig::new("You are helpful.")
//! .with_tools(&["read_file", "write_file", "glob"]);
//!
//! // Tools are spawned automatically when the agent initializes
//! ```
//!
//! ### Global Registry (Legacy)
//!
//! ```rust,ignore
//! use acton_ai::prelude::*;
//! use acton_ai::tools::{ToolRegistry, ToolDefinition, ToolConfig, RegisterTool};
//!
//! // Spawn the registry
//! let registry = ToolRegistry::spawn(&mut runtime).await;
//!
//! // Register a tool
//! registry.send(RegisterTool {
//! config: ToolConfig::new(ToolDefinition::new(
//! "calculator",
//! "Performs arithmetic",
//! serde_json::json!({...}),
//! )),
//! executor: Arc::new(Box::new(CalculatorExecutor)),
//! }).await;
//! ```
// Re-exports
pub use crateToolDefinition;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Compiler module re-exports
pub use ;
// Stub implementation is only available in tests (security concern in production)
pub use ;