Hugging Face has introduced smolagents, an open-source library built for developers who want to create AI agents without a large framework around them. The pitch is direct: keep the library small, reduce setup friction, and still cover the difficult parts of agent development.
The project is described as deliberately lightweight, with just about a thousand lines of code. After installing it through pip, Hugging Face shows that developers can get an agent running with only a few lines of code, including a demo where an agent uses DuckDuckGo to answer complex questions.
A smaller framework for a growing agent market
AI agent frameworks are becoming a crowded category. The source article notes that OpenAI, Microsoft, and AWS have all released their own approaches recently, which puts smolagents into a wider push to make language models act through tools and workflows rather than only return text.
Smolagents is positioned differently from larger, more layered systems. Its main distinction is its stripped-down design. Hugging Face says the library keeps the developer experience simple while still handling the harder parts of building agents.
That matters because agents usually require more than a prompt. They need access to tools, a way to decide when to use those tools, and a mechanism for turning the model's reasoning into actions. Smolagents tries to make that machinery easier to use without asking developers to adopt a heavy codebase.
CodeAgent changes how tools are used
The central component in smolagents is called CodeAgent. Instead of making a model output a dictionary that describes which tools should be called, CodeAgent allows the model to write Python code directly.
That design is a notable choice because it treats code itself as the action format. In practical terms, the model can express tool use through Python rather than through a separate structured tool-calling layer.
According to Hugging Face, this approach reduces the number of steps by 30 percent and requires fewer AI calls. Hugging Face also says it performs better on benchmarks. The source does not provide the benchmark details, so the important takeaway is the stated direction: fewer intermediate steps, fewer model calls, and improved benchmark performance according to Hugging Face.
For developers who do not want that code-first method, smolagents also includes ToolCallingAgent. That option follows the more traditional tool calling approach, giving teams a choice between the newer CodeAgent pattern and the standard method already used across much of the industry.
Model support is intentionally broad
Smolagents is not limited to one model family. The framework works with language models from OpenAI and Anthropic, as well as models hosted on Hugging Face Hub.
Developers can connect to those models through several routes named in the source article:
- the Hub's Transformers library
- the HF Inference API
- LiteLLM
This flexibility is important for a developer tool because agent projects often need to switch between local, hosted, and third-party models. The source does not describe every supported setup, but it makes clear that smolagents is designed to work across multiple model access paths rather than a single fixed backend.
Security is part of the design
Letting an AI agent write and run code creates obvious risk. The source article states that smolagents includes several security features to address that concern.
Developers can choose between a secure Python interpreter for local execution or a sandboxed environment with E2B. That gives users a way to separate generated code from normal execution paths, depending on how they want to run the agent.
The presence of these options does not remove the need for caution. But it does show that Hugging Face is treating execution safety as a core part of the framework, not as an afterthought. For any system where a model can produce executable Python, that boundary matters.
Tools can move through Hugging Face Hub
Smolagents also connects agent building to Hugging Face Hub. The platform lets users share and load tools through the Hub, and the source article says more hub features are planned for the future.
That could make the library more useful over time if developers can reuse tools instead of rebuilding them for every agent. The article does not specify what the future hub features will be, so the current fact is narrower: tool sharing and loading through Hugging Face Hub are already part of the platform's direction.
The smolagents project is available on GitHub. For developers evaluating AI agent frameworks, its main claim is not that agents are new, but that building them can be made smaller, clearer, and more direct. With CodeAgent, ToolCallingAgent, broad model support, and execution options including a secure Python interpreter and E2B, Hugging Face is offering a compact framework for a fast-moving part of AI development.