Spaces:
Sleeping
Sleeping
|
Download README.md from michelpadron/First_agent_template: direct link, hf CLI and curl.
- Browser
- Download file 3.65 kB
-
https://huggingface.co/spaces/michelpadron/First_agent_template/resolve/main/README.md
- Command line
-
hf download hf://spaces/michelpadron/First_agent_template/README.md
-
curl -L -o README.md https://huggingface.co/spaces/michelpadron/First_agent_template/resolve/main/README.md
3.65 kB
A newer version of the Gradio SDK is available: 6.32.0
metadata
title: First Agent Template
emoji: ⚡
colorFrom: pink
colorTo: yellow
sdk: gradio
sdk_version: 5.23.1
app_file: app.py
pinned: false
tags:
- smolagents
- agent
- smolagent
- tool
- agent-course
First Agent Template
A customizable AI agent template built with smolagents framework, featuring web search capabilities, custom tools, and a Gradio-based user interface.
🚀 Quick Start
Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
Setup Instructions
Clone the repository (if not already done):
git clone <repository-url> cd First_agent_templateCreate and activate virtual environment:
# Create virtual environment python3 -m venv venv # Activate virtual environment # On macOS/Linux: source venv/bin/activate # On Windows: # venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtRun the application:
python app.py
🛠️ Project Structure
First_agent_template/
├── app.py # Main application entry point
├── Gradio_UI.py # Gradio user interface
├── prompts.yaml # Agent prompt templates
├── requirements.txt # Python dependencies
├── tools/ # Custom agent tools
│ ├── final_answer.py
│ ├── visit_webpage.py
│ └── web_search.py
└── README.md
🔧 Features
- AI Agent: Powered by Qwen2.5-Coder-32B-Instruct model
- Web Search: DuckDuckGo search integration
- Custom Tools: Extensible tool system for agent capabilities
- Gradio UI: User-friendly web interface
- Timezone Support: Get current time in any timezone
- Image Generation: Text-to-image capabilities
🎯 Business Logic
This agent template provides a foundation for building AI-powered applications with the following core capabilities:
- Code Generation: The agent can generate and execute code based on user requests
- Web Research: Search the internet for real-time information
- Tool Integration: Extensible system for adding custom functionality
- User Interface: Web-based interface for easy interaction
📝 Development
Adding New Tools
To add a new tool to the agent:
- Create a new Python file in the
tools/directory - Define your tool function with proper type hints
- Add the tool to the agent's tools list in
app.py
Example tool structure:
@tool
def my_custom_tool(arg1: str, arg2: int) -> str:
"""Tool description
Args:
arg1: Description of first argument
arg2: Description of second argument
"""
# Tool implementation
return "Tool result"
Configuration
- Model Settings: Configure the AI model in
app.py - Prompts: Customize agent behavior in
prompts.yaml - Dependencies: Manage packages in
requirements.txt
🔍 Troubleshooting
- Model Overload: If the default model is overloaded, try alternative models or endpoints
- Dependencies: Ensure all requirements are installed in the virtual environment
- Activation: Always activate the virtual environment before running the application
📚 Documentation
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Note: This template is designed for educational purposes and can be extended for various AI agent applications.