> built 2026-11-24 01:07 UTC from b69b86d (main) · aw_agents 0.1.5. Details: build_info.json

# index.html.md

<!-- generated by epythet -->

# aw-agents

**AI Agents for Agentic Workflows** - Easily deploy AI agents to multiple chatbot platforms (Claude, ChatGPT, and more).

## Overview

`aw-agents` provides a unified framework for building AI agents and deploying them to different chatbot platforms with minimal boilerplate. Write your agent once, deploy everywhere.

### Key Features

- 🎯 **Write Once, Deploy Everywhere**: Single agent implementation works with Claude, ChatGPT, and future platforms
- 🔌 **Pluggable Adapters**: MCP for Claude, OpenAPI for ChatGPT
- 📦 **Batteries Included**: Built-in download agent with smart features
- 🛠️ **Easy to Extend**: Simple base class for creating new agents
- 🎨 **Clean Architecture**: Separation of agent logic and platform adapters
- 🚀 **Run as Script**: Each agent can run directly as a server with built-in setup instructions

## Documentation

- 📚 **[Quick Usage Guide]()** - Simplest way to run agents
- 📖 **[This README]()** - Comprehensive documentation
- 💻 **[Examples]()** - Code examples

## Installation

```bash
# From source (recommended for development)
git clone https://github.com/addaix/aw_agents.git
cd aw_agents
pip install -e .

# With Claude Desktop support (MCP)
pip install -e .[mcp]

# With ChatGPT Custom GPT support (FastAPI)
pip install -e .[api]

# With all features
pip install -e .[all]

# For development
pip install -e .[dev]
```

### Verify Installation

```bash
# Test the installation
python -c "from aw_agents.agents.download import DownloadAgent; agent = DownloadAgent(); print('✓ Installation successful!')"
```

## Quick Start

### Easiest Way: Run Agent as Server

Each agent can be run directly as a server with built-in instructions:

```bash
# For Claude Desktop (MCP server)
python -m aw_agents.agents.download.agent --mcp

# For ChatGPT (FastAPI server)
python -m aw_agents.agents.download.agent --api

# With ngrok for remote access
python -m aw_agents.agents.download.agent --api --server-url https://your-ngrok-url.ngrok.io
```

The agent will print:

- ✅ Configuration snippets (copy-paste ready)
- 📍 Exact file locations for configs
- 📋 Step-by-step setup instructions
- 🚀 Everything you need to get started
- 🌐 Proper OpenAPI schema with server URLs (fixes ChatGPT import issues)

### Using the Download Agent

The package includes a smart download agent out of the box:

```python
from aw_agents.agents.download import DownloadAgent

agent = DownloadAgent()

# Get available tools
tools = agent.get_tools()
print([t["name"] for t in tools])
# ['download_content', 'download_multiple', 'list_downloads']

# Execute a tool
result = agent.execute_tool(
    "download_content",
    {"url": "https://arxiv.org/pdf/2103.00020.pdf", "context": "Important ML Paper"},
)

print(result["data"]["path"])  # ~/Downloads/Important_ML_Paper.pdf
```

### Deploy to Claude Desktop (MCP)

**Quick Start - Run the agent directly:**

```bash
# The agent will automatically configure Claude Desktop for you!
python -m aw_agents.agents.download.agent --mcp

# Or run directly:
python aw_agents/agents/download/agent.py --mcp
```

The agent will:

- **Automatically add itself to your Claude Desktop config**
- Start the MCP server
- Give you step-by-step instructions
- You just need to restart Claude Desktop!

**Managing Claude Desktop Configuration:**

The agent uses `claude_desktop_config()` from the `aw` package to automatically manage your Claude Desktop configuration:

```python
from aw.util import claude_desktop_config

# View all configured MCP servers
mcp = claude_desktop_config()
list(mcp)  # ['download', 'other_server', ...]

# Add a new server manually
mcp["my_agent"] = {"command": "python", "args": ["/path/to/my_agent.py"]}

# Remove a server
del mcp["old_server"]

# View a server's config
print(mcp["download"])
```

**Manual Setup (Alternative):**

If you prefer to create your own script and manage configuration manually:

**Step 1: Create MCP Server Script**

```python
from aw_agents.agents.download import DownloadAgent
from aw_agents.adapters import MCPAdapter

agent = DownloadAgent()
adapter = MCPAdapter(agent, "download-agent")

# This starts an MCP server for Claude Desktop
if __name__ == "__main__":
    adapter.run_sync()
```

Save this as `mcp_download.py` or use the deployment script:

```bash
python scripts/deploy_mcp.py DownloadAgent --output mcp_download.py
```

**Step 2: Configure Claude Desktop**

Using `claude_desktop_config()`:

```python
from aw.util import claude_desktop_config

mcp = claude_desktop_config()
mcp["download"] = {"command": "python", "args": ["/absolute/path/to/mcp_download.py"]}
```

Or manually edit the config file:

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`

**Important**: Use absolute paths, not `~/` or relative paths.

**Step 3: Restart Claude Desktop**

Completely quit and restart Claude Desktop.

**Step 4: Test It**

Ask Claude:

```default
Download this paper for me: https://arxiv.org/pdf/2103.00020.pdf
Context: "Attention is All You Need"
```

**Troubleshooting**:

- Check logs: `~/Library/Logs/Claude/` (macOS)
- Verify Python path in config
- Ensure dependencies are installed in the correct Python environment

### Deploy to ChatGPT Custom GPT (FastAPI)

**Quick Start - Run the agent directly:**

```bash
# The agent will print setup instructions for you
python -m aw_agents.agents.download.agent --api

