smolagents (Hugging Face)
Hugging Face's minimal library for agents that act by writing code
Overview
smolagents is Hugging Face's lightweight, open-source Python library for building agents that write and execute Python code to call tools, with a conventional JSON tool-calling agent as an alternative. It is Apache-2.0, model-agnostic, supports MCP tools and multi-agent hierarchies, and succeeded transformers.agents.
Pricing
Pricing shown for reference only. These figures reflect RECATOOLS research as of 12 Oct 2026 and may be out of date or incomplete. This is not financial or purchasing advice — always confirm the current price on the provider’s official website before making any decision.
Use cases
What you can produce with smolagents (Hugging Face)
- CodeAgent: agents that write and execute Python to act
- ToolCallingAgent: standard JSON tool calling as an alternative
- Model-agnostic: local transformers or Ollama, Hub providers, or OpenAI and Anthropic via LiteLLM
- Sandboxed execution through E2B, Modal, Blaxel or Docker
- Tools from MCP servers, LangChain or Hub Spaces, plus multi-agent hierarchies
- Multimodal inputs and the smolagent and webagent command-line tools
smolagents' pitch is that an agent which writes Python to call tools needs fewer steps than one emitting JSON calls, with core agent code under 1,000 readable lines. It is model-agnostic, takes tools from MCP servers or LangChain, supports multi-agent hierarchies and has a documented plan-approval pattern.
It is a library, not a product: the local executor is not a sandbox, so production use means E2B, Modal, Blaxel or Docker, and work since the May 2026 release has been maintenance only. Fine for prototypes and single-agent automation.
What we found
smolagents is Hugging Face's open-source Python library for agents that act by writing code. The launch post went up on 31 December 2024, days after the first PyPI release, and the library replaced the older transformers.agents module. It is Apache-2.0, and the current release, v1.26.0, shipped on 29 May 2026.
That date says a lot about where the project stands. Since 1 June 2026 the main branch has taken 13 commits, all of them CI hardening, documentation or security-policy changes, with no new features and no new release. The library is being maintained rather than actively extended, which matters little for a small dependency but is worth weighing before building on it.
The design is simple. A CodeAgent writes Python that calls tools as functions, while a ToolCallingAgent uses conventional JSON tool calls. Hugging Face says the core agent logic runs to under 1,000 lines, and for the claim that code actions need about 30 per cent fewer steps it cites the academic CodeAct paper rather than its own testing. Models can be local transformers or Ollama models, Hub inference providers, or OpenAI, Anthropic and others through LiteLLM. Tools can come from MCP servers, LangChain or Hub Spaces, multi-agent hierarchies are supported, and a documented example pauses the agent so a person can approve or edit its plan. Earlier versions of this page said it lacked both.
Security is the caveat Hugging Face states most firmly: its README says the built-in local executor is not a security sandbox and directs users to E2B, Blaxel, Modal or Docker. Version 1.26 removed the remote WebAssembly executor.
Third-party comparisons describe the trade-off similarly. ZenML, which sells adjacent tooling, noted in 2025 that smolagents does not persist state across sessions by default. Run tracing comes through OpenTelemetry tools such as Phoenix or Langfuse rather than a built-in audit log, which regulated teams would need to set up themselves.
Compiled by RECATOOLS from public sources: vendor documentation and pricing, code repositories and published reporting.
About this listing
This entry was compiled from publicly available data including smolagents (Hugging Face)'s official website, press releases, documentation, and reputable third-party publications. RECATOOLS is not affiliated with smolagents (Hugging Face) unless explicitly stated.
Third-party AI tools update their pricing, features, availability, and policies frequently. Information here may be outdated by the time you read this — we make reasonable efforts to keep listings current, but cannot guarantee absolute accuracy.
For the latest details, please refer to smolagents (Hugging Face) directly →
Spotted something out of date? Suggest an update →
Related reading
Alternatives to smolagents (Hugging Face)
More in Agents & Automation