aw_agents 0.1.2__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.
Files changed (33) hide show
  1. aw_agents-0.1.2/.github/workflows/ci.yml +236 -0
  2. aw_agents-0.1.2/.gitignore +121 -0
  3. aw_agents-0.1.2/CHANGELOG.md +35 -0
  4. aw_agents-0.1.2/EXTENSION_ROUTING_SUMMARY.md +186 -0
  5. aw_agents-0.1.2/IMPLEMENTATION_COMPLETE.md +152 -0
  6. aw_agents-0.1.2/LICENSE +21 -0
  7. aw_agents-0.1.2/ORGANIZATION.md +287 -0
  8. aw_agents-0.1.2/PKG-INFO +780 -0
  9. aw_agents-0.1.2/QUICKSTART.md +164 -0
  10. aw_agents-0.1.2/README.md +746 -0
  11. aw_agents-0.1.2/SETUP_COMPLETE.md +230 -0
  12. aw_agents-0.1.2/USAGE.md +170 -0
  13. aw_agents-0.1.2/aw_agents/__init__.py +55 -0
  14. aw_agents-0.1.2/aw_agents/adapters/__init__.py +11 -0
  15. aw_agents-0.1.2/aw_agents/adapters/mcp.py +187 -0
  16. aw_agents-0.1.2/aw_agents/adapters/openapi.py +293 -0
  17. aw_agents-0.1.2/aw_agents/agents/__init__.py +9 -0
  18. aw_agents-0.1.2/aw_agents/agents/download/__init__.py +6 -0
  19. aw_agents-0.1.2/aw_agents/agents/download/agent.py +511 -0
  20. aw_agents-0.1.2/aw_agents/agents/download/demo_download_agent.ipynb +504 -0
  21. aw_agents-0.1.2/aw_agents/agents/download/download_core.py +636 -0
  22. aw_agents-0.1.2/aw_agents/agents/download/review_notes.md +0 -0
  23. aw_agents-0.1.2/aw_agents/base.py +134 -0
  24. aw_agents-0.1.2/aw_agents/util.py +27 -0
  25. aw_agents-0.1.2/examples.py +160 -0
  26. aw_agents-0.1.2/pyproject.toml +178 -0
  27. aw_agents-0.1.2/scripts/__init__.py +0 -0
  28. aw_agents-0.1.2/scripts/deploy_api.py +59 -0
  29. aw_agents-0.1.2/scripts/deploy_mcp.py +72 -0
  30. aw_agents-0.1.2/setup_helper.py +157 -0
  31. aw_agents-0.1.2/tests/__init__.py +0 -0
  32. aw_agents-0.1.2/tests/test_download.py +53 -0
  33. aw_agents-0.1.2/tests/test_extension_routing.py +99 -0
