pub struct ToolExecutor { /* private fields */ }Expand description
Manages tool execution with support for parallel batch execution.
Implementations§
Source§impl ToolExecutor
impl ToolExecutor
Sourcepub fn new(
registry: Arc<ToolRegistry>,
tool_result_tx: Sender<ToolResult>,
batch_result_tx: Sender<ToolBatchResult>,
) -> Self
pub fn new( registry: Arc<ToolRegistry>, tool_result_tx: Sender<ToolResult>, batch_result_tx: Sender<ToolBatchResult>, ) -> Self
Create a new tool executor.
§Arguments
registry- Tool registry for looking up toolstool_result_tx- Channel for individual tool results (UI feedback)batch_result_tx- Channel for batch results (sending to LLM)
Sourcepub async fn execute_batch(
&self,
session_id: i64,
turn_id: Option<TurnId>,
requests: Vec<ToolRequest>,
cancel_token: CancellationToken,
) -> i64
pub async fn execute_batch( &self, session_id: i64, turn_id: Option<TurnId>, requests: Vec<ToolRequest>, cancel_token: CancellationToken, ) -> i64
Execute a batch of tools in parallel.
Results are emitted individually to tool_result_tx for UI feedback, and the complete batch is sent to batch_result_tx when all tools finish.
Returns the batch ID.
Sourcepub async fn execute(
&self,
session_id: i64,
turn_id: Option<TurnId>,
request: ToolRequest,
cancel_token: CancellationToken,
) -> i64
pub async fn execute( &self, session_id: i64, turn_id: Option<TurnId>, request: ToolRequest, cancel_token: CancellationToken, ) -> i64
Execute a single tool (convenience method that creates a batch of 1).
Auto Trait Implementations§
impl !Freeze for ToolExecutor
impl !RefUnwindSafe for ToolExecutor
impl Send for ToolExecutor
impl Sync for ToolExecutor
impl Unpin for ToolExecutor
impl !UnwindSafe for ToolExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more