uru commited on
Commit
6b02296
·
1 Parent(s): a4fcb76

fix-readme

Browse files
Files changed (1) hide show
  1. README.md +127 -6
README.md CHANGED
@@ -1,4 +1,5 @@
1
  ---
 
2
  title: First Agent Template
3
  emoji: ⚡
4
  colorFrom: pink
@@ -8,11 +9,131 @@ sdk_version: 6.5.1
8
  app_file: app.py
9
  pinned: false
10
  tags:
11
- - smolagents
12
- - agent
13
- - smolagent
14
- - tool
15
- - agent-course
 
 
16
  ---
17
 
18
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+
3
  title: First Agent Template
4
  emoji: ⚡
5
  colorFrom: pink
 
9
  app_file: app.py
10
  pinned: false
11
  tags:
12
+
13
+ * smolagents
14
+ * agent
15
+ * smolagent
16
+ * tool
17
+ * agent-course
18
+
19
  ---
20
 
21
+ # First Agent (smolagents)
22
+
23
+ A modular educational AI agent built with **smolagents** and **Gradio**, following the Hugging Face Agents Course.
24
+
25
+ The agent can:
26
+
27
+ * Generate images
28
+ * Perform web search
29
+ * Visit web pages
30
+ * Get current time by timezone
31
+ * Check disk usage
32
+
33
+ Runs locally and on **Hugging Face Spaces**.
34
+
35
+ ---
36
+
37
+ ## Project Structure
38
+
39
+ ```
40
+ .
41
+ ├── app.py
42
+ ├── prompts.yaml
43
+ ├── src/first_agent/
44
+ │ ├── ui.py
45
+ │ ├── agent_factory.py
46
+ │ └── settings.py
47
+ ├── tools/
48
+ │ ├── final_answer.py
49
+ │ ├── web_search.py
50
+ │ ├── visit_webpage.py
51
+ │ └── disk_free.py
52
+ ```
53
+
54
+ * `app.py` – entry point
55
+ * `agent_factory.py` – builds model + agent + tools
56
+ * `ui.py` – Gradio interface
57
+ * `tools/` – custom tools
58
+ * `prompts.yaml` – agent prompt templates
59
+
60
+ ---
61
+
62
+ ## Model
63
+
64
+ ```
65
+ Qwen/Qwen2.5-Coder-32B-Instruct
66
+ ```
67
+
68
+ Accessed via Hugging Face serverless inference (`HfApiModel`).
69
+
70
+ ---
71
+
72
+ ## Local Setup
73
+
74
+ ### 1. Create virtual environment
75
+
76
+ ```bash
77
+ python -m venv .venv
78
+ source .venv/bin/activate
79
+ ```
80
+
81
+ ### 2. Install dependencies
82
+
83
+ ```bash
84
+ pip install -r requirements.txt
85
+ ```
86
+
87
+ ### 3. Set HF token
88
+
89
+ Create `.env`:
90
+
91
+ ```
92
+ HF_TOKEN=hf_xxxxxxxxxxxxxxxxx
93
+ ```
94
+
95
+ Get token from:
96
+ https://huggingface.co/settings/tokens
97
+ Scope: **Read**
98
+
99
+ ### 4. Run
100
+
101
+ ```bash
102
+ python app.py
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Hugging Face Spaces
108
+
109
+ Add your token in:
110
+
111
+ **Settings → Secrets → HF_TOKEN**
112
+
113
+ No need for `share=True` on Spaces.
114
+
115
+ ---
116
+
117
+ ## Runtime Behavior
118
+
119
+ * `outputs/` directory is created at startup
120
+ * Old files are cleaned
121
+ * Directory is ignored via `.gitignore`
122
+ * Works both locally and inside HF container
123
+
124
+ ---
125
+
126
+ ## Status
127
+
128
+ Educational project with modular architecture and clean separation of:
129
+
130
+ * UI
131
+ * Agent
132
+ * Tools
133
+ * Configuration
134
+
135
+ ---
136
+
137
+ ## License
138
+
139
+ MIT (or specify if different).