Skip to main content

Module builtin_tools

Module builtin_tools 

Source
Expand description

Bundled registration for the full set of built-in SDK tools.

The SDK ships many ready-to-use tools (primitives, todo tracking, web search and fetch, user-interaction). Hosts that want to run these through the v2 durable tool runtime need them registered in a shared ToolRegistry<Ctx> so agent-service-host’s RegistryToolExecutor can dispatch them by name.

This module centralises the registration plumbing so hosts don’t have to know the constructor shape of every tool family. Each family is exposed as its own focused helper and a top-level register_builtin_tools wires the common bundle.

§Example

use std::sync::Arc;
use tokio::sync::RwLock;
use agent_sdk::builtin_tools::{register_builtin_tools, BuiltinToolsConfig};
use agent_sdk::todo::TodoState;
use agent_sdk::{AgentCapabilities, InMemoryFileSystem, ToolRegistry};

let fs = Arc::new(InMemoryFileSystem::new("/workspace"));
let mut registry = ToolRegistry::<()>::new();
register_builtin_tools(&mut registry, BuiltinToolsConfig {
    environment: fs,
    capabilities: AgentCapabilities::full_access(),
    todo_state: Some(Arc::new(RwLock::new(TodoState::new()))),
    // `link_fetch` only exists when the `web` feature is enabled, so the
    // field is gated to keep this example compiling under default features
    // (`cargo test --doc -p agent-sdk`).
    #[cfg(feature = "web")]
    link_fetch: true,
});

Structs§

BuiltinToolsConfig
Configuration for register_builtin_tools.

Functions§

register_builtin_tools
Register the full bundle of built-in tools described by config.
register_link_fetchweb
Register LinkFetchTool with default HTTP client and SSRF-protecting UrlValidator.
register_primitives
Register the six filesystem / shell primitives (Read, Write, Edit, Bash, Glob, Grep).
register_todo_tools
Register TodoReadTool and TodoWriteTool sharing state.
register_web_searchweb
Register WebSearchTool backed by provider.