File size: 2,163 Bytes
01a29cd
fe64e44
 
 
 
 
f3b2369
fe64e44
 
01a29cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fe8bf03
0128def
f3b2369
4a671bb
 
 
fe8bf03
 
 
f3b2369
 
 
 
 
 
 
 
 
 
 
 
 
 
4a671bb
fe8bf03
4a671bb
f3b2369
 
 
 
 
 
 
 
 
 
 
 
 
 
4a671bb
fe8bf03
4a671bb
fe8bf03
f3b2369
 
 
 
 
 
 
 
 
 
4a671bb
fe8bf03
4a671bb
f3b2369
 
fe8bf03
f3b2369
fe8bf03
f3b2369
4a671bb
fe8bf03
4a671bb
fe8bf03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
title: First Agent with smolagents
emoji: 🤖
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
license: apache-2.0
tags:
  - agents
  - smolagents
  - web-search
  - weather
  - huggingface-course
datasets:
  - none
language:
  - en
library_name: smolagents
pipeline_tag: conversational
---

# My First Agent with smolagents

This project is part of the [Hugging Face Agents Course](https://huggingface.co/learn/agents). It demonstrates how to create a simple but powerful agent using the smolagents library version 1.9.2.

## Features

This agent can:
- Search the web using DuckDuckGo
- Get weather information for locations (using OpenWeatherMap API)
- Provide natural conversational responses

## Requirements

- Python 3.10 or higher
- smolagents==1.9.2
- gradio==4.44.1
- Other dependencies listed in requirements.txt

## Environment Variables

The following environment variables need to be set:
- `HUGGINGFACE_TOKEN`: Your Hugging Face API token
- `OPENWEATHERMAP_API_KEY`: Your OpenWeatherMap API key

## How to Use

1. Clone the repository
2. Install the dependencies:
   ```bash
   pip install -r requirements.txt
   ```
3. Set up your environment variables:
   ```bash
   export HUGGINGFACE_TOKEN=your_token_here
   export OPENWEATHERMAP_API_KEY=your_key_here
   ```
4. Run the application:
   ```bash
   python app.py
   ```

## Example Queries

- "What's the weather like in Tokyo?"
- "Tell me the temperature in New York"
- "Search for the latest news about AI"

## Weather Tool Limitations

The weather tool has some limitations:
- Cannot disambiguate between cities with the same name
- Only accepts letters, digits, spaces, and hyphens in city names
- Does not support additional location information (state, country, etc.)
- Returns temperatures in Fahrenheit and wind speeds in mph

## Technical Details

This agent uses:
- smolagents 1.9.2 for the agent framework
- Qwen/Qwen2.5-Coder-32B-Instruct as the language model
- Gradio 4.44.1 for the user interface
- OpenWeatherMap API for weather data
- DuckDuckGo for web searches

## Credits

Created as part of the Hugging Face Agents Course.