feat(tools): add web_search_tool for internet search
Add native web search capability that works regardless of LLM tool-calling support. This is particularly useful for GLM models via Z.AI that don't reliably support standard tool calling formats. Features: - DuckDuckGo provider (free, no API key required) - Brave Search provider (optional, requires API key) - Configurable max results and timeout - Enabled by default Configuration (config.toml): [web_search] enabled = true provider = "duckduckgo" max_results = 5 The tool allows agents to search the web for current information without requiring proper tool calling support from the LLM. Also includes CI workflow fix for first-interaction action inputs.
This commit is contained in:
parent
f3bdff1d69
commit
1757add64a
9 changed files with 394 additions and 4 deletions
|
|
@ -25,6 +25,7 @@ pub mod schema;
|
|||
pub mod screenshot;
|
||||
pub mod shell;
|
||||
pub mod traits;
|
||||
pub mod web_search_tool;
|
||||
|
||||
pub use browser::{BrowserTool, ComputerUseConfig};
|
||||
pub use browser_open::BrowserOpenTool;
|
||||
|
|
@ -56,6 +57,7 @@ pub use shell::ShellTool;
|
|||
pub use traits::Tool;
|
||||
#[allow(unused_imports)]
|
||||
pub use traits::{ToolResult, ToolSpec};
|
||||
pub use web_search_tool::WebSearchTool;
|
||||
|
||||
use crate::config::{Config, DelegateAgentConfig};
|
||||
use crate::memory::Memory;
|
||||
|
|
@ -188,6 +190,16 @@ pub fn all_tools_with_runtime(
|
|||
)));
|
||||
}
|
||||
|
||||
// Web search tool (enabled by default for GLM and other models)
|
||||
if root_config.web_search.enabled {
|
||||
tools.push(Box::new(WebSearchTool::new(
|
||||
root_config.web_search.provider.clone(),
|
||||
root_config.web_search.brave_api_key.clone(),
|
||||
root_config.web_search.max_results,
|
||||
root_config.web_search.timeout_secs,
|
||||
)));
|
||||
}
|
||||
|
||||
// Vision tools are always available
|
||||
tools.push(Box::new(ScreenshotTool::new(security.clone())));
|
||||
tools.push(Box::new(ImageInfoTool::new(security.clone())));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue