title: Modular GAIA Level-1 Agent Source
colorFrom: indigo
colorTo: blue
sdk: static
app_file: index.html
pinned: false
This free static Space publishes the complete inspectable agent source. Run
python app.pylocally for the Gradio evaluation UI; no paid hosted hardware is required.
Modular GAIA Level-1 Agent
Production-oriented Hugging Face Agents Course final assignment. It preserves the official OAuth username and submission payload while separating checkpointed dry-run evaluation, review/reruns, and explicit submission.
Space configuration
Set HF_TOKEN as a Space secret. No credentials are stored in source code.
Supported variables:
MODEL_IDorGAIA_MODEL_IDHF_PROVIDERorHF_INFERENCE_PROVIDERFALLBACK_MODEL_ID(defaults toopenai/gpt-oss-20b) andHF_FALLBACK_PROVIDERGAIA_VISION_MODEL_IDandGAIA_ASR_MODEL_IDGAIA_API_URL,GAIA_CACHE_DIR,GAIA_RESULTS_PATH,GAIA_USE_CACHEGAIA_RETRIES,GAIA_BACKOFF_SECONDS,GAIA_REQUEST_TIMEOUT,GAIA_MAX_STEPSGAIA_WORKERS,GAIA_MODEL_REQUESTS_PER_MINUTE,GAIA_SEARCH_REQUESTS_PER_MINUTESTOCKFISH_PATHwhen Stockfish is not onPATHGAIA_AGENT_CODE_URLfor local submission with a public GitHub/Hugging Face code URLGAIA_ALLOW_INLINE_AGENT_CODE=1to explicitly send a local source bundle insteadGAIA_LOCAL_MODEL_IDfor an optional OpenAI-compatible local/Ollama fallbackGAIA_LOCAL_MODEL_URL(defaults tohttp://127.0.0.1:11434/v1)GAIA_PREFER_LOCAL_MODEL=1to avoid hosted inference calls for text tasks
packages.txt installs Stockfish in the Space. Chess evaluation fails closed if an
engine is unavailable. Keep the Space public so its submitted agent_code is visible.
Local validation and dry-run
python -m pip install -r requirements-dev.txt
python -m pytest -q
python run_local_eval.py
python run_local_eval.py --force --task-id TASK_ID
Run and submit locally without paid Space hardware
The scoring API is public, so evaluation and explicit submission can run locally. Authenticate and expose the CLI token to the process (PowerShell example):
hf auth login
$env:HF_TOKEN = hf auth token --quiet
$env:GAIA_AGENT_CODE_URL = "https://github.com/YOUR_NAME/YOUR_PUBLIC_REPO"
python app.py
GAIA_AGENT_CODE_URL is recommended: it satisfies the course's inspectable-code intent
without running a hosted Space. If no public repository is available, the current API
schema also accepts Python source in agent_code; opt into that behavior explicitly:
$env:GAIA_ALLOW_INLINE_AGENT_CODE = "1"
python app.py
Inline mode bundles only the declared implementation .py files. It never reads .env,
cached attachments, results, or credentials. In either mode, the app still requires a
successful 20-question dry run and a separate click on the submission button.
The dry-run CLI cannot submit. The only /submit POST is encapsulated by
GaiaClient.submit_answers() and reached from Submit Reviewed Complete Run.
Submission requires exactly 20 unique, successful, non-empty answers.
Architecture
GaiaClientexposesget_questions,get_random_question,download_task_file, andsubmit_answers, with typed errors and attachment metadata.TaskRouterselects deterministic file/media/logic/text specialists before inference.- A managed
ToolCallingAgentperforms web, Wikipedia, HTML, and PDF research under a planningCodeAgent; only candidate answers leave the evidence record. - YouTube supports captions and scene/interval frame sampling. Audio uses Whisper ASR.
- Excel arithmetic, Python stdout, Markdown algebra, text transforms, and Stockfish move selection are deterministic.
results/results.jsonis keyed by task ID and records status, task type, duration, evidence, confidence, and errors after every task. Independent tasks run concurrently; shared model calls are rate-limited and serialized safely.