This repository contains the code examples and resources for the "Build AI Agents with smolagents" tutorial course.
- 📝 PDF Slides
- 📺 YouTube Course
- ☕ Support
- https://huggingface.co/docs/smolagents/index
- https://huggingface.co/learn/agents-course/unit0/introduction
Learn how to build powerful AI agents using the smolagents framework. This course covers both theoretical concepts and practical implementation, including:
- Understanding AI agents, components, and architecture
- Exploring workflow types and multi-agent collaboration patterns
- Building agents with custom tools and UI
- Creating multi-agent systems
- Implementing monitoring with OpenTelemetry and LangFuse
- Sharing your agents on Hugging Face Spaces
- Python 3.10 or higher
- A Hugging Face API token
- Clone the repository
git clone https://github.com/XamHans/smolagents-course.git
cd smolagents-course- Install uv
We'll use uv, a fast Python package installer and resolver, for setting up the environment.
# macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows using PowerShell
irm -Uri https://astral.sh/uv/install.ps1 | iex
# Alternatively, install via pipx
pipx install uv- Set up your environment with uv
# Create and activate a virtual environment
uv venv
source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
# Sync dependencies from the lockfile
uv syncThe project uses a lockfile (uv.lock) and project configuration (pyproject.toml), so uv sync will install the exact versions of dependencies specified in these files.
- Configure your environment variables
# Copy the example .env file
cp .env.example .env
# Edit the .env file with your Hugging Face API token
# Get your token from: https://huggingface.co/settings/tokensmain.py- Basic agent example to get startedagent-with-ui.py- Example of an agent with user interfaceagent-with-monitor.py- Implementation with monitoring capabilitiesmulti-agents.py- Multi-agent system exampleshare-agents.py- Code to share your agents on Hugging Face Spaces
uv run main.pyuv run agent-with-ui.pyuv run multi-agents.pyThis course uses Hugging Face models, which require an API token for access. To obtain your token:
- Create an account at Hugging Face
- Go to Settings > Access Tokens
- Create a new token with read permission
- Add this token to your
.envfile
The video course provides detailed explanations for all code examples in this repository. The course walks through each implementation step-by-step, covering both theory and practice.
Feel free to submit issues or pull requests if you find any problems or have suggestions for improvements.
This project is licensed under the MIT License - see the LICENSE file for details.