aw_agents.agents.download

Download Agent - Smart content downloader with context-aware naming.

Functions

download_content(url, *[, context, download_dir])

Convenience function to download a single URL and return the path.

Classes

DownloadAgent([default_download_dir])

Smart download agent with context-aware naming and intelligent link handling.

DownloadEngine([default_download_dir, ...])

Core download engine with smart link handling and context-aware naming.

class aw_agents.agents.download.DownloadAgent(default_download_dir=None, **kwargs)[source]

Bases: AgentBase

Smart download agent with context-aware naming and intelligent link handling.

Features:

  • Detects landing pages and finds actual download links

  • Special handling for GitHub, HuggingFace, Kaggle

  • Context-aware file naming

  • Multiple content type support

>>> agent = DownloadAgent()
>>> tools = agent.get_tools()
>>> len(tools) >= 3
True
execute_tool(name, arguments)[source]

Execute a tool with given arguments.

Return type:

Dict[str, Any]

get_metadata()[source]

Get agent metadata.

Return type:

Dict[str, Any]

get_tools()[source]

Return tool definitions for this agent.

Return type:

List[Dict[str, Any]]

class aw_agents.agents.download.DownloadEngine(default_download_dir=None, *, user_agent='DownloadAgent/1.0', timeout=30, max_redirects=5, extension_router=None)[source]

Bases: object

Core 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 from

  • context (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 generation

  • force_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:

Dict[str, Any]

Example

>>> engine = DownloadEngine()
>>> # result = engine.download("https://example.com/paper.pdf", context="ML Paper")
>>> # print(result['path'])
download_multiple(urls, *, contexts=None, download_dir=None)[source]

Download multiple URLs.

Parameters:
  • urls (List[str]) – List of URLs to download

  • contexts (Optional[List[str]]) – Optional list of contexts (same length as urls)

  • download_dir (Union[str, Path, None]) – Directory to download to

Return type:

List[Dict[str, Any]]

Returns:

List of result dictionaries (one per URL)

aw_agents.agents.download.download_content(url, *, context=None, download_dir=None)[source]

Convenience function to download a single URL and return the path.

Example

>>> # path = download_content("https://example.com/file.pdf", context="Important doc")
Return type:

str

Modules

agent

Download Agent - Smart content downloader with context-aware naming.

download_core

Download Agent: Smart content downloader with context-aware naming and intelligent link handling.