metadata
title: Agent with smolagents + DeepSeek
emoji: π§
colorFrom: indigo
colorTo: blue
sdk: gradio
app_file: main.py
pinned: false
Hugging Face Agent Project
This project implements a Hugging Face agent using the smolagents framework. The agent is designed to handle various tasks by utilizing custom tools and models.
Project Structure
huggingface-agent-project
βββ main.py # Entry point for the agent
βββ agent_config.py # Configuration and model loading
βββ tools # Directory for custom tools
β βββ __init__.py # Package initializer for tools
β βββ wiki_tool.py # Tool for fetching Wikipedia summaries
β βββ web_search_tool.py # Tool for performing web searches using DuckDuckGo
β βββ excel_analysis_tool.py # Tool for analyzing Excel files
βββ requirements.txt # Project dependencies
βββ README.md # Project documentation
Setup Instructions
Clone the repository:
git clone <repository-url> cd huggingface-agent-projectInstall the required dependencies:
pip install -r requirements.txt
Usage
To run the agent, execute the following command:
python main.py
Agent Capabilities
The agent is capable of performing various tasks by leveraging the following tools:
Tools
- WikiTool: Fetches summaries of topics from Wikipedia, handling disambiguation and page errors gracefully.
- WebSearchTool: Performs web searches using DuckDuckGo and retrieves the first result's snippet.
- ExcelAnalysisTool: Loads an Excel file and sums sales from items labeled as "food", excluding drinks. Returns the total sales in USD with 2 decimal places.
Models
- The agent uses the Hugging Face Inference API via
HfApiModelto interact with models such asDeepSeek-R1orDeepSeek-Coder.
Example Workflow
- The agent receives a request.
- Based on the request, it selects the appropriate tool (e.g., WikiTool for Wikipedia lookups).
- The tool processes the request and returns the result.
Contributing
Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.
Future Enhancements
- Deployment to Hugging Face Spaces.
- Adding more tools for advanced functionalities.
- Improving error handling and logging.