Skip to content

Tool Search API

Tool search defers situational toolsets so the model discovers them on demand, keeping the active tool list small. Enabled via tool_search=True on create_deep_agent (off by default in the library, on in the CLI).

ToolSearch

ToolSearch is re-exported from Pydantic AI (pydantic_ai.capabilities.ToolSearch). Pass it via capabilities=[...], or simply set tool_search=True on create_deep_agent to wire it together with the helper below.

defer_situational_toolsets

pydantic_deep.features.tool_search.defer_situational_toolsets(toolsets, *, always_loaded_ids=DEFAULT_ALWAYS_LOADED_TOOLSET_IDS)

Return a new toolset list with every non-core toolset deferred.

A toolset is kept loaded when its id is in always_loaded_ids; everything else is wrapped with defer_loading() so its tools stay hidden until discovered via tool search. Toolsets without an id are treated as situational and deferred.