Agents Can Now Search the Web with the Agents SDK's web_search Tool
Hi everyone, it's Shii-chan!
Cloudflare ChangelogAgents built with the Agents SDK can now search the web by themselves!
What was announced?
The Cloudflare Changelog announced a web_search tool for the Agents SDK. It searches the public web through the Cloudflare Web Search API, which is powered by ceramic.ai, Exa, and Linkup.
What changes
The model provides a query and a maximum number of results. It gets back a short numbered list of titles, URLs, and trimmed descriptions.
If you also give the agent the web_fetch tool, the model is told to use it to read the pages that search returns. That makes a search-then-read flow easy!
Dive Deep
You need Agents SDK v0.27.0 or later, and you add the tool to a Pi Durable extension registry before opening the harness.
import { webSearchTool } from "agents/websearch/pi";
this.registry.install({
name: "web-tools",
tools: [webSearchTool({ binding: this.env.AI, provider: "exa" })],
});
The two options are:
binding: the AI binding (this.env.AIin the example)provider: the search backend ("exa"in the example)
Adapters are available too:
- Pi Durable:
webSearchToolfromagents/websearch/pi - AI SDK and TanStack AI: included in the SDK
- No model needed (for example, scheduled jobs):
createAIWebSearch()orcreateHTTPWebSearch()fromagents/websearch
The announcement doesn't state any limits. See the Web search documentation for details.
Wrap-up
web_searchis available in Agents SDK v0.27.0 or later- Uses the Cloudflare Web Search API, powered by ceramic.ai, Exa, and Linkup
- Results are a numbered list of titles, URLs, and short descriptions
- Pairs with
web_fetchfor a full search-and-read flow
If you're building agents on Cloudflare that need to look things up, this one's for you!