Spaces:
Sleeping
Sleeping
File size: 2,098 Bytes
2705160 281882c 62ad9da 2705160 d123508 2705160 281882c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ---
title: GAIA Agent Final Assignment
emoji: 🕵🏻♂️
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
---
# GAIA agent (Hugging Face Agents Course, Unit 4)
A `smolagents` CodeAgent that answers the 20 GAIA level-1 questions from the course
scoring API. Target: 30% or more.
## Files
| File | What it does |
|---|---|
| `app.py` | Gradio UI: log in, run the agent (answers cached), submit separately |
| `agent.py` | Model selection, agent instructions, answer clean-up for exact match |
| `tools.py` | Web search, webpage reader, Wikipedia (tables kept), YouTube transcript, file reader, Whisper transcription, Python script runner |
| `gaia_api.py` | Scoring API client and the `answers_cache.json` cache |
| `run_local.py` | Test single questions on a laptop or Colab without submitting |
## Set up the Space
1. Create a new Gradio Space (or duplicate the course template) and upload these files.
Keep the Space **public**: the submission includes a link to its code.
2. In **Settings → Variables and secrets** add:
- `MODEL_ID` (variable), for example:
- `gemini/gemini-2.5-flash` plus secret `GEMINI_API_KEY`
- `openai/gpt-4.1-mini` plus secret `OPENAI_API_KEY`
- `openrouter/<model>` plus secret `OPENROUTER_API_KEY`
- a Hugging Face model id plus secret `HF_TOKEN` (optional variable `HF_PROVIDER`)
- `TAVILY_API_KEY` (optional secret): more reliable search than DuckDuckGo, which
often rate-limits shared Space IPs.
- `MAX_STEPS` (optional, default 12), `WHISPER_MODEL` (optional, default `base`).
3. Open the app, log in, press **Run agent**, check the table, press **Submit cached answers**.
For questions with an image attached, the model must accept images
(Gemini and GPT-4.1 models do). Otherwise the agent retries without the image.
## Test locally first
```bash
pip install -r requirements.txt
export MODEL_ID=gemini/gemini-2.5-flash GEMINI_API_KEY=...
python run_local.py --list
python run_local.py --task <task-id-prefix>
```
|