





Deep Research build By Smolagents FREE
Powered By Smolagents
Ai code Smolagents | FAST&FREE
Powered By Together AI and LlamaCoder
smolagents and tools gallery
best smolagents in huggingface
What are agents?
AI Agents are programs where LLM outputs control the workflow.
The table illustrates how agency varies across systems:
Agency Level | Description | How that’s called | Example Pattern |
---|---|---|---|
☆☆☆ | LLM output has no impact on program flow | Simple processor | process_llm_output(llm_response) |
★☆☆ | LLM output determines basic control flow | Router | if llm_decision(): path_a() else: path_b() |
★★☆ | LLM output determines function execution | Tool call | run_function(llm_chosen_tool, llm_chosen_args) |
★★★ | LLM output controls iteration and program continuation | Multi-step Agent | while llm_should_continue(): execute_next_step() |
★★★ | One agentic workflow can start another agentic workflow | Multi-Agent | if llm_trigger(): execute_agent() |
Feature of SmolAgents
🤗 Smolagents is a minimalist AI agent framework developed by the Hugging Face team, crafted to enable developers to deploy robust agents with just a few lines of code. Embracing simplicity and efficiency, smolagents empowers large language models (LLMs) to interact seamlessly with the real world.
✨ Simplicity
Compact Codebase: With approximately 1,000 lines of core code in agents.py
, smolagents keeps abstractions to a minimum for straightforward development.
User-Friendly
Developers can swiftly define agents, supply the necessary tools, and run them immediately without intricate configurations.
Code Agents
smolagents focuses on code agents, where agents write and execute Python code snippets to perform actions, instead of generating actions as JSON or text blobs.
High Efficiency
Compared to standard tool-calling methods, code agents offer enhanced efficiency and accuracy, reducing steps and LLM calls by about 30%, and achieving superior performance on complex benchmarks.
Secure Execution
To ensure safe code execution, smolagents supports running code in sandboxed environments like E2B, providing a protected and isolated execution space.
Various LLMs
smolagents integrates effortlessly with any large language model, including models hosted on the Hugging Face Hub via Transformers, as well as models from OpenAI, Anthropic, and others through LiteLLM integration.

SmolAgents :Integration with Hugging Face Hub
Share and Load Tools: Deep integration with the Hugging Face Hub allows developers to easily share and import tools, fostering collaboration and sharing within the community.
Ecosystem Growth: Leveraging the Hub’s capabilities, smolagents continually expands with more functionalities and tools, offering limitless potential for development.
Support for Traditional Tool-Calling Agents
Variety of Choices: In addition to code agents, smolagents also supports traditional tool-calling agents, where actions are written as JSON or text blocks, suitable for specific scenarios and requirements.


Reasons to Opt for Code smolAgents
Superior Composability: Code naturally supports function nesting and reuse, allowing for the expression of complex logic.
Efficient Object Handling: Compared to JSON, code simplifies the management and transfer of objects.
Ultimate Flexibility: Code can represent any operation a computer can perform, providing immense versatility.
Extensive Training Data: LLMs have been trained on vast amounts of high-quality code, enhancing their ability to generate and comprehend code.
Performance Benefits of smolagents
In various benchmarks, smolagents utilizing open-source models have matched the performance of agents using proprietary models. Thanks to the efficiency of code agents and the continuous advancements of open-source models, developers can build powerful agent systems without relying on closed-source services.

