agent_builder / README.md
burtenshaw
first commit
fb09fd5
|
raw
history blame
2.51 kB

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

  1. Make sure you have Python 3.11 or higher installed
  2. Install the required dependencies:
pip install -r requirements.txt

Usage

  1. Run the application:
python app.py
  1. Open your browser and navigate to the URL displayed in the terminal (usually http://127.0.0.1:7860)

  2. 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"
  3. 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 generation
  • stabilityai/stable-diffusion-xl-base-1.0: High-quality image generation

Text Analysis Spaces

  • sentence-transformers/text-similarity: Compare text similarity
  • facebook/bart-large-mnli: Text classification

Other Useful Spaces

  • spaces/jxnl/instructor-xl: Generate structured data
  • spaces/fffiloni/text-to-speech: Convert text to speech

Troubleshooting

If you encounter issues with the Space tool not being recognized, make sure:

  1. You've entered the correct Space ID
  2. The Space has a Gradio interface
  3. 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