This project demonstrates the usage of Smolagents, a minimalist AI agent framework developed by Hugging Face.
- Create a virtual environment (recommended):
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the project root and add your Hugging Face API token:
HUGGINGFACE_API_TOKEN=your_token_here
requirements.txt: Project dependenciesexample.py: Basic example of using Smolagentssmol_agents.ipynb: Interactive Jupyter notebook with multiple examples.env: Environment variables (create this file)
python3 example.pyjupyter notebookThen open smol_agents.ipynb in your browser.
The notebook contains three examples:
- Calculator Function: Creates a function for basic arithmetic operations
- List Operations: Demonstrates various list manipulations (duplicates, second largest, rotation)
- String Manipulation: Shows advanced string operations (word reversal, palindrome checking, title case)