Smolagents - HuggingFace's NEW Agent Framework

The video introduces Hugging Face’s new “small agents” framework, designed to simplify the creation of agents by integrating with their extensive library of open-source models and allowing for dynamic interactions through code execution. The presenter demonstrates how to set up and run a simple agent, highlighting its flexibility and potential for custom tools, while also discussing the importance of agency in agent design.

In the video, the presenter discusses Hugging Face’s newly released agent framework called “small agents,” which aims to simplify the process of building agents. The framework comes in response to the growing interest in agentic frameworks in 2023, as various companies have launched their own versions. Hugging Face previously attempted to create an agent library with Transformers agents, but it did not gain traction. With small agents, the team has re-evaluated their approach based on insights gained from other frameworks and user feedback over the past 18 months.

One of the standout features of small agents is its integration with Hugging Face’s extensive library of open-source models. Users can access these models directly through the framework, although access may vary for free and pro users. The default model used is the Quen 2.5 Coda 32 billion model, but the framework also supports proprietary models from OpenAI and Anthropic. The video emphasizes the importance of agency in agents, discussing how different frameworks have approached the concept of agency, ranging from highly autonomous agents to those with restricted capabilities.

The presenter highlights the unique aspects of small agents, particularly the focus on code agents that can communicate and execute actions in code. This approach allows for a more dynamic interaction with the environment, enabling agents to perform tasks using Python code in a sandboxed environment. The framework supports both code agents and tool-calling agents, providing flexibility in how users can build their agents. The video also touches on the importance of understanding when to use agents, suggesting that they are most beneficial for tasks requiring dynamic decision-making.

The video includes a demonstration of how to set up and run a simple agent using small agents. The presenter walks through the process of importing necessary components, instantiating the agent, and executing tasks. Examples include calculating the cube root of a number and determining travel time between cities. The presenter notes that while the framework is easy to use, there are limitations, such as the need for authorized imports in the sandboxed environment, which can lead to errors if not properly configured.

Finally, the video discusses the potential for custom tools and the ability to push these tools to the Hugging Face Hub for broader use. The presenter expresses interest in exploring multi-agent setups and the potential for agents to learn from past mistakes. Overall, small agents show promise in providing a more flexible and powerful framework for building agents, while still maintaining a level of control over their agency. The presenter invites viewers to share their thoughts and questions, indicating a willingness to create follow-up content based on viewer interest.