Skip to content

SmolAgents

The smallest complete agent framework. A CodeAgent writes Python to accomplish tasks; a ToolCallingAgent uses JSON tool-calling. The entire core is ~1,000 lines — readable, hackable, and a great first step into agents.

Install

Terminal window
pip install smolagents

Version

v1.26.0 · May 2026 · Python 3.10+

Best for

Learning, prototyping, simple automation, code-first workflows.

  • v1.26.0 (May 2026) — Minor release; maintenance and dependency updates. All key symbols (CodeAgent, ToolCallingAgent, InferenceClientModel, LiteLLMModel, tool, MultiStepAgent) verified against installed smolagents==1.26.0 (.routine-envs/check-0529-smolagents); no DeprecationWarning emissions.
  • v1.25.0 (May 2026) — Minor release. InferenceClientModel default model updated to Qwen/Qwen3-Next-80B-A3B-Thinking. All key symbols (CodeAgent, ToolCallingAgent, InferenceClientModel, LiteLLMModel, tool, MultiStepAgent) verified against installed smolagents==1.25.0 (.routine-envs/check-0519-py); no DeprecationWarning emissions.
  • v1.24.0 (April 2026)HfApiModel removed; raises ImportError. Use InferenceClientModel for all HuggingFace-hosted model access. Expanded model compatibility; token_counts tracking fix for managed agents; vision model support for web browsing agents.
from smolagents import CodeAgent, tool
@tool
def add_numbers(a: int, b: int) -> int:
"""Add two numbers together."""
return a + b
agent = CodeAgent(tools=[add_numbers])
result = agent.run("What is 15 + 27?")
print(result)

Ready? Start Zero → Hero Step 1 →


DateVersionChanges
2026-05-291.26.0Version bumped 1.25.0 → 1.26.0; “What’s new” heading updated; v1.26.0 bullet added; comprehensive guide header updated; revision history entry added. CodeAgent, ToolCallingAgent, InferenceClientModel, LiteLLMModel, tool, MultiStepAgent verified against installed smolagents==1.26.0 (.routine-envs/check-0529-smolagents); no DeprecationWarning.
2026-05-191.25.0Version bumped 1.24.0 → 1.25.0; “What’s new” updated; InferenceClientModel default model change noted. CodeAgent, ToolCallingAgent, InferenceClientModel, LiteLLMModel, tool, MultiStepAgent verified against installed smolagents==1.25.0 (.routine-envs/check-0519-py); no DeprecationWarning.
2026-04-211.24.0Index redesigned with Zero → Hero + Jump-to-topic grid.
January 16, 20261.24.0Expanded model providers; tool call perf; multi-agent patterns.
November 20251.23.0Initial documented version.