pub struct WebSearchTool<P: SearchProvider> { /* private fields */ }Expand description
Web search tool that uses a configurable search provider.
This tool allows agents to search the web using any implementation
of the SearchProvider trait.
§Example
ⓘ
use agent_sdk::web::{WebSearchTool, BraveSearchProvider};
let provider = BraveSearchProvider::new("api-key");
let tool = WebSearchTool::new(provider);
// Register with agent
tools.register(tool);Implementations§
Source§impl<P: SearchProvider> WebSearchTool<P>
impl<P: SearchProvider> WebSearchTool<P>
Create a web search tool with a shared provider.
Sourcepub const fn with_max_results(self, max: usize) -> Self
pub const fn with_max_results(self, max: usize) -> Self
Set the default maximum number of results.
Trait Implementations§
Source§impl<Ctx, P> Tool<Ctx> for WebSearchTool<P>
impl<Ctx, P> Tool<Ctx> for WebSearchTool<P>
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Human-readable description of what the tool does
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON schema for the tool’s input parameters
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ToolContext<Ctx>,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ToolContext<Ctx>,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with the given input Read more
Auto Trait Implementations§
impl<P> Freeze for WebSearchTool<P>
impl<P> RefUnwindSafe for WebSearchTool<P>where
P: RefUnwindSafe,
impl<P> Send for WebSearchTool<P>
impl<P> Sync for WebSearchTool<P>
impl<P> Unpin for WebSearchTool<P>
impl<P> UnwindSafe for WebSearchTool<P>where
P: RefUnwindSafe,
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