Application example of SmolAgents
In Smolagents, agents are encapsulated in classes that allow them to perform specific tasks. For instance, a ManagedAgent
can be created to manage various tasks by utilizing different agent types. Below is a simplified example of how two agents—one for web searching and another for image generation—can be implemented,Here’s how to make a custom tool that gets travel times from Google Maps, and how to use it into a travel planner agent:
from typing import Optional
from smolagents import CodeAgent, HfApiModel, tool
@tool
def get_travel_duration(start_location: str, destination_location: str, transportation_mode: Optional[str] = None) -> str:
"""Gets the travel time between two places.
Args:
start_location: the place from which you start your ride
destination_location: the place of arrival
transportation_mode: The transportation mode, in 'driving', 'walking', 'bicycling', or 'transit'. Defaults to 'driving'.
"""
import os # All imports are placed within the function, to allow for sharing to Hub.
import googlemaps
from datetime import datetime
gmaps = googlemaps.Client(os.getenv("GMAPS_API_KEY"))
if transportation_mode is None:
transportation_mode = "driving"
try:
directions_result = gmaps.directions(
start_location,
destination_location,
mode=transportation_mode,
departure_time=datetime(2025, 6, 6, 11, 0), # At 11, date far in the future
)
if len(directions_result) == 0:
return "No way found between these places with the required transportation mode."
return directions_result[0]["legs"][0]["duration"]["text"]
except Exception as e:
print(e)
return e
agent = CodeAgent(tools=[get_travel_duration], model=HfApiModel(), additional_authorized_imports=["datetime"])
agent.run("Can you give me a nice one-day trip around Paris with a few locations and the times? Could be in the city or outside, but should fit in one day. I'm travelling only with a rented bicycle.")
After a few steps of gathering travel times and running calculations, the agent returns this final proposition:One-day Paris bike trip itinerary:
1. Start at Eiffel Tower at 9:00 AM.
2. Sightseeing at Eiffel Tower until 10:30 AM.
3. Travel to Notre-Dame Cathedral at 10:46 AM.
4. Sightseeing at Notre-Dame Cathedral until 12:16 PM.
5. Travel to Montmartre at 12:41 PM.
6. Sightseeing at Montmartre until 2:11 PM.
7. Travel to Jardin du Luxembourg at 2:33 PM.
8. Sightseeing at Jardin du Luxembourg until 4:03 PM.
9. Travel to Louvre Museum at 4:12 PM.
10. Sightseeing at Louvre Museum until 5:42 PM.
11. Lunch break until 6:12 PM.
12. Planned end time: 6:12 PM.
After building a tool, sharing it to the Hub is as simple as:
get_travel_duration.push_to_hub("{your_username}/get-travel-duration-tool")
Resources of SmolAgents
What are people talking about SmolAgents on X.com
The new smolagents library released today by @huggingface looks really impressive.
— Ben Klieger (@benklieger) December 31, 2024
Combining simplicity (main file is only ~1000 lines!) and benchmarked opinionated functionality (supporting code-first approach over direct function calling) 🔥
A tutorial thread (🧵) pic.twitter.com/sKuakggpcM
I spent my weekend learning about agentic workflows and playing around with the smolagents library released by @huggingface. With this, I built a pretty cool Travel Assistant Agent (I call it Tracy).
— Arnav Jaitly (@arnitly) January 6, 2025
I use CodeLlama-34b-Instruct-hf for my LLM agents in the backend to do a… pic.twitter.com/e7GHA7rVlk
OK, @huggingface I'd say pulled it off with smolagents and their agent definition.
— Gerred (@devgerred) December 31, 2024
Maybe clients do just need to be a negotiating party and we need to keep investing in the LLMs themselves. I love the immediate clarity of this. pic.twitter.com/sD6qMqpzgs
smolagents is now available in ai-gradio
— AK (@_akhaliq) December 31, 2024
pip install ai-gradio[smolagents]==0.2.1
then simply do
import gradio as gr
import ai_gradio
gr.load( name='smolagents:meta-llama/Llama-3.1-8B-Instruct',
src=ai_gradio.registry).launch() pic.twitter.com/r7vfhrW36l
Hugging Face has introduced Smolagents, a library designed to build agentic systems using large language models (LLMs).
— Mazhar Choudhry (@mazrnow) January 5, 2025
Unlike traditional LLM-based syste…
Show more https://t.co/EBEWPBEwAj pic.twitter.com/h2xswDLAxg
smolagents – build your own Devin like agents in 3 lines of code with search! 🔥 pic.twitter.com/PPyhbFWN5w
— Vaibhav (VB) Srivastav (@reach_vb) December 29, 2024
Agent 元年来势汹汹啊!一周猛涨 3.9K Star? ⚡️ @huggingface 正式发布并开源 smolagents!🔥
— Tom Huang (@tuturetom) January 8, 2025
3 行代码启动一个 Agent 完成复杂工作,支持 40+ LLM,支持无缝连接 Huggingface hub 下载一些自定义模型
不仅是一个 Agent 框架,还是一个将 HF 所有有价值的大小模型作为工具融入 Agent 的伟大尝试 pic.twitter.com/wJZ9ZL8nRT