Install
pip install "smolagents[toolkit]==1.26.0"Hugging Face's compact agent library — agents that act by writing Python code, plus classic tool-calling agents.
Agents that act in code. A CodeAgent writes short Python snippets that call your tools, loop and compute; a ToolCallingAgent uses ordinary JSON tool calls. The core is small enough to read in an afternoon, which makes it a good first framework and an easy one to debug.
Current version: smolagents 1.26.0 (checked 2026-11-19). Python 3.10+.
Install
pip install "smolagents[toolkit]==1.26.0"Source
huggingface/smolagents · Apache-2.0
Best for
Learning, prototyping, code-first automation, Hugging Face Hub workflows.
WebSearchTool engine; the experimental WasmExecutor (executor_type="wasm") removed.allow_pickle defaults to False; documentation now states plainly that LocalPythonExecutor is not a sandbox; huggingface-hub 1.x supported.FinalAnswerStep passed to step_callbacks; saved agents that reference the old HfApiModel class load as InferenceClientModel (the HfApiModel import itself has not existed since 1.19.0).from smolagents import CodeAgent, InferenceClientModel, tool
@tooldef add_numbers(a: int, b: int) -> int: """Add two numbers together.
Args: a: The first number. b: The second number. """ return a + b
model = InferenceClientModel(model_id="Qwen/Qwen3.8-27B") # needs HF_TOKENagent = CodeAgent(tools=[add_numbers], model=model)print(agent.run("What is 15 + 27?"))Pass a model_id: the library’s default model had no live Inference Provider when this was checked on 2026-10-21. See model configuration for how to check which providers serve a model.
Next: Introduction & philosophy, the first step of the learning path.
| Date | Version | Changes |
|---|---|---|
| 2026-10-24 | 1.26.0 | Audit against the installed package: corrected the Inference Endpoint example, step-callback registration, GradioUI.launch() sharing default, Docker image rebuilds, the browser-agent recipe and step counting; added sections on memory and steps, planning, MCP, local-executor limits, saving agents and tools, delegation, and scripted tests for tool-calling agents. |
| 2026-10-21 | 1.26.0 | Diagrams page cut to accurate diagrams; tools-in-sandbox, LogLevel and quantisation corrections; served model IDs; recipes for the browser agent, agentic RAG and plan review; streaming endpoint and in-flight autoscaling in the production guide. |
| 2026-10-21 | 1.26.0 | All pages re-verified against the installed package; code rewritten where it used non-existent APIs; release notes corrected; version references now come from the site’s version data. |
| 2026-05-29 | 1.26.0 | Version bump. |
| 2026-04-21 | 1.24.0 | Index redesigned with a learning path and topic grid. |
| November 2025 | 1.23.0 | Initial documented version. |