A robust CLI-based AI agent solution for the HuggingFace Agents Course Unit 4 final assignment. This agent successfully handles diverse tasks including web searches, image analysis, audio transcription, code execution, and data processing.
- Multi-modal Capabilities: Handles text, images, audio, code, and spreadsheet files
- CLI Interface: Clean command-line interface for easy execution
- Answer Caching: Saves progress after each question - resume anytime
- Timeout Protection: 5-minute timeout per question to prevent hanging
- Smart Question Detection: Automatically detects and enhances different question types
- Error Handling: Robust error handling with detailed logging
- Model: GPT-4o (OpenAI)
- Framework: smolagents
- Tools:
- DuckDuckGoSearchTool (web search)
- VisitWebpageTool (web page access)
- PythonInterpreterTool (code execution)
- SpeechToTextTool (audio transcription)
- Python 3.8+
- OpenAI API key
- Hugging Face account (for authentication)
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/gaia-qa-agent.git
cd gaia-qa-agent- Install dependencies:
pip install -r requirements.txt- Set up your OpenAI API key:
# Create a .env file
echo "OPENAI_API_KEY=your-api-key-here" > .env- Login to Hugging Face:
huggingface-cli loginProcess all questions and save answers to cache:
python app.py --processSubmit previously cached answers:
python app.py --submitProcess questions and submit immediately:
python app.py --process-and-submitThe agent uses intelligent question type detection to enhance prompts:
- Reversed Text: Automatically detects and reverses text
- YouTube Videos: Uses web search and page access tools
- Images/Chess: Provides PIL/Pillow instructions for image analysis
- Audio Files: Uses SpeechToTextTool for transcription
- Python Code: Reads and executes code files
- Excel/CSV: Uses pandas for data analysis
- Mathematical Problems: Uses Python for step-by-step computation
- Research Questions: Uses web search with iterative refinement
.
├── app.py # Main CLI application
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── .env # Environment variables (not in repo)
└── agent_answers_cache.json # Cached answers (not in repo)
.envfile is gitignored - never commit API keys- Cache files are excluded from version control
- All sensitive data is kept local
- Answers are cached after each question for resilience
- The agent has a 5-minute timeout per question
- Progress is displayed in real-time during processing
- You can stop and resume processing anytime
This project was developed for the HuggingFace Agents Course - Unit 4 Final Assignment.
This project is for educational purposes as part of the HuggingFace Agents Course.
- HuggingFace for the excellent Agents Course
- smolagents framework
- OpenAI for GPT-4o