Natsumix/final-assignment-agent
Final Assignment Agent
This public, Static Hugging Face Space is the project page for my Hugging Face Agents Course final assignment. The runnable agent lives in agent.py and is deliberately executed outside the Space (for example, in Google Colab or a local Python environment).
What it does
The agent uses `smolagents`, web search, and one model call per task to research a task. With Gemini, it also downloads and processes attached images, audio, PDFs, Python files, and Excel workbooks. It returns only the requested final answer, a format suited to the final benchmark's exact-match evaluation. The one-call design fits low daily API quotas.
If the course's /files/{task_id} route returns 404, attachment downloads fall back to an immutable revision of the public bstraehle/gaia Space containing the same five GAIA evaluation files.
Run externally
pip install -r requirements.txt
export HF_TOKEN="your_hugging_face_token"
python agent.py "Research the main ideas behind the ReAct agent pattern."Optional configuration:
export HF_MODEL_ID="Qwen/Qwen2.5-Coder-32B-Instruct"
python agent.py "Your task here"By default, Hugging Face selects a compatible Inference Provider automatically. Set HF_PROVIDER only if you deliberately want a specific provider.
Evaluate and submit
To generate answers for the 20 course questions without changing the leaderboard:
python agent.py --evaluate --output answers.jsonWith the Gemini free-tier limit of 5 requests/minute, this run intentionally pauses for 15 seconds between questions. It needs 20 Gemini requests in total and takes about five minutes.
Review answers.json, then submit explicitly:
python agent.py --evaluate --submit --username NatsumixThe --submit switch is deliberately required, so fetching questions and testing the agent never submits a score by accident.
HF_TOKEN is read only from the execution environment. Do not commit tokens, notebooks with tokens, or .env files to this public repository.
Gemini (recommended)
If a Gemini API key is present, the agent automatically uses Gemini instead of Hugging Face Inference Providers:
export GEMINI_API_KEY="your_gemini_api_key"
export GEMINI_MODEL="gemini-3.1-flash-lite" # optional; this is the default
python agent.py "Your task here"The key exists only in the execution environment and is never stored in this public Space.
Files
index.html— static project page served by this Space.agent.py— command-line agent for Colab or local execution.requirements.txt— external runtime dependencies.
License
MIT
