Skip to content

RaSah673/agentpay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentPay

The checkout layer for the agent economy.

AgentPay is the AI-to-AI payment system for OpenClaw: agents can discover paid tools, complete USDC payments, and continue work—without human intervention.

Your specialist agent did the task. Another agent pays instantly. Work continues. Everybody wins. 🤝

Why AgentPay (and why now)

AI agents are moving from demos to real operations. The missing piece is simple:

How does one agent pay another agent for useful work over HTTP?

AgentPay answers that with a clean, developer-friendly flow built for OpenClaw-style systems.

  • Monetize agent capabilities with per-endpoint pricing.
  • Turn tools into revenue-generating services instead of internal-only utilities.
  • Let agents transact autonomously (no manual invoices, no human-in-the-loop payment clicks).
  • Keep orchestration smooth with automatic pay-and-retry.
  • Get receipts and policy checks for auditability and control.

The pitch in one line

Stripe-like UX for agent-to-agent USDC payments over HTTP.

How it works

  1. A seller agent protects an endpoint with a price.
  2. A buyer agent calls it like normal.
  3. Seller returns HTTP 402 + payment requirements.
  4. Buyer agent pays and retries automatically.
  5. Seller verifies, settles, and returns the result + receipt metadata.

Protocol headers:

  • PAYMENT-REQUIRED
  • PAYMENT-SIGNATURE
  • PAYMENT-RESPONSE

Seller example (FastAPI)

from fastapi import FastAPI
from agentpay_seller import for_fastapi

app = FastAPI()
agentpay = for_fastapi(
    app,
    merchant_id="mrc_demo",
    api_key="ap_live_demo",
    base_url="http://localhost:8000",
    recipient="0xseller",
)

@app.post("/run-task")
@agentpay.protect(price="0.05")
async def run_task(payload: dict):
    return {"ok": True, "task": payload.get("task")}

agentpay.mount()

Buyer example

from agentpay_buyer import AgentPayClient

client = AgentPayClient.from_settings(settings)
response = await client.post("http://localhost:8001/run-task", json={"task": "summarize"})

print(response.json())
print(response.agentpay_receipt)

OpenClaw integration

AgentPay is purpose-built for OpenClaw workflows where agents call tools/services over HTTP.

Great fits:

  • paid browser automations
  • paid search/retrieval endpoints
  • paid specialist sub-agent calls
  • paid data prep/indexing/conversion jobs

A thin adapter is included at packages/integrations/openclaw/.

Quickstart

Install

pip install -e .

Run migrations

PYTHONPATH=packages/core alembic upgrade head

Seed demo data

PYTHONPATH=packages/core:apps/api python -m seed_demo

Start API

PYTHONPATH=packages/core:apps/api uvicorn main:app --reload --port 8000

Start seller demo

AGENTPAY_API_BASE_URL=http://localhost:8000 PYTHONPATH=packages/core:packages/seller_sdk:apps/seller_demo uvicorn main:app --reload --port 8001

Run tests

PYTHONPATH=packages/core:packages/buyer_sdk:packages/seller_sdk:packages/integrations/openclaw:apps/api pytest -q

Demo

Run examples/openclaw_paid_tool_demo.py for a minimal end-to-end flow: buyer agent calls paid tool → gets 402 → pays in USDC → retries → receives result + receipt.

License

See LICENSE.

About

AI payments platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.6%
  • Mako 0.4%