Skip to content

lfp22092002-ops/agentpay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

177 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

AgentPay πŸ’³πŸ€– β€” Give Your AI Agent a Wallet

The payment layer for autonomous AI agents. Fund via Telegram Stars or crypto, set spending rules, let your agent operate independently.

CI Telegram Bot Website API Docs License: MIT


Why AgentPay?

AI agents can browse, code, deploy β€” but can't spend money without a human in the loop. AgentPay fixes that.

Problem AgentPay Solution
Agent needs to pay for an API Autonomous spending via REST API
No on-chain wallet for agents Multi-chain USDC wallets (Base, Polygon, BNB, Solana)
Agents can't hold or transfer funds Agent-to-agent transfers, refunds, webhooks
Payment UIs don't fit agent workflows Pure API + Python SDK + MCP tools
Expensive/complex infrastructure Self-hosted, open-source, 0% fees (beta)

Quick Start β€” 5 Minutes

1. Create Agent β†’ Get API Key

Open @FundmyAIbot in Telegram β†’ /newagent β†’ Copy your API key (shown once)

2. Fund It

Send Telegram Stars through the bot, or deposit USDC to the agent's Base wallet.

3. Let It Spend

from agentpay import AgentPayClient

client = AgentPayClient("ap_xxxx...")

# Check balance
balance = client.get_balance()
print(f"Balance: ${balance.balance_usd}")

# Spend
tx = client.spend(amount=5.00, description="GPT-4 batch")
print(f"Spent ${tx.amount}, remaining ${tx.remaining_balance}")

# Transfer between agents
client.transfer(to_agent_id="agent_456", amount=10.00)

# Webhook for real-time events
webhook = client.register_webhook(url="https://your-server.com/hook", events=["transaction.completed"])

Or use the REST API directly:

curl -X POST https://leofundmybot.dev/v1/spend \
  -H "X-API-Key: ap_xxxx..." \
  -H "Content-Type: application/json" \
  -d '{"amount": 5.00, "description": "API usage"}'

Features

Payments

  • ⭐ Telegram Stars funding (instant, in-app)
  • πŸ”— Multi-chain USDC wallets β€” Base, Polygon, BNB Chain, Solana
  • πŸ’Έ Agent-to-agent transfers
  • ↩️ Refunds & transaction reversal
  • 🌐 x402 protocol support (HTTP-native payments)

Agent Identity (KYA β€” Know Your Agent)

  • πŸͺͺ Agent identity profiles with trust scores (0-100)
  • πŸ“Š Trust score based on: account age, tx count, volume, profile, verified badge
  • πŸ“‚ Public agent directory with category filtering
  • βœ… Verified agent badges
  • πŸ†” ERC-8004 compatible registration files (Trustless Agents standard)

Security

  • πŸ” SHA-256 hashed API keys (Stripe-style β€” shown once, never stored)
  • πŸ”‘ Key rotation endpoint
  • πŸ›‘οΈ Fernet+PBKDF2 encrypted wallet keys at rest
  • 🚦 Per-key rate limiting (60 req/min)
  • πŸ”’ CORS lockdown + security headers (HSTS, CSP, Referrer-Policy, Permissions-Policy)
  • 🧱 UFW firewall + fail2ban + SSH hardening
  • πŸ” Pen-tested: Nmap, Nikto, SQLmap β€” zero vulnerabilities

Developer Experience

  • πŸ“š Full OpenAPI docs at /docs and /redoc
  • 🐍 Python SDK (sync + async, Pydantic v2 models)
  • πŸ€– MCP tool definitions (8 tools for agent frameworks)
  • πŸ”” Webhooks with HMAC-SHA256 signatures
  • βœ… Idempotent operations
  • πŸ“Š CSV export for accounting

Control

  • βœ… Approval workflows β€” require human sign-off above spending thresholds
  • πŸ“± Telegram Mini App dashboard
  • 🌐 Landing page + docs site

Architecture

Telegram Bot (@FundmyAIbot)
    ↓ creates agents, funds wallets
AgentPay API (FastAPI, 29 endpoints)
    ↓                  ↓
Telegram Stars    Multi-chain USDC
(internal ledger)  (Base/Polygon/BNB/Solana)
    ↓                  ↓
    β†’ Webhooks push events to your agent in real-time

Stack: Python (aiogram + FastAPI), PostgreSQL, Alembic, Cloudflare Tunnel


Self-Hosting

git clone https://github.com/lfp22092002-ops/agentpay.git
cd agentpay
cp .env.example .env  # Configure your keys
pip install -r requirements.txt
alembic upgrade head
uvicorn api.main:app --host 0.0.0.0 --port 8080

Requires: Python 3.11+, PostgreSQL, a Telegram Bot Token.


API Endpoints (35+)

Category Endpoints
Agent Create, get, list, update, delete, rotate API key
Balance Get balance, deposit, spend, transfer, refund
Identity Create/update profile, get trust score, public directory
Dashboard Aggregate stats, agent analytics, spending breakdown
Webhooks Create, list, delete, test
Wallets Get addresses (Base, Polygon, BNB, Solana)
Chains List supported chains, chain status
Export CSV transaction history
x402 Probe, pay (HTTP 402 payment flow)
Health Status, version

Full interactive docs: leofundmybot.dev/docs


MCP Tools

AgentPay ships with MCP (Model Context Protocol) tool definitions so any AI agent framework can use it natively:

{
  "tools": [
    "agentpay_get_balance",
    "agentpay_spend", 
    "agentpay_transfer",
    "agentpay_list_transactions",
    "agentpay_create_webhook",
    "agentpay_get_wallet_address",
    "agentpay_check_approval",
    "agentpay_x402_pay"
  ]
}

Works with LangChain, CrewAI, OpenClaw, and any MCP-compatible agent.


Pricing

Setup Free
Transactions 0% fees (beta)
Monthly $0
Self-hosted Free forever

Roadmap

  • Multi-chain USDC wallets (Base, Polygon, BNB, Solana)
  • Agent Identity System (KYA β€” Know Your Agent) with trust scores
  • ERC-8004 Trustless Agents compatibility
  • Security audit β€” pen-tested with Nmap, Nikto, SQLmap (0 vulns)
  • Security model whitepaper (docs/security-model.md)
  • Dashboard API for analytics
  • LangChain / CrewAI native tool wrappers
  • Python SDK on PyPI (pip install agentpay)
  • TypeScript SDK on npm
  • Virtual Visa cards via Lithic
  • Telegram Stars production payments
  • ERC-8004 on-chain registration (Phase 2)
  • Dashboard UI (web frontend)
  • Payee whitelists (allow/deny rules with per-payee caps)
  • Google AP2 + Stripe Agentic Commerce compatibility
  • x402 facilitator mode (settle payments for other agents)

Links


Contributing

PRs welcome. Open an issue first for big changes.


License

MIT β€” see LICENSE


Built for the agent economy. Because autonomous agents deserve their own wallets.