πŸ•΅οΈβ€β™‚οΈ 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 current smolagents, that Hub backend is called InferenceClientModel.

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.

  1. Run the agent (Space or local submit_answers.py).
  2. Submit answers to the scoring API.
  3. 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)

  1. Open your Space β†’ Settings β†’ Variables and secrets.
  2. Add secret HF_TOKEN = your token from https://huggingface.co/settings/tokens.

B) On your computer (works without Spaces PRO)

  1. Create a token at https://huggingface.co/settings/tokens.
  2. Copy .env.example β†’ .env and paste:
HF_TOKEN=hf_your_token_here

Or run: hf auth login


Run locally (4 steps)

  1. Open a terminal in this project folder.
  2. Create & activate a virtual environment:
python -m venv .venv
  • Windows PowerShell: .venv\Scripts\Activate.ps1
  • macOS / Linux: source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. 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)

  1. Create a Space at https://huggingface.co/new-space (Gradio + CPU basic / ZeroGPU).
  2. Upload app.py, requirements.txt, and README.md.
  3. Add secret HF_TOKEN.
  4. Open Certificate Evaluation β†’ Log in β†’ Submit.
  5. 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! πŸŽ“

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support