aw_agents

aw_agents - AI Agents for Agentic Workflows

A collection of AI agents that can be easily deployed to multiple chatbot platforms (Claude, ChatGPT, etc.) through adapters.

Agents:
  • DownloadAgent: Smart content downloader with context-aware naming

Adapters:
  • MCPAdapter: For Claude Desktop (MCP protocol)

  • OpenAPIAdapter: For ChatGPT Custom GPTs (OpenAPI/FastAPI)

Example

>>> from aw_agents.agents.download import DownloadAgent
>>> from aw_agents.adapters import MCPAdapter
>>>
>>> agent = DownloadAgent()
>>> adapter = MCPAdapter(agent, "download-agent")
>>> # adapter.run() serves the agent via MCP for Claude (blocks; not run here)
class aw_agents.AgentBase[source]

Base class for all AW agents.

Agents should inherit from this and implement the core methods. Adapters (MCP, OpenAPI) will wrap these agents for deployment.

abstractmethod execute_tool(name: str, arguments: Dict[str, Any]) Dict[str, Any][source]

Execute a tool with given arguments.

Parameters:
  • name – Tool name

  • arguments – Tool arguments

Returns:

  • success: bool

  • data: Any

  • message: Optional[str]

  • warnings: Optional[list[str]]

Return type:

Result dictionary with at least

get_metadata() Dict[str, Any][source]

Get agent metadata.

Returns:

Metadata including name, version, description

abstractmethod get_tools() list[Dict[str, Any]][source]

Return tool definitions for this agent.

Each tool should have: - name: str - description: str - parameters: dict (JSON schema)

Returns:

List of tool definitions

class aw_agents.DownloadAgent(default_download_dir: str | Path | None = None, **kwargs)[source]

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: str, arguments: Dict[str, Any]) Dict[str, Any][source]

Execute a tool with given arguments.

get_metadata() Dict[str, Any][source]

Get agent metadata.

get_tools() List[Dict[str, Any]][source]

Return tool definitions for this agent.

class aw_agents.MCPAdapter(agent: AgentBase, server_name: str)[source]

Adapter to expose an AgentBase as an MCP server.

Usage:

agent = YourAgent() adapter = MCPAdapter(agent, server_name=”your-agent”) adapter.run()

async run()[source]

Run the MCP server.

run_sync()[source]

Run the MCP server (synchronous wrapper).

class aw_agents.OpenAPIAdapter(agent: AgentBase, *, title: str = 'AI Agent API', description: str = 'AI Agent exposed via OpenAPI', version: str = '1.0.0', server_url: str | None = None)[source]

Adapter to expose an AgentBase as a FastAPI/OpenAPI service.

Usage:

agent = YourAgent() adapter = OpenAPIAdapter(agent, title=”Your Agent API”) adapter.run(port=8000)

run(host: str = '0.0.0.0', port: int = 8000, **kwargs)[source]

Run the FastAPI server.

Parameters:
  • host – Host to bind to

  • port – Port to bind to

  • **kwargs – Additional uvicorn arguments

class aw_agents.ToolExecutionResult(success: bool, data: Any = None, message: str | None = None, warnings: list[str] | None = None, metadata: Dict[str, Any] | None = None)[source]

Standard result format for tool execution.

classmethod error_result(message: str, data: Any = None, **kwargs) ToolExecutionResult[source]

Create an error result.

classmethod success_result(data: Any, message: str | None = None, **kwargs) ToolExecutionResult[source]

Create a success result.

to_dict() Dict[str, Any][source]

Convert to dictionary format.

aw_agents.create_api_server_script(agent_class, output_path: Path, *, default_port: int = 8000)[source]

Generate an API server script for an agent.

Parameters:
  • agent_class – Agent class to wrap

  • output_path – Path to write the script

  • default_port – Default port for the server

aw_agents.create_json_schema(properties: Dict[str, Dict[str, Any]], required: list[str] | None = None, **kwargs) Dict[str, Any][source]

Helper to create JSON schema for tool parameters.

>>> schema = create_json_schema(
...     properties={
...         'url': {'type': 'string', 'description': 'URL to process'},
...         'context': {'type': 'string', 'description': 'Context info'}
...     },
...     required=['url']
... )
>>> schema['type']
'object'
>>> 'url' in schema['required']
True
aw_agents.create_mcp_server_script(agent_class, server_name: str, output_path: Path)[source]

Generate an MCP server script for an agent.

Parameters:
  • agent_class – Agent class to wrap

  • server_name – Name for the MCP server

  • output_path – Path to write the script