π΅οΈββοΈ Hugging Face Agents Course β Final Agent
A production-ready AI agent built with Hugging Face smolagents.
| Piece | What it does |
|---|---|
CodeAgent |
Writes short Python actions to call tools |
InferenceClientModel |
Free Hub inference (Qwen/Qwen2.5-Coder-32B-Instruct) |
| Tools | Web search, visit webpage, calculator, text summarizer |
| Gradio UI | Chat tab + Unit 4 certificate evaluation / submit tab |
submit_answers.py |
Local CLI that submits scores without needing a Space |
Note on model class names: older tutorials mentioned
HuggingFaceHubServerModel/HfApiModel.
In currentsmolagents, that Hub backend is calledInferenceClientModel.
Important (2026): Creating new Gradio Spaces on Hugging Face now requires a PRO plan (or an eligible older account for ZeroGPU).
If you cannot create a Space, use the local runner below β it still submits to the official Unit 4 leaderboard.
Public code: https://huggingface.co/shazaaad/agents-course-final-agent
What you need for the certificate
To earn the Certificate of Completion you must score β₯ 30% on the Unit 4 GAIA subset leaderboard.
- Run the agent (Space or local
submit_answers.py). - Submit answers to the scoring API.
- Check your score on the student leaderboard.
Also complete Unit 1 and one use-case assignment as required by the course.
Set up your Hugging Face API token (HF_TOKEN)
A) On a Hugging Face Space (if you have PRO / eligible ZeroGPU)
- Open your Space β Settings β Variables and secrets.
- Add secret
HF_TOKEN= your token from https://huggingface.co/settings/tokens.
B) On your computer (works without Spaces PRO)
- Create a token at https://huggingface.co/settings/tokens.
- Copy
.env.exampleβ.envand paste:
HF_TOKEN=hf_your_token_here
Or run: hf auth login
Run locally (4 steps)
- Open a terminal in this project folder.
- Create & activate a virtual environment:
python -m venv .venv
- Windows PowerShell:
.venv\Scripts\Activate.ps1 - macOS / Linux:
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Add your token, then either:
Chat UI
python app.py
Certificate submission (recommended if you have no Space)
python submit_answers.py
Open the local URL Gradio prints (usually http://127.0.0.1:7860) when using app.py.
Push to a Hugging Face Space (if your account allows Gradio)
- Create a Space at https://huggingface.co/new-space (Gradio + CPU basic / ZeroGPU).
- Upload
app.py,requirements.txt, andREADME.md. - Add secret
HF_TOKEN. - Open Certificate Evaluation β Log in β Submit.
- Score β₯ 30% β claim your certificate.
Optional: push with CLI
hf upload YOUR_USERNAME/YOUR_SPACE_NAME . --repo-type space
Project files
hf-agents-course-final/
βββ app.py # Agent + Gradio UI (chat + certificate submit)
βββ submit_answers.py # Local leaderboard submission (no Space needed)
βββ requirements.txt # Python packages
βββ README.md # This file
βββ .env.example # Template for local HF_TOKEN
βββ .gitignore
Good luck β youβve got this! π