Metadata-Version: 2.4
Name: x402grants
Version: 0.1.0
Summary: x402 Agent Grant System — EIP-712 signed spend grants for AI agent payments on Base L2
Author-email: AgentPay Team <support@x402-agent-pay.com>
License: MIT
Project-URL: Homepage, https://x402-agent-pay.com
Project-URL: Documentation, https://github.com/shawnhvac/x402/tree/main/specs
Project-URL: Repository, https://github.com/shawnhvac/x402
Project-URL: Bug Tracker, https://github.com/shawnhvac/x402/issues
Project-URL: Community, https://github.com/shawnhvac/x402/blob/main/COMMUNITY.md
Keywords: x402,ai-agents,payments,base-l2,usdc,eip-712,machine-to-machine
Classifier: Development Status :: 3 - Alpha
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
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# AgentPay — x402 Payment Infrastructure for AI Agents

AgentPay is the payment infrastructure layer for autonomous AI agents, IoT devices, and machine-to-machine commerce. It implements the **x402 Agent Grant System** — EIP-712 signed spend policies that let agents pay each other without sharing private keys.

## What It Does

- **Agent Grants** — short-lived, budget-capped, scope-restricted spend authorizations (IAM for agents)
- **Event-driven settlement** — Base L2 payment confirmation in 2–6 seconds, automatic refunds on failure
- **Reputation scoring** — optional Sybil-resistant trust layer via The Graph subgraph
- **Open spec** — fully documented, conformance-tested, implement without AgentPay

## Quick Start (60 seconds, no wallet)

```bash
git clone https://github.com/shawnhvac/x402.git
cd x402/examples/minimal-node-python

# Terminal 1 — receiving agent
cd python-receiving-agent && pip install -r requirements.txt && python app.py

# Terminal 2 — paying agent
cd node-paying-agent && npm install && npm start
```

See a full payment cycle — grant → verify → settle → receipt — in your terminal.

## On-Chain (Base Sepolia)

Flip two env vars and run the same example with real USDC on Base Sepolia:
[BASE_SEPOLIA.md](https://github.com/shawnhvac/x402/blob/main/examples/minimal-node-python/BASE_SEPOLIA.md)

## How It Works

Every x402 payment is an HTTP request with a signed grant header:

```
POST /api/tool HTTP/1.1
X-402-Payment: <base64-encoded EIP-712 grant + EIP-3009 authorization>
```

The receiving agent verifies the grant offline (no RPC in the happy path), settles on-chain via EIP-3009 `transferWithAuthorization`, and returns a receipt in the response header.

## Spec Suite

Six live documents covering every layer of the stack:

| Spec | Description |
|---|---|
| [grants.md](https://github.com/shawnhvac/x402/blob/main/specs/grants.md) | EIP-712 grant schema, security rules, revocation |
| [payment-flow.md](https://github.com/shawnhvac/x402/blob/main/specs/payment-flow.md) | End-to-end lifecycle |
| [conformance.md](https://github.com/shawnhvac/x402/blob/main/specs/conformance.md) | One-command test suite |
| [reputation.md](https://github.com/shawnhvac/x402/blob/main/specs/reputation.md) | Reputation scoring |
| [subgraph.md](https://github.com/shawnhvac/x402/blob/main/specs/subgraph.md) | The Graph deployment guide |

## Links

- Website: [x402-agent-pay.com](https://x402-agent-pay.com)
- GitHub: [github.com/shawnhvac/x402](https://github.com/shawnhvac/x402)
- Implementations: [COMMUNITY.md](https://github.com/shawnhvac/x402/blob/main/COMMUNITY.md)
- Network: Base L2 (USDC)