# Or specify a custom port:
python aw_agents/agents/download/agent.py --api --port 8080
```

The agent will:

- Start the FastAPI server
- Print the server URLs (API, docs, OpenAPI schema)
- Show you exactly how to configure ChatGPT Custom GPT
- Provide ngrok instructions for remote access

**Manual Setup (Alternative):**

**Step 1: Create and Start API Server**

```python
from aw_agents.agents.download import DownloadAgent
from aw_agents.adapters import OpenAPIAdapter

agent = DownloadAgent()
adapter = OpenAPIAdapter(agent, title="Download Agent API")

# This starts a FastAPI server
if __name__ == "__main__":
    adapter.run(port=8000)
```

Save this as `api_download.py` or use the deployment script:

```bash
python scripts/deploy_api.py DownloadAgent --output api_download.py
python api_download.py  # Start the server
```

The server will be available at http://localhost:8000

**Step 2: Create Custom GPT**

1. Go to https://chat.openai.com/gpts/editor
2. Click “Create a GPT”
3. Name it (e.g., “Download Assistant”)
4. Add instructions:
   ```default
   You help users download files from URLs. Use the download_content 
   action when users provide URLs. Always ask for context to generate 
   good filenames. You can download multiple files at once and list 
   previously downloaded files.
   ```

**Step 3: Add Actions**

1. In the GPT editor, go to “Configure” → “Actions”
2. Click “Create new action”
3. Import schema from: `http://localhost:8000/openapi.json`
4. Click “Add Action”

**Step 4: Test Your GPT**

Ask your Custom GPT:

```default
Download this dataset: https://github.com/user/repo/blob/main/data.csv
Context: "Sales Data Q4"
```

**Important Notes**:

- **Local Testing**: ChatGPT servers can’t access `localhost` from OpenAI’s infrastructure
- **For Remote Access**:
  - Use ngrok: `ngrok http 8000` (provides a public URL)
  - Deploy to cloud service (AWS, GCP, Azure, Heroku)
  - Use local network IP if on the same network

**Production Deployment**:

1. Deploy to cloud service with HTTPS
2. Add authentication (API keys, OAuth)
3. Update Custom GPT actions with public URL

## Architecture

```default
aw_agents/
├── base.py              # AgentBase, ToolExecutionResult
├── adapters/
│   ├── mcp.py          # MCPAdapter for Claude
│   └── openapi.py      # OpenAPIAdapter for ChatGPT
└── download/           # Download agent implementation
    ├── agent.py        # DownloadAgent (AgentBase subclass)
    └── download_core.py # Core download logic
```

### Creating Your Own Agent

```python
from aw_agents.base import AgentBase, ToolExecutionResult, create_json_schema


class MyAgent(AgentBase):
    """My custom agent."""

    def get_tools(self):
        return [
            {
                "name": "my_tool",
                "description": "Does something useful",
                "parameters": create_json_schema(
                    properties={
                        "input": {"type": "string", "description": "Input text"}
                    },
                    required=["input"],
                ),
            }
        ]

    def execute_tool(self, name, arguments):
        if name == "my_tool":
            # Your logic here
            result = self._process(arguments["input"])

            return ToolExecutionResult.success_result(
                data={"output": result}, message="Processed successfully"
            ).to_dict()

        return ToolExecutionResult.error_result(
            message=f"Unknown tool: {name}"
        ).to_dict()

    def _process(self, input_text):
        # Your implementation
        return input_text.upper()
```

Then deploy it:

```python
# For Claude
from aw_agents.adapters import MCPAdapter

adapter = MCPAdapter(MyAgent(), "my-agent")
adapter.run_sync()

# For ChatGPT
from aw_agents.adapters import OpenAPIAdapter

adapter = OpenAPIAdapter(MyAgent())
adapter.run(port=8001)
```

## Included Agents

### Download Agent

Smart content downloader with:

- **Landing page detection**: Automatically finds actual download links
- **Context-aware file naming**: Uses conversation context for meaningful filenames
- **Special handling for**:
  - GitHub (converts blob URLs to raw)
  - HuggingFace (handles dataset downloads)
  - Kaggle datasets
  - Academic papers (arXiv, etc.)
- **Support for**: PDFs, datasets, CSV, JSON, and more

**Tools:**

- `download_content` - Download a single URL with smart handling
- `download_multiple` - Download multiple URLs at once
- `list_downloads` - List downloaded files

**Examples:**

```python
from aw_agents.agents.download import DownloadAgent

agent = DownloadAgent()

# Download with context-aware naming
result = agent.execute_tool(
    "download_content",
    {
        "url": "https://github.com/user/repo/blob/main/data.csv",
        "context": "Dataset for analysis",
    },
)
# Automatically converts to raw.githubusercontent.com
# Saves as: Dataset_for_analysis.csv

# Download multiple files
result = agent.execute_tool(
    "download_multiple",
    {
        "urls": [
            "https://arxiv.org/pdf/2103.00020.pdf",
            "https://arxiv.org/pdf/1706.03762.pdf",
        ],
        "contexts": ["Attention Paper", "Transformer Original"],
    },
)

# List downloaded PDFs
result = agent.execute_tool("list_downloads", {"pattern": "*.pdf"})
```

**Smart Features:**

1. **Intelligent Extension Detection**:
   ```python
   # Priority-based routing handles edge cases correctly
   agent.execute_tool(
       "download_content",
       {"url": "https://arxiv.org/pdf/2103.00020.pdf", "context": "ML Paper"},
   )
   # Result: ML_Paper.pdf ✓ (not .html despite Content-Type header)

   # Explicit extension override
   agent.execute_tool(
       "download_content",
       {
           "url": "https://example.com/ambiguous_file",
           "context": "Data",
           "explicit_extension": "csv",
       },
   )
   # Result: Data.csv
   ```
