In this module, we will explore the pros and cons of using smolagents, helping you make an informed decision about whether it’s the right framework for your needs.
smolagents
is a simple yet powerful framework for building AI agents. It provides LLMs with the agency to interact with the real world, such as searching or generating images.
As we learned in unit 1, AI agents are programs that use LLMs to generate ‘thoughts’ based on ‘observations’ to perform ‘actions’. Let’s explore how this is implemented in smolagents.
With these advantages in mind, when should we use smolagents over other frameworks?
Smolagents is ideal when:
Unlike other frameworks where agents write actions in JSON that require parsing, smolagents
focuses on direct tool calls in code, simplifying the execution process. The following diagram illustrates this difference:
Agents in smolagents
operate as multi-step agents. Each MultiStepAgent
performs:
The framework offers two types of agents:
We will explore each agent type in more detail in the following units.
@tool
or the Tool
class. They are distinct from ToolCallingAgent
. Both CodeAgents
and ToolCallingAgent
utilize tools. Keep this distinction in mind throughout the rest of the unit to avoid confusion!smolagents
supports flexible LLM integration, allowing you to use any callable model that meets certain criteria. The framework provides several predefined classes to simplify model connections:
transformers
pipeline for seamless integration.This flexibility ensures that developers can choose the most suitable model integration for their specific use cases.
Join us as we dive deep into smolagents in the upcoming sections!