Framework · Hugging Face
smolagents at a glance
Hugging Face's small Python library, about a thousand lines, whose CodeAgent writes its actions as Python code. That code runs in sandboxes such as Modal, E2B or Docker, and agents and tools can be shared on the Hub.
Best for: Learning and research, especially agents that act by writing code.
Key facts
- Maintainer
- Hugging Face
- Languages
- Python
- Licence
- Apache-2.0
- Latest version
1.26.0· May 29, 2026- Repository
- huggingface/smolagents
- Hosted option
- None
Quickstart
Install the package, set the credentials, then run the smallest agent from the official docs. Model IDs are the ones the docs use and may not be enabled on your account.
pip install 'smolagents[toolkit]'from smolagents import CodeAgent, InferenceClientModel
# Initialize a model (using Hugging Face Inference API)
model = InferenceClientModel() # Uses a default model
# Create an agent with no tools
agent = CodeAgent(tools=[], model=model)
# Run the agent with a task
result = agent.run("Calculate the sum of numbers from 1 to 10")
print(result)Features
| Any model | Yes | HF Inference Providers, LiteLLM, local Transformers and Ollama |
|---|---|---|
| MCP client | Yes | Tools from any MCP server, LangChain or Hub Spaces |
| MCP server | Not confirmed | |
| Multi-agent | Yes | Agents can orchestrate other agents |
| Durable runs | Not confirmed | |
| Human approval | Not confirmed | |
| Tracing | Not confirmed | |
| Evals | No |
Recent changes
- No PyPI release since 1.26.0 on 29 May 2026, though the repo still received commits in late September 2026.