mod parallel;
mod sequential;
use super::Tool;
use crate::types::{ToolCall, ToolResult};
use async_trait::async_trait;
pub use parallel::*;
pub use sequential::*;
#[async_trait]
pub trait ToolExecutor {
fn add(&mut self, name: String, tool: Box<dyn Tool + Sync>) -> Option<Box<dyn Tool + Sync>>;
async fn execute(&self, calls: Vec<ToolCall>) -> Vec<ToolResult>;
}
fn tool_not_found_result(call_id: String, tool_name: &str) -> ToolResult {
ToolResult {
tool_message: crate::types::ToolMessage {
tool_call_id: call_id,
content: format!("Tool '{}' not found", tool_name),
},
timestamp: std::time::SystemTime::now(),
elapsed: std::time::Duration::ZERO,
}
}