@@ -0,0 +1,236 @@
1
+ name: Continuous Integration (uv)
2
+ # MIGRATION NOTE: Old CI uses setuptools - ensure pyproject.toml with [tool.wads.ci] is ready
3
+ # MIGRATION NOTE: Old CI uses pylint - new CI uses ruff for linting
4
+ # MIGRATION NOTE: PyPI auth changed: set secrets.PYPI_PASSWORD to a PyPI API token (uv publish uses UV_PUBLISH_TOKEN, mapped from PYPI_PASSWORD)
5
+ # MIGRATION NOTE: Old CI references setup.cfg - ensure project is migrated to pyproject.toml first (use: wads-migrate setup-to-pyproject)
6
+ on: [push, pull_request]
7
+
8
+ # Workflow-level env vars from [tool.wads.ci.env] in pyproject.toml.
9
+ # Populated by wads-migrate / wads init via template substitution.
10
+ # Includes PROJECT_NAME, literal defaults from env.defaults, and secret-
11
+ # backed vars from required_envvars / test_envvars / extra_envvars,
12
+ # rendered as `KEY: secrets.KEY || ''` so missing secrets don't fail parsing.
13
+ env:
14
+ PROJECT_NAME: aw_agents
15
+
16
+ jobs:
17
+ # First job: Read configuration from pyproject.toml
18
+ setup:
19
+ name: Read Configuration
20
+ runs-on: ubuntu-latest
21
+ outputs:
22
+ project-name: ${{ steps.config.outputs.project-name }}
23
+ python-versions: ${{ steps.config.outputs.python-versions }}
24
+ pytest-args: ${{ steps.config.outputs.pytest-args }}
25
+ coverage-enabled: ${{ steps.config.outputs.coverage-enabled }}
26
+ exclude-paths: ${{ steps.config.outputs.exclude-paths }}
27
+ test-on-windows: ${{ steps.config.outputs.test-on-windows }}
28
+ build-sdist: ${{ steps.config.outputs.build-sdist }}
29
+ build-wheel: ${{ steps.config.outputs.build-wheel }}
30
+ metrics-enabled: ${{ steps.config.outputs.metrics-enabled }}
31
+ metrics-config-path: ${{ steps.config.outputs.metrics-config-path }}
32
+ metrics-storage-branch: ${{ steps.config.outputs.metrics-storage-branch }}
33
+ metrics-python-version: ${{ steps.config.outputs.metrics-python-version }}
34
+ metrics-force-run: ${{ steps.config.outputs.metrics-force-run }}
35
+ ruff-enabled: ${{ steps.config.outputs.ruff-enabled }}
36
+ black-enabled: ${{ steps.config.outputs.black-enabled }}
37
+ mypy-enabled: ${{ steps.config.outputs.mypy-enabled }}
38
+ docs-enabled: ${{ steps.config.outputs.docs-enabled }}
39
+
40
+ steps:
41
+ - uses: actions/checkout@v6
42
+
43
+ - name: Set up uv
44
+ uses: astral-sh/setup-uv@v7
45
+
46
+ - name: Set up Python
47
+ run: uv python install 3.11
48
+
49
+ - name: Read CI Config
50
+ id: config
51
+ uses: i2mint/wads/actions/read-ci-config@master
52
+ with:
53
+ pyproject-path: .
54
+
55
+ # Second job: Validation using the config
56
+ validation:
57
+ name: Validation
58
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
59
+ needs: setup
60
+ runs-on: ubuntu-latest
61
+ strategy:
62
+ matrix:
63
+ python-version: ${{ fromJson(needs.setup.outputs.python-versions) }}
64
+
65
+ steps:
66
+ - uses: actions/checkout@v6
67
+
68
+ - name: Set up uv
69
+ uses: astral-sh/setup-uv@v7
70
+ with:
71
+ enable-cache: true
72
+
73
+ - name: Set up Python ${{ matrix.python-version }}
74
+ uses: i2mint/wads/actions/setup-python-uv@master
75
+ with:
76
+ python-version: ${{ matrix.python-version }}
77
+
78
+ - name: Install System Dependencies
79
+ uses: i2mint/wads/actions/install-system-deps@master
80
+ with:
81
+ pyproject-path: .
82
+
83
+ - name: Install Dependencies
84
+ uses: i2mint/wads/actions/install-deps-uv@master
85
+
86
+ - name: Format Source Code
87
+ if: needs.setup.outputs.ruff-enabled != 'false'
88
+ run: uvx ruff format .
89
+
90
+ - name: Format Source Code (black)
91
+ if: needs.setup.outputs.black-enabled == 'true'
92
+ run: uvx black .
93
+
94
+ - name: Lint Validation
95
+ if: needs.setup.outputs.ruff-enabled != 'false'
96
+ run: uvx ruff check --output-format=github ${{ needs.setup.outputs.project-name }}
97
+
98
+ - name: Type Check (mypy)
99
+ if: needs.setup.outputs.mypy-enabled == 'true'
100
+ run: uvx mypy ${{ needs.setup.outputs.project-name }}
101
+
102
+ - name: Run Tests
103
+ uses: i2mint/wads/actions/run-tests-uv@master
104
+ with:
105
+ root-dir: ${{ needs.setup.outputs.project-name }}
106
+ pytest-args: ${{ needs.setup.outputs.pytest-args }}
107
+ exclude-paths: ${{ needs.setup.outputs.exclude-paths }}
108
+ coverage: ${{ needs.setup.outputs.coverage-enabled }}
109
+
110
+ - name: Track Code Metrics
111
+ if: needs.setup.outputs.metrics-enabled == 'true'
112
+ uses: i2mint/umpyre/actions/track-metrics@master
113
+ continue-on-error: true
114
+ with:
115
+ github-token: ${{ secrets.GITHUB_TOKEN }}
116
+ config-path: ${{ needs.setup.outputs.metrics-config-path }}
117
+ storage-branch: ${{ needs.setup.outputs.metrics-storage-branch }}
118
+ python-version: ${{ needs.setup.outputs.metrics-python-version }}
119
+ force-run: ${{ needs.setup.outputs.metrics-force-run }}
120
+
121
+ # Optional Windows testing (if enabled in config)
122
+ windows-validation:
123
+ name: Windows Tests
124
+ if: "!contains(github.event.head_commit.message, '[skip ci]') && needs.setup.outputs.test-on-windows == 'true'"
125
+ needs: setup
126
+ runs-on: windows-latest
127
+ continue-on-error: true
128
+
129
+ steps:
130
+ - uses: actions/checkout@v6
131
+
132
+ - name: Set up uv
133
+ uses: astral-sh/setup-uv@v7
134
+ with:
135
+ enable-cache: true
136
+
137
+ - name: Set up Python
138
+ uses: i2mint/wads/actions/setup-python-uv@master
139
+ with:
140
+ python-version: ${{ fromJson(needs.setup.outputs.python-versions)[0] }}
141
+
142
+ - name: Install System Dependencies
143
+ uses: i2mint/wads/actions/install-system-deps@master
144
+ with:
145
+ pyproject-path: .
146
+
147
+ - name: Install Dependencies
148
+ uses: i2mint/wads/actions/install-deps-uv@master
149
+
150
+ - name: Run Tests
151
+ uses: i2mint/wads/actions/run-tests-uv@master
152
+ with:
153
+ root-dir: ${{ needs.setup.outputs.project-name }}
154
+ pytest-args: ${{ needs.setup.outputs.pytest-args }}
155
+ exclude-paths: ${{ needs.setup.outputs.exclude-paths }}
156
+
157
+ # Publishing job
158
+ publish:
159
+ name: Publish
160
+ permissions:
161
+ contents: write
162
+ if: "!contains(github.event.head_commit.message, '[skip ci]') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')"
163
+ needs: [setup, validation]
164
+ runs-on: ubuntu-latest
165
+
166
+ steps:
167
+ - uses: actions/checkout@v6
168
+ with:
169
+ fetch-depth: 0
170
+ token: ${{ secrets.GITHUB_TOKEN }}
171
+
172
+ - name: Set up uv
173
+ uses: astral-sh/setup-uv@v7
174
+
175
+ - name: Set up Python
176
+ uses: i2mint/wads/actions/setup-python-uv@master
177
+ with:
178
+ python-version: ${{ fromJson(needs.setup.outputs.python-versions)[0] }}
179
+ create-venv: "false"
180
+
181
+ - name: Format Source Code
182
+ if: needs.setup.outputs.ruff-enabled != 'false'
183
+ run: uvx ruff format .
184
+
185
+ - name: Format Source Code (black)
186
+ if: needs.setup.outputs.black-enabled == 'true'
187
+ run: uvx black .
188
+
189
+ - name: Update Version Number
190
+ id: version
191
+ uses: i2mint/isee/actions/bump-version-number@master
192
+
193
+ - name: Build Distribution
194
+ uses: i2mint/wads/actions/build-dist-uv@master
195
+ with:
196
+ sdist: ${{ needs.setup.outputs.build-sdist }}
197
+ wheel: ${{ needs.setup.outputs.build-wheel }}
198
+
199
+ - name: Publish to PyPI
200
+ uses: i2mint/wads/actions/pypi-publish-uv@master
201
+ with:
202
+ pypi-token: ${{ secrets.PYPI_PASSWORD }}
203
+
204
+ - name: Force SSH for git remote
205
+ run: git remote set-url origin git@github.com:${{ github.repository }}.git
206
+
207
+ - name: Commit Changes
208
+ uses: i2mint/wads/actions/git-commit@master
209
+ with:
210
+ commit-message: "**CI** Formatted code + Updated version to ${{ env.VERSION }} [skip ci]"
211
+ ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
212
+ push: true
213
+
214
+ - name: Tag Repository
215
+ uses: i2mint/wads/actions/git-tag@master
216
+ with:
217
+ tag: ${{ env.VERSION }}
218
+ message: "Release version ${{ env.VERSION }}"
219
+ push: true
220
+
221
+ # Optional GitHub Pages (skipped when [tool.wads.ci.docs].enabled = false)
222
+ github-pages:
223
+ name: Publish GitHub Pages
224
+ permissions:
225
+ contents: write
226
+ pages: write
227
+ id-token: write
228
+ if: "!contains(github.event.head_commit.message, '[skip ci]') && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && needs.setup.outputs.docs-enabled != 'false'"
229
+ needs: [setup, publish]
230
+ runs-on: ubuntu-latest
231
+
232
+ steps:
233
+ - uses: i2mint/epythet/actions/publish-github-pages@master
234
+ with:
235
+ github-token: ${{ secrets.GITHUB_TOKEN }}
236
+ ignore: "tests/,scrap/,examples/"
@@ -0,0 +1,121 @@
1
+ wads_configs.json
2
+ data/wads_configs.json
3
+ wads/data/wads_configs.json
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+
11
+ .DS_Store
12
+ # C extensions
13
+ *.so
14
+
15
+ # TLS certificates
16
+ ## Ignore all PEM files anywhere
17
+ *.pem
18
+ ## Also ignore any certs directory
19
+ certs/
20
+
21
+ # Distribution / packaging
22
+ .Python
23
+ build/
24
+ develop-eggs/
25
+ dist/
26
+ downloads/
27
+ eggs/
28
+ .eggs/
29
+ lib/
30
+ lib64/
31
+ parts/
32
+ sdist/
33
+ var/
34
+ wheels/
35
+ *.egg-info/
36
+ .installed.cfg
37
+ *.egg
38
+ MANIFEST
39
+ _build
40
+
41
+ # PyInstaller
42
+ # Usually these files are written by a python script from a template
43
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
44
+ *.manifest
45
+ *.spec
46
+
47
+ # Installer logs
48
+ pip-log.txt
49
+ pip-delete-this-directory.txt
50
+
51
+ # Unit test / coverage reports
52
+ htmlcov/
53
+ .tox/
54
+ .coverage
55
+ .coverage.*
56
+ .cache
57
+ nosetests.xml
58
+ coverage.xml
59
+ *.cover
60
+ .hypothesis/
61
+ .pytest_cache/
62
+
63
+ # Translations
64
+ *.mo
65
+ *.pot
66
+
67
+ # Django stuff:
68
+ *.log
69
+ local_settings.py
70
+ db.sqlite3
71
+
72
+ # Flask stuff:
73
+ instance/
74
+ .webassets-cache
75
+
76
+ # Scrapy stuff:
77
+ .scrapy
78
+
79
+ # Sphinx documentation
80
+ docs/_build/
81
+ docs/*
82
+
83
+ # PyBuilder
84
+ target/
85
+
86
+ # Jupyter Notebook
87
+ .ipynb_checkpoints
88
+
89
+ # pyenv
90
+ .python-version
91
+
92
+ # celery beat schedule file
93
+ celerybeat-schedule
94
+
95
+ # SageMath parsed files
96
+ *.sage.py
97
+
98
+ # Environments
99
+ .env
100
+ .venv
101
+ env/
102
+ venv/
103
+ ENV/
104
+ env.bak/
105
+ venv.bak/
106
+
107
+ # Spyder project settings
108
+ .spyderproject
109
+ .spyproject
110
+
111
+ # Rope project settings
112
+ .ropeproject
113
+
114
+ # mkdocs documentation
115
+ /site
116
+
117
+ # mypy
118
+ .mypy_cache/
119
+
120
+ # PyCharm
121
+ .idea
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-01-04
9
+
10
+ ### Added
11
+ - Initial release of aw-agents
12
+ - `AgentBase` protocol for building agents
13
+ - `MCPAdapter` for Claude Desktop integration
14
+ - `OpenAPIAdapter` for ChatGPT Custom GPT integration
15
+ - `DownloadAgent` with smart content downloading
16
+ - Landing page detection
17
+ - Context-aware file naming
18
+ - Special handling for GitHub, HuggingFace, Kaggle
19
+ - Multiple content type support
20
+ - Deployment scripts for MCP and API servers
21
+ - Comprehensive documentation and examples
22
+
23
+ ### Framework Features
24
+ - Unified tool execution interface
25
+ - Standard result format (`ToolExecutionResult`)
26
+ - JSON schema helpers for tool parameters
27
+ - Automatic adapter generation
28
+ - Support for multiple agent deployment modes
29
+
30
+ ### Download Agent Features
31
+ - Smart URL resolution
32
+ - Automatic file extension detection
33
+ - graze integration for caching
34
+ - Batch download support
35
+ - File listing capabilities
@@ -0,0 +1,186 @@
1
+ # Extension Routing Implementation Summary
2
+
3
+ ## Problem
4
+
5
+ The DownloadAgent was incorrectly assigning file extensions based solely on the `Content-Type` header. This caused issues with services like ArXiv that serve PDF files but return `text/html` as the content type for server-side processing.
6
+
7
+ **Bug Example:**
8
+ ```python
9
+ agent.download('https://arxiv.org/pdf/2103.00020.pdf', context='Important ML Paper')
10
+ # Result: Important_ML_Paper.html ❌ (should be .pdf)
11
+ ```
12
+
13
+ ## Solution
14
+
15
+ Created a general routing infrastructure in the `aw` package that follows the open-closed principle, then applied it to fix the extension detection issue.
16
+
17
+ ### Architecture
18
+
19
+ 1. **General Routing Module** (`aw/routing.py`)
20
+ - `PriorityRouter`: Chain strategies, return first match
21
+ - `ConditionalRouter`: Only accept results matching a condition
22
+ - `MappingRouter`: Switch-case style routing with visible mappings
23
+ - `ExtensionRouter`: Specific implementation for extension detection
24
+
25
+ 2. **Integration** (`aw_agents/download/download_core.py`)
26
+ - `DownloadEngine` now uses `ExtensionRouter` for filename generation
27
+ - Configurable via `extension_router` parameter
28
+ - Falls back gracefully if `aw.routing` not available
29
+
30
+ ### Extension Detection Priority Chain
31
+
32
+ ```
33
+ 1. Explicit extension (if provided)
34
+ 2. URL extension (if .pdf/.md/.json - priority extensions)
35
+ 3. Content-Type header mapping
36
+ 4. Magic bytes detection
37
+ 5. Fallback to .bin
38
+ ```
39
+
40
+ **Priority Extensions** short-circuit the chain - if URL has `.pdf`, use it regardless of Content-Type.
41
+
42
+ ## Key Features
43
+
44
+ ### 1. Visible, Configurable Rules
45
+
46
+ ```python
47
+ from aw.routing import ExtensionRouter
48
+
49
+ router = ExtensionRouter()
50
+
51
+ # Inspect mappings
52
+ print(router.content_type_map)
53
+ # {'application/pdf': '.pdf', 'text/html': '.html', ...}
54
+
55
+ # Modify mappings
56
+ router.content_type_map['text/x-log'] = '.log'
57
+
58
+ # Inspect priority extensions
59
+ print(router.priority_extensions)
60
+ # frozenset(['.pdf', '.md', '.json'])
61
+ ```
62
+
63
+ ### 2. Open-Closed Extension
64
+
65
+ ```python
66
+ from aw.routing import ExtensionRouter
67
+
68
+ # Add custom detection strategy
69
+ def detect_special(ctx):
70
+ if 'special' in ctx.url:
71
+ return '.special'
72
+ return None
73
+
74
+ # Create new router with custom strategy
75
+ custom_router = router.with_prepended_strategy(detect_special)
76
+
77
+ # Use in DownloadEngine
78
+ engine = DownloadEngine(extension_router=custom_router)
79
+ ```
80
+
81
+ ### 3. Explicit Extension Override
82
+
83
+ ```python
84
+ # User can explicitly specify extension
85
+ engine.download(
86
+ url='https://example.com/ambiguous_file',
87
+ context='MyData',
88
+ explicit_extension='json' # Forces .json extension
89
+ )
90
+ ```
91
+
92
+ ## Test Coverage
93
+
94
+ Created comprehensive test suite in `tests/test_extension_routing.py`:
95
+
96
+ - ✅ PDF extension from URL (ArXiv bug fix)
97
+ - ✅ Priority extension handling (.md, .pdf)
98
+ - ✅ Explicit extension override
99
+ - ✅ Context-based filename generation
100
+ - ✅ Fallback to URL extension
101
+ - ✅ Router configurability
102
+ - ✅ Filename sanitization
103
+
104
+ **All 11 tests pass** (7 new + 4 existing).
105
+
106
+ ## Files Modified
107
+
108
+ ### New Files
109
+ - `/Users/thorwhalen/Dropbox/py/proj/t/aw/aw/routing.py` - General routing infrastructure
110
+ - `/Users/thorwhalen/Dropbox/py/proj/t/aw_agents/tests/test_extension_routing.py` - Test suite
111
+
112
+ ### Modified Files
113
+ - `/Users/thorwhalen/Dropbox/py/proj/t/aw_agents/aw_agents/download/download_core.py`
114
+ - Added `ExtensionRouter` integration
115
+ - Refactored `_generate_filename()` to use router
116
+ - Added `extension_router` parameter to `__init__`
117
+
118
+ - `/Users/thorwhalen/Dropbox/py/proj/t/aw_agents/setup.cfg`
119
+ - Added `aw>=0.1.0` dependency
120
+
121
+ - `/Users/thorwhalen/Dropbox/py/proj/t/aw_agents/pyproject.toml`
122
+ - Removed coverage from default pytest args
123
+
124
+ ## Verification
125
+
126
+ ```bash
127
+ # Install dependencies
128
+ cd /Users/thorwhalen/Dropbox/py/proj/t/aw
129
+ pip install -e .
130
+
131
+ cd /Users/thorwhalen/Dropbox/py/proj/t/aw_agents
132
+ pip install -e .
133
+
134
+ # Run tests
135
+ python -m pytest tests/ -v
136
+ # ✅ 11 passed
137
+
138
+ # Test ArXiv case
139
+ python -c "
140
+ from aw_agents import DownloadAgent
141
+ agent = DownloadAgent()
142
+ result = agent.execute_tool('download_content', {
143
+ 'url': 'https://arxiv.org/pdf/2103.00020.pdf',
144
+ 'context': 'Important ML Paper'
145
+ })
146
+ print(result['data']['path'])
147
+ # Output: /Users/thorwhalen/Downloads/Important_ML_Paper.pdf ✅
148
+ "
149
+ ```
150
+
151
+ ## Benefits
152
+
153
+ 1. **Fixed the Bug**: ArXiv PDFs now get `.pdf` extension
154
+ 2. **General Solution**: Routing infrastructure can be reused across `aw` package
155
+ 3. **Open-Closed**: Easy to extend without modifying core code
156
+ 4. **Visible Rules**: All mappings and priorities are inspectable and mutable
157
+ 5. **Well-Tested**: 50+ doctests + 11 pytest tests all passing
158
+ 6. **Documented**: Comprehensive docstrings with examples
159
+
160
+ ## Usage Example
161
+
162
+ ```python
163
+ from aw_agents import DownloadAgent
164
+
165
+ agent = DownloadAgent()
166
+
167
+ # Basic download (now works correctly!)
168
+ result = agent.execute_tool('download_content', {
169
+ 'url': 'https://arxiv.org/pdf/2103.00020.pdf',
170
+ 'context': 'ML Paper'
171
+ })
172
+ # → ML_Paper.pdf ✅
173
+
174
+ # With explicit extension
175
+ result = agent.execute_tool('download_content', {
176
+ 'url': 'https://example.com/data',
177
+ 'context': 'Dataset',
178
+ 'explicit_extension': 'csv'
179
+ })
180
+ # → Dataset.csv
181
+
182
+ # Custom router
183
+ from aw.routing import ExtensionRouter
184
+ router = ExtensionRouter(priority_extensions=frozenset(['.json', '.xml']))
185
+ agent = DownloadAgent(extension_router=router)
186
+ ```