2. **Landing Page Detection**:
   ```python
   # Input: Landing page URL
   agent.execute_tool(
       "download_content",
       {"url": "https://papers.nips.cc/paper/2017/hash/xxx-Abstract.html"},
   )
   # Agent detects HTML, finds PDF link, downloads PDF, warns about redirect
   ```
3. **GitHub URL Handling**:
   ```python
   # Input: GitHub blob URL
   "https://github.com/user/repo/blob/main/data.csv"

   # Converts to:
   "https://raw.githubusercontent.com/user/repo/main/data.csv"
   ```
4. **Context-Aware Naming**:
   ```python
   # Without context:
   # Filename: 2103.00020.pdf

   # With context:
   agent.execute_tool(
       "download_content",
       {
           "url": "https://arxiv.org/pdf/2103.00020.pdf",
           "context": "Attention is All You Need - Transformer Paper",
       },
   )
   # Filename: Attention_is_All_You_Need_Transformer_Paper.pdf
   ```

### Customizing Extension Detection

The download agent uses configurable routing from the `aw.routing` module:

```python
from aw.routing import ExtensionRouter
from aw_agents.agents.download import DownloadEngine

# Inspect default mappings
router = ExtensionRouter()
print(router.content_type_map)
print(router.priority_extensions)

# Customize mappings
router.content_type_map["text/x-log"] = ".log"


# Add custom detection strategy
def detect_special(ctx):
    if "special" in ctx.url:
        return ".special"
    return None


custom_router = router.with_prepended_strategy(detect_special)

# Use in agent
engine = DownloadEngine(extension_router=custom_router)
```

See [EXTENSION_ROUTING_SUMMARY.md]() for details.

## Integration Guides

### Claude Desktop Integration

**Easiest Way - Automatic Configuration:**

```bash
# Run the agent - it will automatically configure Claude Desktop!
python -m aw_agents.agents.download.agent --mcp
```

The agent automatically adds itself to your Claude Desktop config. Just restart Claude Desktop and you’re done!

**Alternative - Manual Configuration:**

1. Create MCP server script:
   ```bash
   python scripts/deploy_mcp.py DownloadAgent --output ~/mcp_download.py
   ```
2. Add to Claude Desktop config using `claude_desktop_config()`:
   ```python
   from aw.util import claude_desktop_config

   mcp = claude_desktop_config()
   mcp["download"] = {"command": "python", "args": ["/absolute/path/to/mcp_download.py"]}
   ```
3. Restart Claude Desktop

**Managing Servers:**

```python
from aw.util import claude_desktop_config

mcp = claude_desktop_config()

# List all servers
list(mcp)  # ['download', 'other_server', ...]

# View a server's config
print(mcp["download"])

# Remove a server
del mcp["old_server"]
```

**Config file locations:**

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`

**Usage Examples in Claude:**

```default
Download this paper: https://arxiv.org/pdf/2103.00020.pdf
Context: "Attention is All You Need paper"

I need these papers:
1. https://arxiv.org/pdf/2103.00020.pdf - "Attention Paper"
2. https://arxiv.org/pdf/1706.03762.pdf - "Transformer Original"

Show me what PDFs I've downloaded
```

### ChatGPT Custom GPT Integration

1. Create API server script:
   ```bash
   python scripts/deploy_api.py DownloadAgent --output ~/api_download.py
   python ~/api_download.py
   ```
2. Create Custom GPT at https://chat.openai.com/gpts/editor
3. Add actions using schema from: `http://localhost:8000/openapi.json`
4. For remote access, deploy to cloud or use ngrok:
   ```bash
   ngrok http 8000
   ```

**Usage Examples in ChatGPT:**

```default
Download this dataset: https://github.com/user/repo/blob/main/data.csv
Context: "Sales Data Q4 2024"

Can you download these research papers for me?
[List of URLs with contexts]
```

## Troubleshooting

### Installation Issues

**Problem**: Module not found errors

**Solution**:

```bash
# Update pip and reinstall
pip install --upgrade pip
pip uninstall aw-agents
pip install -e .[all]
```

**Problem**: Missing dependencies

**Solution**:

```bash
# Install specific feature sets
pip install -e .[mcp]    # For Claude
pip install -e .[api]    # For ChatGPT
pip install -e .[all]    # Everything
```

### Claude Desktop Issues

**Problem**: Claude doesn’t see the download tools

**Solution**:

1. Verify config file location (see paths above)
2. Use absolute path in config (not `~/` or `./`)
3. Check logs: `~/Library/Logs/Claude/` (macOS)
4. Restart Claude Desktop completely (Quit, not just close window)
5. Verify Python environment: `which python`

**Problem**: “Module not found” when Claude tries to use agent

**Solution**:

```bash
# Install in the Python environment Claude uses
which python  # Check which Python Claude is using
# Use that Python to install dependencies
/path/to/python -m pip install mcp requests beautifulsoup4 graze
```

### ChatGPT Custom GPT Issues

**Problem**: Actions can’t connect to localhost

**Solution**:

- ChatGPT servers can’t access `localhost` from OpenAI’s infrastructure
- Options:
  1. **For testing**: Use ngrok to expose local server
     ```bash
     ngrok http 8000
     # Use the ngrok URL in your Custom GPT actions
     ```
  2. **For production**: Deploy to cloud service (AWS, GCP, Azure, Heroku)
  3. **Same network**: Use your local IP address

**Problem**: Schema import fails

**Solution**:

1. Ensure server is running: `curl http://localhost:8000/openapi.json`
2. Check for CORS issues (FastAPI handles this by default)
3. Try manual schema paste instead of URL import

### General Issues

**Problem**: Downloads failing

**Solution**:

1. Check internet connection
2. Verify URL is accessible: `curl -I [URL]`
3. Some sites may block automated downloads
4. Check download directory permissions

**Problem**: Import errors in Python

**Solution**:

