File size: 1,429 Bytes
2705160
 
62ad9da
 
 
2705160
 
 
 
d123508
 
 
2705160
 
ca1474d
 
 
a877f54
 
 
ca1474d
 
 
a877f54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca1474d
a877f54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca1474d
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
---
title: Template Final Assignment
emoji: πŸ•΅πŸ»β€β™‚οΈ
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
# optional, default duration is 8 hours/480 minutes. Max duration is 30 days/43200 minutes.
hf_oauth_expiration_minutes: 480
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference


## Setup

1. Install dependencies:

```bash
uv pip install -r requirements.txt
```

2. Copy `.env.example` to `.env` and fill in your API keys:

```bash
cp .env.example .env
```

```
GOOGLE_API_KEY=your-google-api-key-here
TAVILY_API_KEY=your-tavily-api-key-here
```

## Usage

### Run Gradio app locally

```bash
uv run app.py
```

### Run the agent directly

```bash
uv run python -m agent.agent
```

### Test the search tool only

```bash
uv run python -m agent.tools.search
```

### Use in code

```python
from agent import run

answer = run("What is LangGraph?")
print(answer)
```

## Project Structure

```
agent/
β”œβ”€β”€ __init__.py          # Exports run()
β”œβ”€β”€ agent.py             # websearch_agent + run entrypoint
└── tools/
    β”œβ”€β”€ __init__.py      # Exports web_search
    └── search.py        # Tavily search tool (max_results=10)
app.py                   # Gradio UI for HuggingFace Spaces
.env.example             # API keys template
requirements.txt         # Python dependencies
```