Tools smolagents (Hugging Face)
Tool : A precise action the AI can call · requires huggingface
Tools declared with a simple decorator, code execution by the agent.
Minimalist and elegant; the agent writes Python, so sandboxing is required.
Security reflects where data goes, requested permissions and incidents on record at the verification date. It is not a guarantee of zero risk: check the deployment mode and the connections you enable.
What it does, concretely
Building an AI agent capable of using tools usually requires a lot of infrastructure code. smolagents reduces this complexity to a few dozen lines by providing a minimalist Python library, fully open source under the Apache license.
The core principle relies on the CodeAgent: instead of calling tools via JSON, the agent directly writes Python code to chain actions, nest functions, use loops or conditionals. Tools are declared with a simple Python decorator, making them immediately available to the agent. A second agent type, ToolCallingAgent, remains available for scenarios where JSON-based tool calling is preferred.
The library targets Python developers who want to prototype or deploy agents without depending on a specific model provider: it supports Hugging Face models, OpenAI, Anthropic, LiteLLM, local Transformers and Ollama. Tools can come from an MCP server, LangChain, or a Hugging Face Space.
However, smolagents is not suited for people without Python experience: there is no consumer-facing graphical interface, and managing security when executing agent-generated code remains the developer's responsibility, requiring a sandbox environment (Modal, E2B, Docker, Blaxel) for production use.
What it offers
- ·Tool declaration via a simple Python decorator, with no additional configuration.
- ·CodeAgent: the agent writes and executes Python code to chain actions and tools.
- ·ToolCallingAgent: support for classic JSON or text-based tool calling.
- ·Compatibility with many model providers: Hugging Face, OpenAI, Anthropic, LiteLLM, local Transformers, Ollama.
- ·Integration of tools from MCP servers, LangChain, or Hugging Face Spaces.
- ·Share and load agents and tools from the Hugging Face Hub as Gradio Spaces.
- ·Support for multimodal inputs: text, image, video, and audio.
- ·Command-line tools (smolagent, webagent) to run an agent without writing boilerplate code.
In practice
- Price
- Free
- Commercial use
- Commercial use: yes
- Available on
- sdk-python
- Host
- huggingface
- Licence
- Apache-2.0
- FR interface
- No
Security and data
- Rating
- Security: one caveat, see the card
- Capabilities
- readswritesexecutesnetwork
- Your data
- Data stays local
- Maintenance
- Active
Links and repository checked on 25 October 2026 · added on 1 December 2024
How to install Tools smolagents (Hugging Face)
pip install 'smolagents[toolkit]'