My experience and feedback on Hugging Face (smolagent) Agent Course (so far)

Alain Airom (Ayrom)
3 min readFeb 27, 2025

--

A feedback on Hugging Face AI Agents course!

Image provided by HuggingFace

Introduction

Hugging Face since recently provides a really nice multi-level course on AI Agents. As their site mentions, the aim for the leaner is to build a solid foundation in the fundamentals of AI Agents.

This goes through the following agenda;

  • Understanding Agents
  • The Role of LLMs (Large Language Models) in Agents
  • Tools and Actions
  • The Agent Workflow

The course unit 1 “Introduction to Agents” is a very good introductory part and I think everybody wanting to learn in this field should follow it.

The unit 2, just accessible online is around “Frameworks for AI Agents”.

Each of the units come with a series of quiz and questions, at the end of unit 2, the student should provide code samples in order to show their understanding of the subject.

My experience with “Frameworks for AI Agents” exam

As this exam in not graded nor certifying I wanted to share my feedback and experience with this unit.

There are 5 code samples to be provided and the student should provide 80% of the exam to validate the unit (self validation, no glories, badges or whatsoever of the kind 😅). I had to do several attempts to achieve the 80% grade, and sometime over-providing of the code was unnecessary and unproductive ☠️!

The questions are the following.

Question 1: Create a Basic Code Agent with Web Search Capability

### sample provided
from smolagents import CodeAgent

agent = CodeAgent(
tools=[], # Add search tool here
model=None # Add model here
)

My answer which worked fine;

from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel


agent = CodeAgent(
tools=[DuckDuckGoSearchTool()],
model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
)


response = agent.run("best music for a party")
print(response)

Question 2: Set Up a Multi-Agent System with Manager and Web Search Agents

# sample provided
web_agent = ToolCallingAgent(
tools=[], # Add required tools
model=None, # Add model
max_steps=5, # Adjust steps
name="", # Add name
description="" # Add description
)

manager_agent = CodeAgent()

My answer (OK)

from smolagents import CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, HfApiModel, VisitWebpageTool

web_agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
max_steps=10,
name="search",
description="Agent to perform web searches and visit webpages."
)


manager_agent = CodeAgent(
model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
managed_agents=[web_agent],
additional_authorized_imports=["pandas", "time", "numpy"] # Corrected imports
)

Question 3: Configure Agent Security Settings

# code sample example
from smolagents import CodeAgent

agent = CodeAgent(
tools=[],
model=model
# Add security configuration
)

My answer (KO! several attempts, does not pass… 🫣)

from smolagents import CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, HfApiModel


web_agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool()],
model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
max_steps=10,
name="WebSearchAgent",
description="Agent for web searches using DuckDuckGo."
)

manager_agent = CodeAgent(
model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
managed_agents=[web_agent],
additional_authorized_imports=["pandas"]

Question 4: Implement a Tool-Calling Agent

# code provided as example
from smolagents import ToolCallingAgent



agent = ToolCallingAgent(

# Add configuration here

)

And what I provided (and was OK)👇

from smolagents import ToolCallingAgent, HfApiModel, DuckDuckGoSearchTool

agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool()],
model=HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
name="SearchAgent",
description="An agent that uses DuckDuckGo to search the web.",
max_steps=5,
)

Question 5: Set Up Model Integration

from smolagents import HfApiModel

model = # Add model configuration

And my answer which passed!

from smolagents import HfApiModel, LiteLLMModel

hf_model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")


litellm_model = LiteLLMModel(model_id="anthropic/claude-3-sonnet")


model = hf_model

Conclusion

I recommend absolutely this course for anyone who is kind-of newbie in AI Agents.

Thanks for reading 👍

Useful link

--

--

Alain Airom (Ayrom)
Alain Airom (Ayrom)

Written by Alain Airom (Ayrom)

IT guy for a long time... sharing my hands-on experiences and technical subjects of my interest. A bit "touche à tout"!

Responses (2)