Skip to main content
SmolAgents ToolCallingAgent (ReAct) with Celsius, Prime, and Memo tools, demonstrating AI agent capabilities.

Editorial illustration for SmolAgents introduces ToolCallingAgent (ReAct) with Celsius, Prime, and Memo tools

SmolAgents' ReAct AI Can Switch Tools Autonomously

SmolAgents introduces ToolCallingAgent (ReAct) with Celsius, Prime, and Memo tools

2 min read

SmolAgents is pushing the envelope on how developers stitch together AI components. The latest release adds a dedicated ToolCallingAgent that follows the ReAct framework, letting a single model flip between reasoning and action without manual prompting. What’s noteworthy is the built‑in support for three distinct utilities: a temperature converter, a prime‑number generator, and a memo‑style note keeper.

By bundling these tools, the agent can answer queries that span unit conversion, simple math, and short‑term memory tasks—all within a bounded interaction loop. The configuration parameters—such as a five‑step ceiling and a modest verbosity setting—signal an intent to keep runs predictable while still exposing enough detail for debugging. For teams that need a lightweight orchestration layer rather than a full‑blown workflow engine, this approach offers a clear, code‑first path.

Below, the snippet shows exactly how the agent is instantiated and invoked, giving a concrete glimpse of the API in action.

section("SECTION 6 · ToolCallingAgent (ReAct)") from smolagents import ToolCallingAgent react_agent = ToolCallingAgent( tools = [celsius_to_fahrenheit, PrimeTool(), MemoTool()], model = engine, max_steps = 5, verbosity_level = 1, ) console.print("\n[bold yellow]Task 4:[/bold yellow]") result4 = react_agent.run( "Then retrieve both facts and summarise them." ) show("ToolCallingAgent -- Task 4", result4) section("SECTION 7 · Multi-Agent Orchestration (v1.8+ API)") math_agent = CodeAgent( tools = [PrimeTool()], model = engine, max_steps = 4, name = "math_specialist", description = "Handles mathematical questions and primality checks.", verbosity_level = 0, ) research_agent = ToolCallingAgent( tools = [DuckDuckGoTool(), MemoTool()], model = engine, max_steps = 4, name = "research_specialist", description = "Searches the web and stores or retrieves facts from memory.", verbosity_level = 0, ) manager_agent = CodeAgent( tools = [], model = engine, managed_agents = [math_agent, research_agent], max_steps = 8, verbosity_level = 1, ) console.print("\n[bold yellow]Task 5:[/bold yellow]") result5 = manager_agent.run( "Find out what year Python was first released (use research_specialist), " "then check whether that year is a prime number (use math_specialist)." ) show("Manager Agent -- Task 5", result5) We build a ToolCallingAgent to showcase structured ReAct-style reasoning with controlled tool invocation.

Can a handful of lightweight agents truly handle production workloads? The tutorial shows SmolAgents assembling a CodeAgent and a ToolCallingAgent that reason, run code, and call custom utilities such as a Celsius‑to‑Fahrenheit converter, a prime‑number generator, and a memo store. By installing a few dependencies and pointing a compact LLM backend to the engine, the author walks through configuring max_steps, verbosity, and tool registration.

The resulting system executes a five‑step ReAct loop, printing intermediate output and returning a final result for Task 4. Yet the article does not provide benchmarks, error rates, or guidance on scaling beyond the illustrated scenario. It remains unclear whether the same pattern holds for more complex pipelines or larger data sets.

The code snippets are concise, and the modular tool design appears straightforward, but the absence of performance metrics leaves open questions about reliability in real‑world deployments. Overall, the guide demonstrates that SmolAgents can be wired together quickly, though further validation would be needed to assess robustness under varied workloads.

Further Reading

Common Questions Answered

How does the ToolCallingAgent in SmolAgents implement the ReAct framework?

The ToolCallingAgent follows the ReAct framework by allowing a single model to dynamically switch between reasoning and action without manual prompting. It supports multiple tools like temperature conversion, prime number generation, and memo storage, enabling the agent to handle complex multi-step tasks within a maximum of 5 steps.

What specific tools are bundled with the SmolAgents ToolCallingAgent?

The ToolCallingAgent includes three distinct utilities: a Celsius-to-Fahrenheit temperature converter, a prime number generator, and a memo-style note keeper. These tools allow the agent to perform unit conversions, mathematical operations, and note-taking tasks within a single interaction.

How can developers configure the ToolCallingAgent in SmolAgents?

Developers can configure the ToolCallingAgent by specifying tools, selecting a model engine, setting a maximum number of steps (max_steps), and defining a verbosity level. The configuration allows for flexible and customizable agent behavior, with the ability to register custom tools and control the agent's operational parameters.