agents-course icon indicating copy to clipboard operation
agents-course copied to clipboard

[UPDATE] Unit 2.1 tools page: a web search tool loaded from the Hub with load_tool

Open Specstreamai opened this issue 3 weeks ago • 0 comments

This is a proposal for a small addition to an existing page, described here before anything is written, as the template asks. I work on SpecStream, so I have a vendor interest in it; please judge it on that basis.

Page

Unit 2.1, units/en/unit2/smolagents/tools.mdx, section "Importing a Tool from the Hub".

What the page has now

The section shows load_tool() with one example, m-ric/text-to-image. The search tools on the page are the built-in DuckDuckGoSearchTool and GoogleSearchTool, and serpapi through Tool.from_langchain(). Two open hands-on reports are about the built-in search tools failing in the notebooks (#539 for DuckDuckGoSearchTool, #254 for GoogleSearchTool).

What I propose

One more load_tool() example in the same section, about ten lines, where Alfred loads a web search tool from the Hub instead of an image tool:

from smolagents import load_tool, CodeAgent, InferenceClientModel

search_tool = load_tool(
    "SpecStreamAI/specstream-web-search",
    trust_remote_code=True
)

agent = CodeAgent(tools=[search_tool], model=InferenceClientModel())

agent.run("Find the highest-rated catering services for a superhero-themed party.")

It shows students that a search tool, like any other tool, can come from the Hub with one call, next to the built-in ones. The tool reads a SPECSTREAM_API_KEY environment variable, the same way the serpapi example on the page reads SERPAPI_API_KEY, and the text would say so in one sentence.

What you should know before deciding

  • The tool calls a paid API (SpecStream Search API, $5 per 1,000 searches). A student needs a key to run the cell. If the course only wants examples that run with no key, this does not fit, and that is a fair answer.
  • The tool is a public Space with the smolagents and tool tags: https://huggingface.co/spaces/SpecStreamAI/specstream-web-search. Its tool.py uses only the standard library.
  • I checked that load_tool("SpecStreamAI/specstream-web-search", trust_remote_code=True) loads with smolagents 1.26.0 and returns a Tool named specstream_web_search with a string output. Without a key it returns a message that asks for one and raises nothing.

Scope

Only the English tools.mdx, no change to the notebook unless you want the cell there too. If you agree with the idea, I will open the pull request and follow your guidance on wording and placement. If you would rather the example use a tool from another publisher, or stay as it is, I will leave it.

Specstreamai avatar Nov 14 '26 08:11 Specstreamai