Minimalist HuggingFace agent framework where agents write actions as Python code. ~1,000 lines of core logic. Released December 2024. Current version is 1.24.0 (Mar 2026). Releases frequently — weekly cadence. Two agent types: CodeAgent (writes Python code) and ToolCallingAgent (JSON tool calls).
pip install smolagentsVerified import paths — ran on the pinned version, not inferred.
Minimal CodeAgent with web search using InferenceClientModel 1.24.x.
Replace HfApiModel() with InferenceClientModel(). Same constructor signature.
from smolagents import WebSearchTool
pip install 'smolagents[transformers]'
Let smolagents manage huggingface-hub version. Do not pin huggingface-hub independently.
Pass managed_agents=[sub_agent] directly to CodeAgent constructor.
Pass use_e2b_executor=True or configure docker/modal sandbox on agent init.
Pin with smolagents==1.24.0 in requirements.txt
Upgrade Python to 3.10 or newer.