stakpak_agent_core/
tools.rs1use crate::{error::AgentError, types::AgentRunContext, types::ProposedToolCall};
2use async_trait::async_trait;
3use tokio_util::sync::CancellationToken;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum ToolExecutionResult {
7 Completed { result: String, is_error: bool },
8 Cancelled,
9}
10
11#[async_trait]
12pub trait ToolExecutor: Send + Sync {
13 async fn execute_tool_call(
14 &self,
15 run: &AgentRunContext,
16 tool_call: &ProposedToolCall,
17 cancel: &CancellationToken,
18 ) -> Result<ToolExecutionResult, AgentError>;
19}