Metadata-Version: 2.4
Name: asterpay-autogpt
Version: 1.0.0
Summary: AsterPay payment component for AutoGPT and AgentGPT - Enable AI agents to make x402 payments
Project-URL: Homepage, https://asterpay.io
Project-URL: Documentation, https://asterpay.io/docs
Project-URL: Repository, https://github.com/asterpay/asterpay-autogpt
Author-email: AsterPay <dev@asterpay.io>
License-Expression: MIT
License-File: LICENSE
Keywords: agentgpt,agents,ai,asterpay,autogpt,crypto,payments,x402
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: eth-account>=0.10.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: web3>=6.0.0
Provides-Extra: autogpt
Requires-Dist: autogpt-forge>=0.1.0; extra == 'autogpt'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# AsterPay AutoGPT/AgentGPT Integration

> Payment capabilities for autonomous AI agents.

[![PyPI](https://img.shields.io/pypi/v/asterpay-autogpt)](https://pypi.org/project/asterpay-autogpt/)
[![Python](https://img.shields.io/pypi/pyversions/asterpay-autogpt)](https://pypi.org/project/asterpay-autogpt/)

## Overview

`asterpay-autogpt` provides payment tools for AI agent frameworks:

- **AutoGPT** - Component-based architecture support
- **AgentGPT** - Generic tool interface
- **Any Framework** - OpenAI function calling format

## Installation

```bash
pip install asterpay-autogpt
```

## Quick Start

### AutoGPT Component

```python
from autogpt.agents import Agent
from asterpay_autogpt import AsterPayComponent

class PaymentAgent(Agent):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.asterpay = AsterPayComponent(
            private_key=os.environ["AGENT_PRIVATE_KEY"],
            network="base",
            daily_limit=10.0,
            max_auto_pay=0.50,
        )
```

### Generic Tools (Any Framework)

```python
from asterpay_autogpt import AsterPayTools

tools = AsterPayTools(
    private_key=os.environ["AGENT_KEY"],
    daily_limit=10.0,
)

# Check balance
balance = await tools.check_balance()
print(f"Balance: {balance}")

# Access paid API
result = await tools.paid_fetch("https://api.paid-service.com/data")
print(f"Data: {result['data']}")

# Make payment
payment = await tools.make_payment(
    recipient="0x...",
    amount=5.00,
    memo="Service payment"
)
```

### OpenAI Function Calling

```python
from asterpay_autogpt import AsterPayTools
import openai

tools = AsterPayTools(private_key=os.environ["KEY"])

# Get function definitions
functions = tools.get_openai_function_definitions()

# Use with OpenAI
response = openai.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Check my wallet balance"}],
    tools=functions,
)

# Execute function call
if response.choices[0].message.tool_calls:
    call = response.choices[0].message.tool_calls[0]
    result = await tools.execute_function(
        call.function.name,
        json.loads(call.function.arguments)
    )
```

## Available Commands

| Command | Description |
|---------|-------------|
| `asterpay_balance` | Check wallet USDC balance |
| `asterpay_spending` | View spending against limits |
| `asterpay_fetch` | Fetch URLs with automatic x402 payment |
| `asterpay_pay` | Make direct USDC payments |
| `asterpay_transactions` | View payment history |

## Spending Limits

Protect your agent with configurable limits:

```python
AsterPayComponent(
    private_key=key,
    per_transaction_limit=2.0,  # Max $2 per transaction
    hourly_limit=5.0,           # Max $5/hour
    daily_limit=25.0,           # Max $25/day
    monthly_limit=200.0,        # Max $200/month
    max_auto_pay=0.50,          # Max auto-pay for x402
)
```

## Networks

| Network | Chain ID | Use Case |
|---------|----------|----------|
| `base` | 8453 | Production (recommended) |
| `base-sepolia` | 84532 | Testing |
| `polygon` | 137 | Alternative L2 |
| `arbitrum` | 42161 | Alternative L2 |

## Environment Variables

```bash
# Required
AGENT_PRIVATE_KEY=0x...

# Optional
ASTERPAY_NETWORK=base
ASTERPAY_DAILY_LIMIT=10.0
```

## Security

1. **Never hardcode private keys**
2. **Set appropriate spending limits**
3. **Use testnet for development**
4. **Monitor agent transactions**

## Links

- **Website**: [asterpay.io](https://asterpay.io)
- **Demo**: [demo.asterpay.io](https://demo.asterpay.io)
- **Docs**: [asterpay.io/docs](https://asterpay.io/docs)

## License

MIT License