```bash
# Verify installation
python -c "from aw_agents.agents.download import DownloadAgent; print('✓ Success')"

# Reinstall if needed
pip install -e .[all]
```

## Development

### Running Tests

```bash
pytest
```

### Code Quality

```bash
# Format code
black aw_agents tests

# Lint
ruff aw_agents tests

# Type check
mypy aw_agents
```

### Adding a New Agent

1. Create a new directory in `aw_agents/`:
   ```default
   aw_agents/myagent/
   ├── __init__.py
   ├── agent.py
   └── core.py (if needed)
   ```
2. Implement `AgentBase` in `agent.py`
3. Add to `aw_agents/__init__.py`:
   ```python
   from aw_agents.myagent import MyAgent

   __all__.append("MyAgent")
   ```
4. Create tests in `tests/test_myagent.py`
5. Update documentation

## Roadmap

- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">Additional built-in agents (research, data prep, etc.)
- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">Support for more platforms (Slack, Discord, etc.)
- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">Agent composition and chaining
- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">Persistent state management
- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">Authentication and authorization
- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">Web UI for agent management
- <input class="task-list-item-checkbox" disabled="disabled" type="checkbox">CLI tools for deployment

## Contributing

Contributions welcome! Please:

1. Fork the repo
2. Create a feature branch
3. Add tests for new features
4. Ensure all tests pass
5. Submit a pull request

## License

MIT License - see LICENSE file for details

## Credits

Built with:

