--- 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 --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference # 🤖 First Agent Project with smolagents An intelligent, code-backed AI agent capable of dynamic tool execution, reasoning, and multi-modal tasks (like text-to-image generation and timezone calculations). Built using the `smolagents` framework, powered by `Qwen2.5-Coder-32B-Instruct`, and deployed seamlessly on Hugging Face Spaces with a user-friendly Gradio interface. ## 🚀 What This Project Is About This project demonstrates the implementation of a full **CodeAgent** using the `smolagents` library. Unlike traditional rigid chatbots, this agent operates on a **Thought-Action-Observation** cycle. When given a complex prompt, it writes execution blocks in Python, leverages specialized tools, evaluates the live feedback, and formulates an accurate final response. ### Core Features * **Dynamic Code Execution:** Solves problems by interpreting and running Python blocks on the fly. * **Custom Tool Integration:** Extensible structure to add your own Python functions as agent tools. * **Text-to-Image Generation:** Connects directly to Hugging Face Hub inference models to visualize user prompts. * **Gradio Web UI:** A clean, shareable interface for interactive chatting and multi-modal outputs. ## 🛠️ Tech Stack * **Framework:** [smolagents](https://github.com/huggingface/smolagents) (Hugging Face) * **LLM Engine:** `Qwen/Qwen2.5-Coder-32B-Instruct` (via Hugging Face Serverless Inference API) * **UI Framework:** [Gradio](https://gradio.app/) * **Language:** Python 3.10+ * **Libraries:** `pytz`, `pyyaml`, `requests` ## 📁 Project Structure ```text ├── app.py # Main entry point: initializes the model, tools, and Gradio UI ├── prompts.yaml # System prompts and instruction templates for the agent ├── requirements.txt # Python dependencies ├── Gradio_UI.py # Helper script setting up the Gradio layout └── tools/ └── final_answer.py # Core tool defining how the agent concludes its reasoning