Spaces:
Build error
Build error
A newer version of the Gradio SDK is available:
6.6.0
metadata
title: WebAgentTools
emoji: π οΈ
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false
WebAgentTools
A web-based agent tools interface for interacting with various AI tools and services.
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
LangGraph Agent with Tools
This project demonstrates a conversational AI agent built with LangGraph, featuring three integrated tools and a responsive web UI.
Features
- π€ LangGraph-powered conversational agent
- π§ Three integrated tools:
- Web search (simulated)
- Mathematical calculator
- Image prompt generator
- π¬ Real-time chat interface with WebSocket communication
- π¨ Clean, responsive UI
- π Ready to deploy on Hugging Face Spaces
How to Run Locally
- Clone this repository
- Install the dependencies:
pip install -r requirements.txt - Create a
.envfile in the root directory with your OpenAI API key:OPENAI_API_KEY=your_api_key_here - Run the application:
python app.py - Open your browser and navigate to
http://localhost:8000
Project Structure
.
βββ app.py # Main application file with FastAPI and LangGraph
βββ index.html # HTML frontend
βββ static/ # Static assets
β βββ styles.css # CSS styling
β βββ script.js # JavaScript for WebSocket and UI
βββ requirements.txt # Python dependencies
βββ README.md # Documentation
Deploying to Hugging Face Spaces
- Create a new Space on Hugging Face with the Spaces SDK
- Choose the "Dockerfile" option for maximum flexibility
- Push this code to your GitHub repository
- Connect your Hugging Face Space to the GitHub repository
- Add your OpenAI API key as a secret in the Space settings
- Deploy!
How to Use
- Type a message in the input field and press Enter or click Send
- Ask questions that might require:
- Searching for information
- Calculating mathematical expressions
- Generating prompts for image creation
- The agent will automatically select the appropriate tool based on your request
Customization
- Add more tools by creating new tool functions in
app.py - Customize the UI by modifying
index.htmlandstyles.css - Adjust the agent's behavior by editing the system prompt in
app.py
License
MIT