tiny_loop/tool/
executor.rs1mod parallel;
2mod sequential;
3
4use super::Tool;
5use crate::types::{ToolCall, ToolResult};
6use async_trait::async_trait;
7
8pub use parallel::*;
9pub use sequential::*;
10
11#[async_trait]
13pub trait ToolExecutor {
14 fn add(&mut self, name: String, tool: Box<dyn Tool + Sync>) -> Option<Box<dyn Tool + Sync>>;
16
17 async fn execute(&self, calls: Vec<ToolCall>) -> Vec<ToolResult>;
19}
20
21fn tool_not_found_result(call_id: String, tool_name: &str) -> ToolResult {
23 ToolResult {
24 tool_message: crate::types::ToolMessage {
25 tool_call_id: call_id,
26 content: format!("Tool '{}' not found", tool_name),
27 },
28 timestamp: std::time::SystemTime::now(),
29 elapsed: std::time::Duration::ZERO,
30 }
31}