Skip to content

feat: Add Spraay batch payment agent sample#32

Open
plagtech wants to merge 1 commit intomicrosoft:mainfrom
plagtech:feat/add-spraay-batch-payment-sample
Open

feat: Add Spraay batch payment agent sample#32
plagtech wants to merge 1 commit intomicrosoft:mainfrom
plagtech:feat/add-spraay-batch-payment-sample

Conversation

@plagtech
Copy link

Add Spraay Batch Payment Agent Sample

Description

This PR adds a sample agent that demonstrates how to use Microsoft Agent Framework's function tools to interact with the Spraay batch payment protocol on Base. The sample shows a practical, real-world use case: enabling an AI agent to batch-send ETH and ERC-20 tokens to up to 200 recipients in a single transaction.

What This Demonstrates

  • Custom function tools with Annotated type hints and Pydantic Field descriptions for rich tool schemas
  • Real smart contract integration via web3.py — building, signing, and broadcasting transactions
  • Multi-tool agent with four payment tools the LLM selects between based on context
  • Error handling with validation (max recipients, length mismatches, missing env vars)

Files Added

spraay-batch-payments/
├── spraay_batch_payment_agent.py   # Complete agent with 4 function tools
└── README.md                        # Setup, usage, and architecture docs

Tools Included

Tool Use Case
batch_send_eth Equal ETH distribution (payroll, airdrops)
batch_send_token Equal ERC-20 distribution with auto-approval
batch_send_eth_variable Variable ETH amounts (bounties, revenue sharing)
batch_send_token_variable Variable token amounts with auto-approval

About Spraay

Spraay is a multi-chain batch payment protocol deployed on Base and 6+ other chains. Key stats:

  • ~80% gas savings vs individual transfers
  • 200 recipients per transaction
  • Live contract: 0x1646452F98E36A3c9Cfc3eDD8868221E207B5eEC
  • MCP server distributed across 9+ agent directories
  • x402 Gateway at gateway.spraay.app for AI agent API access

Why This Is Useful

DeFi payments are a compelling use case for AI agents. This sample shows developers how to:

  1. Wrap blockchain operations as Agent Framework function tools
  2. Let the LLM choose the right tool based on natural language requests
  3. Handle the full transaction lifecycle (approval → batch send → confirmation)

@plagtech
Copy link
Author

@microsoft-github-policy-service agree

@plagtech
Copy link
Author

plagtech commented Mar 6, 2026

Update — March 2026

Spraay x402 Gateway has expanded significantly since this PR was opened:

62 paid endpoints across 8 categories (up from 6):

  • AI Chat (200+ models via OpenRouter)
  • Batch Payments (200 recipients/tx)
  • DeFi (Uniswap V3 swaps)
  • Price Oracle / Gas / FX
  • Cross-chain Bridge (11 chains)
  • Payroll, Invoicing, Escrow
  • Wallet Analytics, AI Inference
  • NEW: GPU/Compute — image gen, video, LLMs, audio via Replicate ($0.05/call)
  • NEW: Search/RAG — web search, content extraction, Q&A via Tavily ($0.01-$0.02/call)
  • Communication (email, SMS, webhooks, XMTP)
  • Infrastructure (RPC, IPFS, cron, logging)
  • Identity (KYC, auth/SSO)
  • Compliance (audit trail, tax)

63-tool MCP server on Smithery: @plagtech/spraay-x402-mcp
Developer docs: https://docs.spraay.app
Gateway: https://gateway.spraay.app

All endpoints are x402-native — agents pay USDC per request on Base. No API keys, no accounts.

GPU/Compute and Search/RAG make this sample even more relevant — agents can now generate images, search the web, and run inference autonomously, all paid per-call with USDC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant