aw_agents.agents.download.download_core¶
Download Agent: Smart content downloader with context-aware naming and intelligent link handling.
This agent can download content from URLs with special handling for:
Indirect download links (landing pages with actual download links)
Scientific papers (PDFs from various sources)
Data from HuggingFace, Kaggle, GitHub
Context-aware file naming based on conversation context
Functions
|
Convenience function to download a single URL and return the path. |
Classes
|
Core download engine with smart link handling and context-aware naming. |
- class aw_agents.agents.download.download_core.DownloadEngine(default_download_dir=None, *, user_agent='DownloadAgent/1.0', timeout=30, max_redirects=5, extension_router=None)[source]¶
Bases:
objectCore download engine with smart link handling and context-aware naming.
>>> engine = DownloadEngine() >>> # engine.download("https://example.com/paper.pdf", context="Important ML Paper")- download(url, *, context=None, download_dir=None, filename=None, force_redownload=False)[source]¶
Download content from a URL with smart handling.
- Parameters:
url (
str) – URL to download fromcontext (
Optional[str]) – Context about the content (used for filename generation)download_dir (
Union[str,Path,None]) – Directory to download to (default: self.default_download_dir)filename (
Optional[str]) – Override automatic filename generationforce_redownload (
bool) – Force re-download even if cached
- Returns:
‘path’: Path to downloaded file
’url’: Final URL downloaded from
’warnings’: List of warning messages
’metadata’: Additional metadata
- Return type:
Example
>>> engine = DownloadEngine() >>> # result = engine.download("https://example.com/paper.pdf", context="ML Paper") >>> # print(result['path'])