Spaces:
Running
AI Agent Builder with SmolaGents
This application allows you to build AI agents using the SmolaGents library from Hugging Face. You can select tools from Hugging Face Hub collections and Spaces, and interact with your agent through a chat interface.
Features
- Add tools from Hugging Face Hub collections
- Add tools from Hugging Face Spaces
- Chat with your agent in an interactive interface
- Customize the model used for your agent
- Regenerate responses if needed
Installation
- Make sure you have Python 3.11 or higher installed
- Install the required dependencies:
pip install -r requirements.txt
Usage
- Run the application:
python app.py
Open your browser and navigate to the URL displayed in the terminal (usually http://127.0.0.1:7860)
Configure your agent:
- Select a model (default is Qwen/Qwen2.5-Coder-32B-Instruct)
- Add at least one tool from Hugging Face Hub collections or Spaces
- Click "Create Agent"
Chat with your agent in the chat interface
- Type your message and press Enter
- Use the "Regenerate Response" button if you want a different answer
- Use "Clear Chat" to start a new conversation
Adding Tools
Hugging Face Hub Collections
Enter the collection slug for a tool collection from Hugging Face Hub.
Example: huggingface-tools/diffusion-tools-6630bb19a942c2306a2cdb6f
Hugging Face Spaces
Enter the space ID for a Gradio app on Hugging Face Spaces.
Example: black-forest-labs/FLUX.1-schnell
This allows you to use any Gradio app on Hugging Face Spaces as a tool for your agent.
Example Spaces to Try
Image Generation Spaces
black-forest-labs/FLUX.1-schnell
: Text-to-image generationstabilityai/stable-diffusion-xl-base-1.0
: High-quality image generation
Text Analysis Spaces
sentence-transformers/text-similarity
: Compare text similarityfacebook/bart-large-mnli
: Text classification
Other Useful Spaces
spaces/jxnl/instructor-xl
: Generate structured dataspaces/fffiloni/text-to-speech
: Convert text to speech
Troubleshooting
If you encounter issues with the Space tool not being recognized, make sure:
- You've entered the correct Space ID
- The Space has a Gradio interface
- The Space is publicly accessible
Requirements
- gradio>=5.15.0
- smolagents>=1.10.0
- huggingface_hub
Note
For some tools and models, you may need to set up API keys as environment variables. For example:
HF_TOKEN
for Hugging Face Hub access