pub struct TimeoutMiddleware { /* private fields */ }Expand description
Middleware that enforces a timeout on tool execution.
Wraps the downstream tool call in tokio::time::timeout. If the tool
does not complete within the configured duration, returns
ToolError::ExecutionFailed with a descriptive message so the model
can adapt.
Per-tool overrides allow different timeouts for tools with known different latency profiles (e.g., web scraping vs. simple computation).
Implementations§
Trait Implementations§
Source§impl ToolMiddleware for TimeoutMiddleware
impl ToolMiddleware for TimeoutMiddleware
Source§fn process<'a>(
&'a self,
call: &'a ToolCall,
ctx: &'a ToolContext,
next: Next<'a>,
) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
fn process<'a>( &'a self, call: &'a ToolCall, ctx: &'a ToolContext, next: Next<'a>, ) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
Process a tool call, optionally delegating to the next middleware/tool.
Auto Trait Implementations§
impl Freeze for TimeoutMiddleware
impl RefUnwindSafe for TimeoutMiddleware
impl Send for TimeoutMiddleware
impl Sync for TimeoutMiddleware
impl Unpin for TimeoutMiddleware
impl UnsafeUnpin for TimeoutMiddleware
impl UnwindSafe for TimeoutMiddleware
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