- [dol](https://github.com/i2mint/dol) - Storage abstractions
- [graze](https://github.com/thorwhalen/graze) - Download and caching
- [MCP](https://modelcontextprotocol.io/) - Model Context Protocol
- [FastAPI](https://fastapi.tiangolo.com/) - Modern web framework

Part of the [thorwhalen](https://github.com/thorwhalen) ecosystem.

<p class="epythet-aggregates">This documentation as a single file: <a href="aw_agents.md">aw_agents.md</a> (Markdown, for agents).</p>


# _autosummary/aw_agents.adapters.html.md

# aw_agents.adapters

Adapters for exposing agents to different platforms.

### Functions

| [`create_mcp_server_script`](_autosummary/aw_agents.adapters.html.md#aw_agents.adapters.create_mcp_server_script)(agent_class, ...)        | Generate an MCP server script for an agent.   |
|----------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [`create_api_server_script`](_autosummary/aw_agents.adapters.html.md#aw_agents.adapters.create_api_server_script)(agent_class, ...[, ...]) | Generate an API server script for an agent.   |

### Classes

| [`MCPAdapter`](_autosummary/aw_agents.adapters.html.md#aw_agents.adapters.MCPAdapter)(agent, server_name, \*\*server_options)   | Adapter to expose an AgentBase as an MCP server.             |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| [`OpenAPIAdapter`](_autosummary/aw_agents.adapters.html.md#aw_agents.adapters.OpenAPIAdapter)(agent, \*[, title, ...])              | Adapter to expose an AgentBase as a FastAPI/OpenAPI service. |

### *class* aw_agents.adapters.MCPAdapter(agent, server_name, \*\*server_options)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Adapter to expose an AgentBase as an MCP server.

Usage:

```default
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()

Run the MCP server over stdio (awaitable).

#### run_sync()

Run the MCP server over stdio (blocking).

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

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

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

Usage:

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

#### run(host='0.0.0.0', port=8000, \*\*kwargs)

Run the FastAPI server.

* **Parameters:**
  * **host** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Host to bind to
  * **port** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Port to bind to
  * **\*\*kwargs** – Additional uvicorn arguments

### aw_agents.adapters.create_api_server_script(agent_class, output_path, , default_port=8000)

Generate an API server script for an agent.

* **Parameters:**
  * **agent_class** – Agent class to wrap
  * **output_path** ([`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)) – Path to write the script
  * **default_port** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Default port for the server

### aw_agents.adapters.create_mcp_server_script(agent_class, server_name, output_path)

Generate an MCP server script for an agent.

* **Parameters:**
  * **agent_class** – Agent class to wrap
  * **server_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name for the MCP server
  * **output_path** ([`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)) – Path to write the script

### Modules

| [`mcp`](_autosummary/aw_agents.adapters.mcp.html.md#module-aw_agents.adapters.mcp)         | MCP (Model Context Protocol) adapter for AW agents.   |
|--------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [`openapi`](_autosummary/aw_agents.adapters.openapi.html.md#module-aw_agents.adapters.openapi) | OpenAPI/FastAPI adapter for AW agents.                |


# _autosummary/aw_agents.adapters.mcp.html.md

# aw_agents.adapters.mcp

MCP (Model Context Protocol) adapter for AW agents.

This adapter wraps any AgentBase subclass to expose it as an MCP server for use with
Claude Desktop. The server is built by `py2mcp` (the fleet’s MCP surface adapter, the
same builder every other fleet MCP server goes through): each agent tool becomes one
function whose signature is derived from the tool’s JSON schema, and
`py2mcp.mk_mcp_server()` turns those functions into a FastMCP server.

### Functions

| [`create_mcp_server_script`](_autosummary/aw_agents.adapters.mcp.html.md#aw_agents.adapters.mcp.create_mcp_server_script)(agent_class, ...)   | Generate an MCP server script for an agent.   |
|-----------------------------------------------------------------------------------------------|-----------------------------------------------|

### Classes

| [`MCPAdapter`](_autosummary/aw_agents.adapters.mcp.html.md#aw_agents.adapters.mcp.MCPAdapter)(agent, server_name, \*\*server_options)   | Adapter to expose an AgentBase as an MCP server.   |
|-------------------------------------------------------------------------------------------------------|----------------------------------------------------|

### *class* aw_agents.adapters.mcp.MCPAdapter(agent, server_name, \*\*server_options)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Adapter to expose an AgentBase as an MCP server.

Usage:

```default
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()

Run the MCP server over stdio (awaitable).

#### run_sync()

Run the MCP server over stdio (blocking).

### aw_agents.adapters.mcp.create_mcp_server_script(agent_class, server_name, output_path)

Generate an MCP server script for an agent.

* **Parameters:**
  * **agent_class** – Agent class to wrap
  * **server_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name for the MCP server
  * **output_path** ([`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)) – Path to write the script


# _autosummary/aw_agents.adapters.openapi.html.md

# aw_agents.adapters.openapi

OpenAPI/FastAPI adapter for AW agents.

This adapter wraps any AgentBase subclass to expose it as a REST API
with OpenAPI spec for use with ChatGPT Custom GPTs.

### Functions

| [`create_api_server_script`](_autosummary/aw_agents.adapters.openapi.html.md#aw_agents.adapters.openapi.create_api_server_script)(agent_class, ...[, ...])   | Generate an API server script for an agent.   |
|------------------------------------------------------------------------------------------------------|-----------------------------------------------|

### Classes

| [`OpenAPIAdapter`](_autosummary/aw_agents.adapters.openapi.html.md#aw_agents.adapters.openapi.OpenAPIAdapter)(agent, \*[, title, ...])   | Adapter to expose an AgentBase as a FastAPI/OpenAPI service.   |
|--------------------------------------------------------------------------------------------|----------------------------------------------------------------|

### *class* aw_agents.adapters.openapi.OpenAPIAdapter(agent, , title='AI Agent API', description='AI Agent exposed via OpenAPI', version='1.0.0', server_url=None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

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

Usage:

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

#### run(host='0.0.0.0', port=8000, \*\*kwargs)

Run the FastAPI server.

* **Parameters:**
  * **host** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Host to bind to
  * **port** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Port to bind to
  * **\*\*kwargs** – Additional uvicorn arguments

### aw_agents.adapters.openapi.create_api_server_script(agent_class, output_path, , default_port=8000)

Generate an API server script for an agent.

* **Parameters:**
  * **agent_class** – Agent class to wrap
  * **output_path** ([`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)) – Path to write the script
  * **default_port** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Default port for the server


# _autosummary/aw_agents.agents.download.agent.html.md

# aw_agents.agents.download.agent

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

This agent wraps the core download functionality and exposes it through
the AgentBase interface for use with multiple chatbot platforms.

### Functions

| [`main`](_autosummary/aw_agents.agents.download.agent.html.md#aw_agents.agents.download.agent.main)()   | Main entry point for running the agent as a server.   |
|-----------------------------------------------------------|-------------------------------------------------------|

### Classes

| [`DownloadAgent`](_autosummary/aw_agents.agents.download.agent.html.md#aw_agents.agents.download.agent.DownloadAgent)([default_download_dir])   | Smart download agent with context-aware naming and intelligent link handling.   |
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|

### *class* aw_agents.agents.download.agent.DownloadAgent(default_download_dir=None, \*\*kwargs)

Bases: [`AgentBase`](_autosummary/aw_agents.base.html.md#aw_agents.base.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

```pycon
>>> agent = DownloadAgent()
>>> tools = agent.get_tools()
>>> len(tools) >= 3
True
```

#### execute_tool(name, arguments)

Execute a tool with given arguments.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_metadata()

Get agent metadata.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_tools()

Return tool definitions for this agent.

* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]

### aw_agents.agents.download.agent.main()

Main entry point for running the agent as a server.


# _autosummary/aw_agents.agents.download.download_core.html.md

# 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

| [`download_content`](_autosummary/aw_agents.agents.download.download_core.html.md#aw_agents.agents.download.download_core.download_content)(url, \*[, context, download_dir])   | Convenience function to download a single URL and return the path.   |
|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|

### Classes

| [`DownloadEngine`](_autosummary/aw_agents.agents.download.download_core.html.md#aw_agents.agents.download.download_core.DownloadEngine)([default_download_dir, ...])   | 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)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

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

```pycon
>>> 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)

Download content from a URL with smart handling.

* **Parameters:**
  * **url** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – URL to download from
  * **context** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Context about the content (used for filename generation)
  * **download_dir** ([`Union`](https://docs.python.org/3/library/typing.html#typing.Union)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path), [`None`](https://docs.python.org/3/builtins/constants.html#None)]) – Directory to download to (default: self.default_download_dir)
  * **filename** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Override automatic filename generation
  * **force_redownload** ([`bool`](https://docs.python.org/3/builtins/functions.html#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`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### Example

```pycon
>>> engine = DownloadEngine()
>>> # result = engine.download("https://example.com/paper.pdf", context="ML Paper")
>>> # print(result['path'])
```

#### download_multiple(urls, , contexts=None, download_dir=None)

Download multiple URLs.

* **Parameters:**
  * **urls** ([`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – List of URLs to download
  * **contexts** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Optional list of contexts (same length as urls)
  * **download_dir** ([`Union`](https://docs.python.org/3/library/typing.html#typing.Union)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path), [`None`](https://docs.python.org/3/builtins/constants.html#None)]) – Directory to download to
* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]
* **Returns:**
  List of result dictionaries (one per URL)

### aw_agents.agents.download.download_core.download_content(url, , context=None, download_dir=None)

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

### Example

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

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)


# _autosummary/aw_agents.agents.download.html.md

# aw_agents.agents.download

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

### Functions

| [`download_content`](_autosummary/aw_agents.agents.download.html.md#aw_agents.agents.download.download_content)(url, \*[, context, download_dir])   | Convenience function to download a single URL and return the path.   |
|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|

### Classes

| [`DownloadAgent`](_autosummary/aw_agents.agents.download.html.md#aw_agents.agents.download.DownloadAgent)([default_download_dir])       | Smart download agent with context-aware naming and intelligent link handling.   |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`DownloadEngine`](_autosummary/aw_agents.agents.download.html.md#aw_agents.agents.download.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)

Bases: [`AgentBase`](_autosummary/aw_agents.base.html.md#aw_agents.base.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

```pycon
>>> agent = DownloadAgent()
>>> tools = agent.get_tools()
>>> len(tools) >= 3
True
```

#### execute_tool(name, arguments)

Execute a tool with given arguments.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_metadata()

Get agent metadata.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_tools()

Return tool definitions for this agent.

* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]

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

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

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

```pycon
>>> 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)

Download content from a URL with smart handling.

* **Parameters:**
  * **url** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – URL to download from
  * **context** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Context about the content (used for filename generation)
  * **download_dir** ([`Union`](https://docs.python.org/3/library/typing.html#typing.Union)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path), [`None`](https://docs.python.org/3/builtins/constants.html#None)]) – Directory to download to (default: self.default_download_dir)
  * **filename** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – Override automatic filename generation
  * **force_redownload** ([`bool`](https://docs.python.org/3/builtins/functions.html#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`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### Example

```pycon
>>> engine = DownloadEngine()
>>> # result = engine.download("https://example.com/paper.pdf", context="ML Paper")
>>> # print(result['path'])
```

#### download_multiple(urls, , contexts=None, download_dir=None)

Download multiple URLs.

* **Parameters:**
  * **urls** ([`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]) – List of URLs to download
  * **contexts** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional)[[`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]]) – Optional list of contexts (same length as urls)
  * **download_dir** ([`Union`](https://docs.python.org/3/library/typing.html#typing.Union)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path), [`None`](https://docs.python.org/3/builtins/constants.html#None)]) – Directory to download to
* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]
* **Returns:**
  List of result dictionaries (one per URL)

### aw_agents.agents.download.download_content(url, , context=None, download_dir=None)

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

### Example

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

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### Modules

| [`agent`](_autosummary/aw_agents.agents.download.agent.html.md#module-aw_agents.agents.download.agent)                 | Download Agent - Smart content downloader with context-aware naming.                              |
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`download_core`](_autosummary/aw_agents.agents.download.download_core.html.md#module-aw_agents.agents.download.download_core) | Download Agent: Smart content downloader with context-aware naming and intelligent link handling. |


# _autosummary/aw_agents.agents.html.md

# aw_agents.agents

Agents for agentic workflows.

This module contains various AI agents that can be deployed to chatbot platforms.

### Classes

| [`DownloadAgent`](_autosummary/aw_agents.agents.html.md#aw_agents.agents.DownloadAgent)([default_download_dir])   | Smart download agent with context-aware naming and intelligent link handling.   |
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|

### *class* aw_agents.agents.DownloadAgent(default_download_dir=None, \*\*kwargs)

Bases: [`AgentBase`](_autosummary/aw_agents.base.html.md#aw_agents.base.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

```pycon
>>> agent = DownloadAgent()
>>> tools = agent.get_tools()
>>> len(tools) >= 3
True
```

#### execute_tool(name, arguments)

Execute a tool with given arguments.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_metadata()

Get agent metadata.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_tools()

Return tool definitions for this agent.

* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]

### Modules

| [`download`](_autosummary/aw_agents.agents.download.html.md#module-aw_agents.agents.download)   | Download Agent - Smart content downloader with context-aware naming.   |
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------|


# _autosummary/aw_agents.base.html.md

# aw_agents.base

Base classes and protocols for AW agents.

This module provides the foundation for building AI agents that can be
deployed to multiple chatbot platforms (Claude, ChatGPT, etc.).

### Functions

| [`create_json_schema`](_autosummary/aw_agents.base.html.md#aw_agents.base.create_json_schema)(properties[, required])   | Helper to create JSON schema for tool parameters.   |
|-----------------------------------------------------------------------------------------------|-----------------------------------------------------|

### Classes

| [`AgentBase`](_autosummary/aw_agents.base.html.md#aw_agents.base.AgentBase)()                               | Base class for all AW agents.              |
|--------------------------------------------------------------------------------------------|--------------------------------------------|
| [`ToolExecutionResult`](_autosummary/aw_agents.base.html.md#aw_agents.base.ToolExecutionResult)(success[, data, ...]) | Standard result format for tool execution. |

### *class* aw_agents.base.AgentBase

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.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)

Execute a tool with given arguments.

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Tool name
  * **arguments** ([`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]) – Tool arguments
* **Returns:**
  - success: bool
  - data: Any
  - message: Optional[str]
  - warnings: Optional[list[str]]
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_metadata()

Get agent metadata.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Metadata including name, version, description

#### *abstractmethod* get_tools()

Return tool definitions for this agent.

Each tool should have:

- name: str
- description: str
- parameters: dict (JSON schema)

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]
* **Returns:**
  List of tool definitions

### *class* aw_agents.base.ToolExecutionResult(success, data=None, message=None, warnings=None, metadata=None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Standard result format for tool execution.

#### *classmethod* error_result(message, data=None, \*\*kwargs)

Create an error result.

* **Return type:**
  [`ToolExecutionResult`](_autosummary/aw_agents.base.html.md#aw_agents.base.ToolExecutionResult)

#### *classmethod* success_result(data, message=None, \*\*kwargs)

Create a success result.

* **Return type:**
  [`ToolExecutionResult`](_autosummary/aw_agents.base.html.md#aw_agents.base.ToolExecutionResult)

#### to_dict()

Convert to dictionary format.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### aw_agents.base.create_json_schema(properties, required=None, \*\*kwargs)

Helper to create JSON schema for tool parameters.

```pycon
>>> 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`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]


# _autosummary/aw_agents.html.md

# 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

```pycon
>>> 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`](_autosummary/aw_agents.html.md#aw_agents.create_json_schema)(properties[, required])        | Helper to create JSON schema for tool parameters.   |
|----------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [`create_mcp_server_script`](_autosummary/aw_agents.html.md#aw_agents.create_mcp_server_script)(agent_class, ...)        | Generate an MCP server script for an agent.         |
| [`create_api_server_script`](_autosummary/aw_agents.html.md#aw_agents.create_api_server_script)(agent_class, ...[, ...]) | Generate an API server script for an agent.         |

### Classes

| [`AgentBase`](_autosummary/aw_agents.html.md#aw_agents.AgentBase)()                                        | Base class for all AW agents.                                                 |
|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| [`ToolExecutionResult`](_autosummary/aw_agents.html.md#aw_agents.ToolExecutionResult)(success[, data, ...])          | Standard result format for tool execution.                                    |
| [`MCPAdapter`](_autosummary/aw_agents.html.md#aw_agents.MCPAdapter)(agent, server_name, \*\*server_options) | Adapter to expose an AgentBase as an MCP server.                              |
| [`OpenAPIAdapter`](_autosummary/aw_agents.html.md#aw_agents.OpenAPIAdapter)(agent, \*[, title, ...])            | Adapter to expose an AgentBase as a FastAPI/OpenAPI service.                  |
| [`DownloadAgent`](_autosummary/aw_agents.html.md#aw_agents.DownloadAgent)([default_download_dir])              | Smart download agent with context-aware naming and intelligent link handling. |

### *class* aw_agents.AgentBase

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.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)

Execute a tool with given arguments.

* **Parameters:**
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Tool name
  * **arguments** ([`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]) – Tool arguments
* **Returns:**
  - success: bool
  - data: Any
  - message: Optional[str]
  - warnings: Optional[list[str]]
* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_metadata()

Get agent metadata.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]
* **Returns:**
  Metadata including name, version, description

#### *abstractmethod* get_tools()

Return tool definitions for this agent.

Each tool should have:

- name: str
- description: str
- parameters: dict (JSON schema)

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]
* **Returns:**
  List of tool definitions

### *class* aw_agents.DownloadAgent(default_download_dir=None, \*\*kwargs)

Bases: [`AgentBase`](_autosummary/aw_agents.base.html.md#aw_agents.base.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

```pycon
>>> agent = DownloadAgent()
>>> tools = agent.get_tools()
>>> len(tools) >= 3
True
```

#### execute_tool(name, arguments)

Execute a tool with given arguments.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_metadata()

Get agent metadata.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### get_tools()

Return tool definitions for this agent.

* **Return type:**
  [`List`](https://docs.python.org/3/library/typing.html#typing.List)[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]

### *class* aw_agents.MCPAdapter(agent, server_name, \*\*server_options)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Adapter to expose an AgentBase as an MCP server.

Usage:

```default
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()

Run the MCP server over stdio (awaitable).

#### run_sync()

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)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

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

Usage:

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

#### run(host='0.0.0.0', port=8000, \*\*kwargs)

Run the FastAPI server.

* **Parameters:**
  * **host** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Host to bind to
  * **port** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Port to bind to
  * **\*\*kwargs** – Additional uvicorn arguments

### *class* aw_agents.ToolExecutionResult(success, data=None, message=None, warnings=None, metadata=None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Standard result format for tool execution.

#### *classmethod* error_result(message, data=None, \*\*kwargs)

Create an error result.

* **Return type:**
  [`ToolExecutionResult`](_autosummary/aw_agents.base.html.md#aw_agents.base.ToolExecutionResult)

#### *classmethod* success_result(data, message=None, \*\*kwargs)

Create a success result.

* **Return type:**
  [`ToolExecutionResult`](_autosummary/aw_agents.base.html.md#aw_agents.base.ToolExecutionResult)

#### to_dict()

Convert to dictionary format.

* **Return type:**
  [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### aw_agents.create_api_server_script(agent_class, output_path, , default_port=8000)

Generate an API server script for an agent.

* **Parameters:**
  * **agent_class** – Agent class to wrap
  * **output_path** ([`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)) – Path to write the script
  * **default_port** ([`int`](https://docs.python.org/3/builtins/functions.html#int)) – Default port for the server

### aw_agents.create_json_schema(properties, required=None, \*\*kwargs)

Helper to create JSON schema for tool parameters.

```pycon
>>> 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`](https://docs.python.org/3/library/typing.html#typing.Dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### aw_agents.create_mcp_server_script(agent_class, server_name, output_path)

Generate an MCP server script for an agent.

* **Parameters:**
  * **agent_class** – Agent class to wrap
  * **server_name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name for the MCP server
  * **output_path** ([`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)) – Path to write the script

### Modules

| [`adapters`](_autosummary/aw_agents.adapters.html.md#module-aw_agents.adapters)   | Adapters for exposing agents to different platforms.   |
|---------------------------------------------------------------------------------------|--------------------------------------------------------|
| [`agents`](_autosummary/aw_agents.agents.html.md#module-aw_agents.agents)       | Agents for agentic workflows.                          |
| [`base`](_autosummary/aw_agents.base.html.md#module-aw_agents.base)           | Base classes and protocols for AW agents.              |
| [`util`](_autosummary/aw_agents.util.html.md#module-aw_agents.util)           | Utils for aw_agents                                    |


# _autosummary/aw_agents.util.html.md

# aw_agents.util

Utils for aw_agents


# about-this-build.html.md

<!-- generated by epythet -->

# About this build

This documentation was built on **2026-11-24 01:07 UTC** from commit <a href="https://github.com/addaix/aw_agents/commit/b69b86d8a575fd1267be1412ce0201494ea0ec70"><code>b69b86d</code></a> on branch <code>main</code>, for **aw_agents 0.1.5** (from <code>pyproject.toml</code>).

#### WARNING
The documentation and the package may be misaligned:

- The documented version (0.1.5) is behind the latest release on PyPI (0.1.6): `pip install aw_agents` gives newer code than these docs describe.

## Source

|                     |                                                                                                                                                         |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| Commit              | <a href="https://github.com/addaix/aw_agents/commit/b69b86d8a575fd1267be1412ce0201494ea0ec70"><code>b69b86d8a575fd1267be1412ce0201494ea0ec70</code></a> |
| Branch              | <code>main</code>                                                                                                                                       |
| Tags at this commit | none                                                                                                                                                    |
| Working tree        | clean                                                                                                                                                   |
| Remote              | <code>https://github.com/addaix/aw_agents</code>                                                                                                        |

## Continuous integration

|              |                                                                                            |
|--------------|--------------------------------------------------------------------------------------------|
| Repository   | <code>addaix/aw_agents</code>                                                              |
| Run          | <a href="https://github.com/addaix/aw_agents/actions/runs/45302257698">45302257698</a>     |
| Ref          | <code>refs/heads/main</code>                                                               |
| Event commit | <code>b69b86d8a575fd1267be1412ce0201494ea0ec70</code> (in the history of the built commit) |

## Tools

|          |         |
|----------|---------|
| epythet  | 0.2.25  |
| Sphinx   | 9.1.1   |
| docutils | 0.22.4  |
| Python   | 3.12.16 |

## Configuration as resolved

|               |                                                                   |
|---------------|-------------------------------------------------------------------|
| theme         | <code>auto</code> (Sphinx theme <code>sphinxawesome_theme</code>) |
| accent        | <code>#006d6b</code>                                              |
| api_generator | <code>autosummary</code>                                          |
| ignore        | <code>tests/</code>, <code>scrap/</code>, <code>examples/</code>  |
| agent_outputs | <code>true</code>                                                 |
| aggregates    | <code>md</code>                                                   |
| ai_artifacts  | <code>true</code>                                                 |

## Package on PyPI

Latest release: <a href="https://pypi.org/project/aw_agents/0.1.6/">0.1.6</a>, newer than the documented version (0.1.5).

## Reproduce

```bash
git clone https://github.com/addaix/aw_agents && cd aw_agents
git checkout b69b86d8a575fd1267be1412ce0201494ea0ec70
pip install "epythet==0.2.25"
epythet quickstart . --ignore tests/ scrap/ examples/
```

The same data, for machines: <a href="build_info.json"><code>build_info.json</code></a> (schema version 1).


# ai-agents.html.md

<!-- generated by epythet -->

# For AI agents

`aw_agents` ships artifacts for coding agents alongside its code. This page lists
them, says where each lives in the repository, and points at the
machine-readable copies of this documentation.

## Skills

Skills are folders holding a `SKILL.md` (the [Agent Skills](https://agentskills.io) format): a description that tells an agent when to use it and a body with the procedure. Install one into your agent with `gh skill` (any host: `--agent claude-code`, `copilot`, `cursor`, `codex`, `gemini`), or use the copy bundled in the wheel.

### `aw-agents`

Use the aw_agents package: download content from a URL with landing-page detection and context-aware file names (DownloadAgent, DownloadEngine, download_content), serve an agent to Claude as an MCP server or to ChatGPT as an OpenAPI/FastAPI service, and write a new agent once for both (AgentBase, create_json_schema, MCPAdapter, OpenAPIAdapter). Use when someone wants to “download this dataset/paper/PDF”, “find the real download link behind a landing page”, “serve an agent to Claude Desktop”, “make a ChatGPT custom GPT action from an agent”, or “write an agent for both Claude and ChatGPT” with aw_agents.

```bash
gh skill install addaix/aw_agents aw-agents --agent claude-code
```

Source: [`aw_agents/data/skills/aw-agents`](https://github.com/addaix/aw_agents/tree/HEAD/aw_agents/data/skills/aw-agents) (bundled with the pip package).

### `aw-agents-dev`

Develop and maintain the aw_agents package: its layout (AgentBase, the MCP and OpenAPI adapters, the download agent and its engine), adding an agent or an adapter, running the tests, and releasing through wads CI. Use when changing aw_agents’ code, adding an agent under aw_agents/agents/, adding a platform adapter, fixing the download engine’s landing-page or extension handling, or cutting a release.

```bash
gh skill install addaix/aw_agents aw-agents-dev --agent claude-code
```

Source: [`aw_agents/data/skills/aw-agents-dev`](https://github.com/addaix/aw_agents/tree/HEAD/aw_agents/data/skills/aw-agents-dev) (bundled with the pip package).

The bundled skills are also on disk after `pip install aw_agents`, under the package’s `data/skills/` directory; link them into an agent without network access with `skill link-skills <that directory>`.

## Machine-readable documentation

This site publishes the same documentation in forms that fit an agent’s context window:

- [`llms.txt`](https://addaix.github.io/aw_agents/llms.txt): an index of every page with a one-line description ([llms.txt](https://llmstxt.org) format)
- [`aw_agents.md`](https://addaix.github.io/aw_agents/aw_agents.md): the whole documentation as one Markdown file
- `<page>.html.md`: a rendered Markdown twin of every page, advertised from each page’s `<head>` with `<link rel="alternate" type="text/markdown">`
- [`objects.inv`](https://addaix.github.io/aw_agents/objects.inv): the Sphinx inventory: a symbol-to-URL index (`sphobjinv convert plain objects.inv -`)


# api.html.md

# API reference

| [`aw_agents`](_autosummary/aw_agents.html.md#module-aw_agents)   | aw_agents - AI Agents for Agentic Workflows   |
|-------------------------------------------------------------------------------|-----------------------------------------------|


