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)

Functions

create_json_schema(properties[, required])

Helper to create JSON schema for tool parameters.

create_mcp_server_script(agent_class, ...)

Generate an MCP server script for an agent.

create_api_server_script(agent_class, ...[, ...])

Generate an API server script for an agent.

Classes

AgentBase()

Base class for all AW agents.

ToolExecutionResult(success[, data, ...])

Standard result format for tool execution.

MCPAdapter(agent, server_name, **server_options)

Adapter to expose an AgentBase as an MCP server.

OpenAPIAdapter(agent, *[, title, ...])

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

DownloadAgent([default_download_dir])

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

class aw_agents.AgentBase[source]

Bases: ABC

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, arguments)[source]

Execute a tool with given arguments.

Parameters:
  • name (str) – Tool name

  • arguments (Dict[str, Any]) – Tool arguments

Returns:

  • success: bool

  • data: Any

  • message: Optional[str]

  • warnings: Optional[list[str]]

Return type:

Dict[str, Any]

get_metadata()[source]

Get agent metadata.

Return type:

Dict[str, Any]

Returns:

Metadata including name, version, description

abstractmethod get_tools()[source]

Return tool definitions for this agent.

Each tool should have:

  • name: str

  • description: str

  • parameters: dict (JSON schema)

Return type:

list[Dict[str, Any]]

Returns:

List of tool definitions

class aw_agents.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.MCPAdapter(agent, server_name, **server_options)[source]

Bases: object

Adapter to expose an AgentBase as an MCP server.

Usage:

agent = YourAgent()
adapter = MCPAdapter(agent, server_name="your-agent")
adapter.run_sync()

adapter.server is the py2mcp (FastMCP) server; adapter.tools the functions it serves, one per agent tool.

async run()[source]

Run the MCP server over stdio (awaitable).

run_sync()[source]

Run the MCP server over stdio (blocking).

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

Bases: object

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='0.0.0.0', port=8000, **kwargs)[source]

Run the FastAPI server.

Parameters:
  • host (str) – Host to bind to

  • port (int) – Port to bind to

  • **kwargs – Additional uvicorn arguments

class aw_agents.ToolExecutionResult(success, data=None, message=None, warnings=None, metadata=None)[source]

Bases: object

Standard result format for tool execution.

classmethod error_result(message, data=None, **kwargs)[source]

Create an error result.

Return type:

ToolExecutionResult

classmethod success_result(data, message=None, **kwargs)[source]

Create a success result.

Return type:

ToolExecutionResult

to_dict()[source]

Convert to dictionary format.

Return type:

Dict[str, Any]

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

Generate an API server script for an agent.

Parameters:
  • agent_class – Agent class to wrap

  • output_path (Path) – Path to write the script

  • default_port (int) – Default port for the server

aw_agents.create_json_schema(properties, required=None, **kwargs)[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
Return type:

Dict[str, Any]

aw_agents.create_mcp_server_script(agent_class, server_name, output_path)[source]

Generate an MCP server script for an agent.

Parameters:
  • agent_class – Agent class to wrap

  • server_name (str) – Name for the MCP server

  • output_path (Path) – Path to write the script

Modules

adapters

Adapters for exposing agents to different platforms.

agents

Agents for agentic workflows.

base

Base classes and protocols for AW agents.

util

Utils for aw_agents