aw_agents 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Thor Whalen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,625 @@
1
+ Metadata-Version: 2.4
2
+ Name: aw-agents
3
+ Version: 0.1.0
4
+ Summary: AI agents for agentic workflows, deployable to multiple chatbot platforms
5
+ Home-page: https://github.com/thorwhalen/aw_agents
6
+ Author: Thor Whalen
7
+ Author-email: Your Name <your.email@example.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/yourusername/aw-agents
10
+ Project-URL: Documentation, https://github.com/yourusername/aw-agents#readme
11
+ Project-URL: Repository, https://github.com/yourusername/aw-agents
12
+ Project-URL: Issues, https://github.com/yourusername/aw-agents/issues
13
+ Keywords: ai,agents,chatbots,mcp,openapi,claude,chatgpt
14
+ Platform: any
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: requests>=2.31.0
27
+ Requires-Dist: beautifulsoup4>=4.12.0
28
+ Requires-Dist: graze>=0.1.0
29
+ Provides-Extra: mcp
30
+ Requires-Dist: mcp>=0.1.0; extra == "mcp"
31
+ Provides-Extra: api
32
+ Requires-Dist: fastapi>=0.109.0; extra == "api"
33
+ Requires-Dist: uvicorn[standard]>=0.27.0; extra == "api"
34
+ Requires-Dist: pydantic>=2.5.0; extra == "api"
35
+ Provides-Extra: all
36
+ Requires-Dist: aw-agents[api,mcp]; extra == "all"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
39
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
40
+ Requires-Dist: black>=23.0.0; extra == "dev"
41
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
42
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
43
+ Dynamic: license-file
44
+
45
+ # aw-agents
46
+
47
+ **AI Agents for Agentic Workflows** - Easily deploy AI agents to multiple chatbot platforms (Claude, ChatGPT, and more).
48
+
49
+ ## Overview
50
+
51
+ `aw-agents` provides a unified framework for building AI agents and deploying them to different chatbot platforms with minimal boilerplate. Write your agent once, deploy everywhere.
52
+
53
+ ### Key Features
54
+
55
+ - 🎯 **Write Once, Deploy Everywhere**: Single agent implementation works with Claude, ChatGPT, and future platforms
56
+ - 🔌 **Pluggable Adapters**: MCP for Claude, OpenAPI for ChatGPT
57
+ - 📦 **Batteries Included**: Built-in download agent with smart features
58
+ - 🛠️ **Easy to Extend**: Simple base class for creating new agents
59
+ - 🎨 **Clean Architecture**: Separation of agent logic and platform adapters
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ # From source (recommended for development)
65
+ git clone https://github.com/thorwhalen/aw_agents.git
66
+ cd aw_agents
67
+ pip install -e .
68
+
69
+ # With Claude Desktop support (MCP)
70
+ pip install -e .[mcp]
71
+
72
+ # With ChatGPT Custom GPT support (FastAPI)
73
+ pip install -e .[api]
74
+
75
+ # With all features
76
+ pip install -e .[all]
77
+
78
+ # For development
79
+ pip install -e .[dev]
80
+ ```
81
+
82
+ ### Verify Installation
83
+
84
+ ```bash
85
+ # Test the installation
86
+ python -c "from aw_agents.download import DownloadAgent; agent = DownloadAgent(); print('✓ Installation successful!')"
87
+ ```
88
+
89
+ ## Quick Start
90
+
91
+ ### Using the Download Agent
92
+
93
+ The package includes a smart download agent out of the box:
94
+
95
+ ```python
96
+ from aw_agents.download import DownloadAgent
97
+
98
+ agent = DownloadAgent()
99
+
100
+ # Get available tools
101
+ tools = agent.get_tools()
102
+ print([t['name'] for t in tools])
103
+ # ['download_content', 'download_multiple', 'list_downloads']
104
+
105
+ # Execute a tool
106
+ result = agent.execute_tool('download_content', {
107
+ 'url': 'https://arxiv.org/pdf/2103.00020.pdf',
108
+ 'context': 'Important ML Paper'
109
+ })
110
+
111
+ print(result['data']['path']) # ~/Downloads/Important_ML_Paper.pdf
112
+ ```
113
+
114
+ ### Deploy to Claude Desktop (MCP)
115
+
116
+ **Step 1: Create MCP Server Script**
117
+
118
+ ```python
119
+ from aw_agents.download import DownloadAgent
120
+ from aw_agents.adapters import MCPAdapter
121
+
122
+ agent = DownloadAgent()
123
+ adapter = MCPAdapter(agent, "download-agent")
124
+
125
+ # This starts an MCP server for Claude Desktop
126
+ if __name__ == "__main__":
127
+ adapter.run_sync()
128
+ ```
129
+
130
+ Save this as `mcp_download.py` or use the deployment script:
131
+
132
+ ```bash
133
+ python scripts/deploy_mcp.py DownloadAgent --output mcp_download.py
134
+ ```
135
+
136
+ **Step 2: Configure Claude Desktop**
137
+
138
+ Edit your Claude Desktop config file:
139
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
140
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
141
+ - **Linux**: `~/.config/Claude/claude_desktop_config.json`
142
+
143
+ Add this configuration:
144
+ ```json
145
+ {
146
+ "mcpServers": {
147
+ "download": {
148
+ "command": "python",
149
+ "args": ["/absolute/path/to/mcp_download.py"]
150
+ }
151
+ }
152
+ }
153
+ ```
154
+
155
+ **Important**: Use the absolute path to your script, not `~/` or relative paths.
156
+
157
+ **Step 3: Restart Claude Desktop**
158
+
159
+ Completely quit and restart Claude Desktop.
160
+
161
+ **Step 4: Test It**
162
+
163
+ Ask Claude:
164
+ ```
165
+ Download this paper for me: https://arxiv.org/pdf/2103.00020.pdf
166
+ Context: "Attention is All You Need"
167
+ ```
168
+
169
+ **Troubleshooting**:
170
+ - Check logs: `~/Library/Logs/Claude/` (macOS)
171
+ - Verify Python path in config
172
+ - Ensure dependencies are installed in the correct Python environment
173
+
174
+ ### Deploy to ChatGPT Custom GPT (FastAPI)
175
+
176
+ **Step 1: Create and Start API Server**
177
+
178
+ ```python
179
+ from aw_agents.download import DownloadAgent
180
+ from aw_agents.adapters import OpenAPIAdapter
181
+
182
+ agent = DownloadAgent()
183
+ adapter = OpenAPIAdapter(agent, title="Download Agent API")
184
+
185
+ # This starts a FastAPI server
186
+ if __name__ == "__main__":
187
+ adapter.run(port=8000)
188
+ ```
189
+
190
+ Save this as `api_download.py` or use the deployment script:
191
+
192
+ ```bash
193
+ python scripts/deploy_api.py DownloadAgent --output api_download.py
194
+ python api_download.py # Start the server
195
+ ```
196
+
197
+ The server will be available at http://localhost:8000
198
+
199
+ **Step 2: Create Custom GPT**
200
+
201
+ 1. Go to https://chat.openai.com/gpts/editor
202
+ 2. Click "Create a GPT"
203
+ 3. Name it (e.g., "Download Assistant")
204
+ 4. Add instructions:
205
+ ```
206
+ You help users download files from URLs. Use the download_content
207
+ action when users provide URLs. Always ask for context to generate
208
+ good filenames. You can download multiple files at once and list
209
+ previously downloaded files.
210
+ ```
211
+
212
+ **Step 3: Add Actions**
213
+
214
+ 1. In the GPT editor, go to "Configure" → "Actions"
215
+ 2. Click "Create new action"
216
+ 3. Import schema from: `http://localhost:8000/openapi.json`
217
+ 4. Click "Add Action"
218
+
219
+ **Step 4: Test Your GPT**
220
+
221
+ Ask your Custom GPT:
222
+ ```
223
+ Download this dataset: https://github.com/user/repo/blob/main/data.csv
224
+ Context: "Sales Data Q4"
225
+ ```
226
+
227
+ **Important Notes**:
228
+ - **Local Testing**: ChatGPT servers can't access `localhost` from OpenAI's infrastructure
229
+ - **For Remote Access**:
230
+ - Use ngrok: `ngrok http 8000` (provides a public URL)
231
+ - Deploy to cloud service (AWS, GCP, Azure, Heroku)
232
+ - Use local network IP if on the same network
233
+
234
+ **Production Deployment**:
235
+ 1. Deploy to cloud service with HTTPS
236
+ 2. Add authentication (API keys, OAuth)
237
+ 3. Update Custom GPT actions with public URL
238
+
239
+ ## Architecture
240
+
241
+ ```
242
+ aw_agents/
243
+ ├── base.py # AgentBase, ToolExecutionResult
244
+ ├── adapters/
245
+ │ ├── mcp.py # MCPAdapter for Claude
246
+ │ └── openapi.py # OpenAPIAdapter for ChatGPT
247
+ └── download/ # Download agent implementation
248
+ ├── agent.py # DownloadAgent (AgentBase subclass)
249
+ └── download_core.py # Core download logic
250
+ ```
251
+
252
+ ### Creating Your Own Agent
253
+
254
+ ```python
255
+ from aw_agents.base import AgentBase, ToolExecutionResult, create_json_schema
256
+
257
+ class MyAgent(AgentBase):
258
+ """My custom agent."""
259
+
260
+ def get_tools(self):
261
+ return [
262
+ {
263
+ 'name': 'my_tool',
264
+ 'description': 'Does something useful',
265
+ 'parameters': create_json_schema(
266
+ properties={
267
+ 'input': {
268
+ 'type': 'string',
269
+ 'description': 'Input text'
270
+ }
271
+ },
272
+ required=['input']
273
+ )
274
+ }
275
+ ]
276
+
277
+ def execute_tool(self, name, arguments):
278
+ if name == 'my_tool':
279
+ # Your logic here
280
+ result = self._process(arguments['input'])
281
+
282
+ return ToolExecutionResult.success_result(
283
+ data={'output': result},
284
+ message="Processed successfully"
285
+ ).to_dict()
286
+
287
+ return ToolExecutionResult.error_result(
288
+ message=f"Unknown tool: {name}"
289
+ ).to_dict()
290
+
291
+ def _process(self, input_text):
292
+ # Your implementation
293
+ return input_text.upper()
294
+ ```
295
+
296
+ Then deploy it:
297
+
298
+ ```python
299
+ # For Claude
300
+ from aw_agents.adapters import MCPAdapter
301
+ adapter = MCPAdapter(MyAgent(), "my-agent")
302
+ adapter.run_sync()
303
+
304
+ # For ChatGPT
305
+ from aw_agents.adapters import OpenAPIAdapter
306
+ adapter = OpenAPIAdapter(MyAgent())
307
+ adapter.run(port=8001)
308
+ ```
309
+
310
+ ## Included Agents
311
+
312
+ ### Download Agent
313
+
314
+ Smart content downloader with:
315
+ - **Landing page detection**: Automatically finds actual download links
316
+ - **Context-aware file naming**: Uses conversation context for meaningful filenames
317
+ - **Special handling for**:
318
+ - GitHub (converts blob URLs to raw)
319
+ - HuggingFace (handles dataset downloads)
320
+ - Kaggle datasets
321
+ - Academic papers (arXiv, etc.)
322
+ - **Support for**: PDFs, datasets, CSV, JSON, and more
323
+
324
+ **Tools:**
325
+ - `download_content` - Download a single URL with smart handling
326
+ - `download_multiple` - Download multiple URLs at once
327
+ - `list_downloads` - List downloaded files
328
+
329
+ **Examples:**
330
+
331
+ ```python
332
+ from aw_agents.download import DownloadAgent
333
+
334
+ agent = DownloadAgent()
335
+
336
+ # Download with context-aware naming
337
+ result = agent.execute_tool('download_content', {
338
+ 'url': 'https://github.com/user/repo/blob/main/data.csv',
339
+ 'context': 'Dataset for analysis'
340
+ })
341
+ # Automatically converts to raw.githubusercontent.com
342
+ # Saves as: Dataset_for_analysis.csv
343
+
344
+ # Download multiple files
345
+ result = agent.execute_tool('download_multiple', {
346
+ 'urls': [
347
+ 'https://arxiv.org/pdf/2103.00020.pdf',
348
+ 'https://arxiv.org/pdf/1706.03762.pdf'
349
+ ],
350
+ 'contexts': [
351
+ 'Attention Paper',
352
+ 'Transformer Original'
353
+ ]
354
+ })
355
+
356
+ # List downloaded PDFs
357
+ result = agent.execute_tool('list_downloads', {
358
+ 'pattern': '*.pdf'
359
+ })
360
+ ```
361
+
362
+ **Smart Features:**
363
+
364
+ 1. **Landing Page Detection**:
365
+ ```python
366
+ # Input: Landing page URL
367
+ agent.execute_tool('download_content', {
368
+ 'url': 'https://papers.nips.cc/paper/2017/hash/xxx-Abstract.html'
369
+ })
370
+ # Agent detects HTML, finds PDF link, downloads PDF, warns about redirect
371
+ ```
372
+
373
+ 2. **GitHub URL Handling**:
374
+ ```python
375
+ # Input: GitHub blob URL
376
+ 'https://github.com/user/repo/blob/main/data.csv'
377
+ # Converts to:
378
+ 'https://raw.githubusercontent.com/user/repo/main/data.csv'
379
+ ```
380
+
381
+ 3. **Context-Aware Naming**:
382
+ ```python
383
+ # Without context:
384
+ # Filename: 2103.00020.pdf
385
+
386
+ # With context:
387
+ agent.execute_tool('download_content', {
388
+ 'url': 'https://arxiv.org/pdf/2103.00020.pdf',
389
+ 'context': 'Attention is All You Need - Transformer Paper'
390
+ })
391
+ # Filename: Attention_is_All_You_Need_Transformer_Paper.pdf
392
+ ```
393
+
394
+ ## Integration Guides
395
+
396
+ ### Claude Desktop Integration
397
+
398
+ 1. Create MCP server script:
399
+ ```bash
400
+ python scripts/deploy_mcp.py DownloadAgent --output ~/mcp_download.py
401
+ ```
402
+
403
+ 2. Edit Claude Desktop config:
404
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
405
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
406
+ - **Linux**: `~/.config/Claude/claude_desktop_config.json`
407
+
408
+ 3. Add to config:
409
+ ```json
410
+ {
411
+ "mcpServers": {
412
+ "download": {
413
+ "command": "python",
414
+ "args": ["/absolute/path/to/mcp_download.py"]
415
+ }
416
+ }
417
+ }
418
+ ```
419
+
420
+ 4. Restart Claude Desktop
421
+
422
+ **Usage Examples in Claude:**
423
+
424
+ ```
425
+ Download this paper: https://arxiv.org/pdf/2103.00020.pdf
426
+ Context: "Attention is All You Need paper"
427
+
428
+ I need these papers:
429
+ 1. https://arxiv.org/pdf/2103.00020.pdf - "Attention Paper"
430
+ 2. https://arxiv.org/pdf/1706.03762.pdf - "Transformer Original"
431
+
432
+ Show me what PDFs I've downloaded
433
+ ```
434
+
435
+ ### ChatGPT Custom GPT Integration
436
+
437
+ 1. Create API server script:
438
+ ```bash
439
+ python scripts/deploy_api.py DownloadAgent --output ~/api_download.py
440
+ python ~/api_download.py
441
+ ```
442
+
443
+ 2. Create Custom GPT at https://chat.openai.com/gpts/editor
444
+
445
+ 3. Add actions using schema from: `http://localhost:8000/openapi.json`
446
+
447
+ 4. For remote access, deploy to cloud or use ngrok:
448
+ ```bash
449
+ ngrok http 8000
450
+ ```
451
+
452
+ **Usage Examples in ChatGPT:**
453
+
454
+ ```
455
+ Download this dataset: https://github.com/user/repo/blob/main/data.csv
456
+ Context: "Sales Data Q4 2024"
457
+
458
+ Can you download these research papers for me?
459
+ [List of URLs with contexts]
460
+ ```
461
+
462
+ ## Troubleshooting
463
+
464
+ ### Installation Issues
465
+
466
+ **Problem**: Module not found errors
467
+
468
+ **Solution**:
469
+ ```bash
470
+ # Update pip and reinstall
471
+ pip install --upgrade pip
472
+ pip uninstall aw-agents
473
+ pip install -e .[all]
474
+ ```
475
+
476
+ **Problem**: Missing dependencies
477
+
478
+ **Solution**:
479
+ ```bash
480
+ # Install specific feature sets
481
+ pip install -e .[mcp] # For Claude
482
+ pip install -e .[api] # For ChatGPT
483
+ pip install -e .[all] # Everything
484
+ ```
485
+
486
+ ### Claude Desktop Issues
487
+
488
+ **Problem**: Claude doesn't see the download tools
489
+
490
+ **Solution**:
491
+ 1. Verify config file location (see paths above)
492
+ 2. Use absolute path in config (not `~/` or `./`)
493
+ 3. Check logs: `~/Library/Logs/Claude/` (macOS)
494
+ 4. Restart Claude Desktop completely (Quit, not just close window)
495
+ 5. Verify Python environment: `which python`
496
+
497
+ **Problem**: "Module not found" when Claude tries to use agent
498
+
499
+ **Solution**:
500
+ ```bash
501
+ # Install in the Python environment Claude uses
502
+ which python # Check which Python Claude is using
503
+ # Use that Python to install dependencies
504
+ /path/to/python -m pip install mcp requests beautifulsoup4 graze
505
+ ```
506
+
507
+ ### ChatGPT Custom GPT Issues
508
+
509
+ **Problem**: Actions can't connect to localhost
510
+
511
+ **Solution**:
512
+ - ChatGPT servers can't access `localhost` from OpenAI's infrastructure
513
+ - Options:
514
+ 1. **For testing**: Use ngrok to expose local server
515
+ ```bash
516
+ ngrok http 8000
517
+ # Use the ngrok URL in your Custom GPT actions
518
+ ```
519
+ 2. **For production**: Deploy to cloud service (AWS, GCP, Azure, Heroku)
520
+ 3. **Same network**: Use your local IP address
521
+
522
+ **Problem**: Schema import fails
523
+
524
+ **Solution**:
525
+ 1. Ensure server is running: `curl http://localhost:8000/openapi.json`
526
+ 2. Check for CORS issues (FastAPI handles this by default)
527
+ 3. Try manual schema paste instead of URL import
528
+
529
+ ### General Issues
530
+
531
+ **Problem**: Downloads failing
532
+
533
+ **Solution**:
534
+ 1. Check internet connection
535
+ 2. Verify URL is accessible: `curl -I [URL]`
536
+ 3. Some sites may block automated downloads
537
+ 4. Check download directory permissions
538
+
539
+ **Problem**: Import errors in Python
540
+
541
+ **Solution**:
542
+ ```bash
543
+ # Verify installation
544
+ python -c "from aw_agents.download import DownloadAgent; print('✓ Success')"
545
+
546
+ # Reinstall if needed
547
+ pip install -e .[all]
548
+ ```
549
+
550
+ ## Development
551
+
552
+ ### Running Tests
553
+
554
+ ```bash
555
+ pytest
556
+ ```
557
+
558
+ ### Code Quality
559
+
560
+ ```bash
561
+ # Format code
562
+ black aw_agents tests
563
+
564
+ # Lint
565
+ ruff aw_agents tests
566
+
567
+ # Type check
568
+ mypy aw_agents
569
+ ```
570
+
571
+ ### Adding a New Agent
572
+
573
+ 1. Create a new directory in `aw_agents/`:
574
+ ```
575
+ aw_agents/myagent/
576
+ ├── __init__.py
577
+ ├── agent.py
578
+ └── core.py (if needed)
579
+ ```
580
+
581
+ 2. Implement `AgentBase` in `agent.py`
582
+
583
+ 3. Add to `aw_agents/__init__.py`:
584
+ ```python
585
+ from aw_agents.myagent import MyAgent
586
+ __all__.append('MyAgent')
587
+ ```
588
+
589
+ 4. Create tests in `tests/test_myagent.py`
590
+
591
+ 5. Update documentation
592
+
593
+ ## Roadmap
594
+
595
+ - [ ] Additional built-in agents (research, data prep, etc.)
596
+ - [ ] Support for more platforms (Slack, Discord, etc.)
597
+ - [ ] Agent composition and chaining
598
+ - [ ] Persistent state management
599
+ - [ ] Authentication and authorization
600
+ - [ ] Web UI for agent management
601
+ - [ ] CLI tools for deployment
602
+
603
+ ## Contributing
604
+
605
+ Contributions welcome! Please:
606
+
607
+ 1. Fork the repo
608
+ 2. Create a feature branch
609
+ 3. Add tests for new features
610
+ 4. Ensure all tests pass
611
+ 5. Submit a pull request
612
+
613
+ ## License
614
+
615
+ MIT License - see LICENSE file for details
616
+
617
+ ## Credits
618
+
619
+ Built with:
620
+ - [dol](https://github.com/i2mint/dol) - Storage abstractions
621
+ - [graze](https://github.com/thorwhalen/graze) - Download and caching
622
+ - [MCP](https://modelcontextprotocol.io/) - Model Context Protocol
623
+ - [FastAPI](https://fastapi.tiangolo.com/) - Modern web framework
624
+
625
+ Part of the [thorwhalen](https://github.com/thorwhalen) ecosystem.