A multi-agent system built with Microsoft AutoGen that enables AI agents to execute batch cryptocurrency payments using Spraay — a multi-chain batch payment protocol.
This sample demonstrates how AutoGen agents can collaborate to plan, validate, and execute batch payments across multiple blockchain networks. It showcases:
- Multi-agent orchestration — A Payment Planner, Validator, and Executor agent work together
- MCP integration — Uses AutoGen's
McpWorkbenchto connect to Spraay's MCP server - Custom tools — Native AutoGen
FunctionToolimplementations for direct Spraay API calls - Real blockchain transactions — Sends actual batch payments on Base, Ethereum, Arbitrum, Unichain, and more
User Request ("Pay 5 team members 100 USDC each on Base")
│
▼
┌─────────────────┐
│ Payment Planner │ ← Plans the batch: validates addresses, calculates totals
│ (AssistantAgent)│ estimates gas savings vs individual transfers
└────────┬────────┘
│
▼
┌─────────────────┐
│ Validator │ ← Checks: sufficient balance? valid addresses?
│ (AssistantAgent)│ correct chain? fee estimation?
└────────┬────────┘
│
▼
┌─────────────────┐
│ Executor │ ← Executes the batch payment via Spraay contract
│ (AssistantAgent)│ returns transaction hash + receipt
└─────────────────┘
- Python 3.10+
- An RPC provider key (e.g., Alchemy, Infura)
- A wallet with funds on your target chain
- OpenAI API key (for the LLM powering the agents)
pip install autogen-agentchat autogen-ext[openai] web3 requestsexport OPENAI_API_KEY="sk-..."
export PRIVATE_KEY="your-wallet-private-key"
export RPC_URL="https://mainnet.base.org" # or any supported chain# Multi-agent batch payment crew
python spraay_batch_agents.py
# Simple single-agent with MCP
python spraay_mcp_agent.pySpraay is a multi-chain batch payment protocol that lets you pay up to 200 recipients in a single transaction with ~80% gas savings.
| Feature | Details |
|---|---|
| Supported Chains | Base, Ethereum, Arbitrum, Unichain, Plasma, BOB, Bittensor |
| Token Support | Native tokens (ETH) + any ERC-20 (USDC, USDT, DAI, etc.) |
| Max Recipients | 200 per transaction |
| Fee | 0.3% protocol fee |
| Gas Savings | ~80% vs individual transfers |
| MCP Server | Available on Smithery |
| Chain | Address |
|---|---|
| Base | 0x1646452F98E36A3c9Cfc3eDD8868221E207B5eEC |
| Ethereum | Deployed (see spraay.app) |
| Arbitrum | Deployed |
| Unichain | 0x08fA5D1c16CD6E2a16FC0E4839f262429959E073 |
| Plasma | 0x08fA5D1c16CD6E2a16FC0E4839f262429959E073 |
| File | Description |
|---|---|
spraay_batch_agents.py |
Multi-agent crew: Planner → Validator → Executor |
spraay_mcp_agent.py |
Single agent using Spraay MCP server via McpWorkbench |
spraay_tools.py |
Reusable AutoGen FunctionTool wrappers for Spraay |
config.py |
Chain configs, contract addresses, ABIs |
- User sends a natural language request — e.g., "Distribute 500 USDC equally to these 5 addresses on Base"
- Payment Planner parses the request, resolves ENS names, calculates per-recipient amounts, and estimates gas savings
- Validator checks wallet balance, verifies addresses, and confirms the batch is within limits (≤200 recipients)
- Executor calls Spraay's
sprayToken()orsprayETH()contract function and returns the transaction hash
spray_eth— Batch send native ETH/tokens to multiple recipientsspray_token— Batch send ERC-20 tokens (USDC, DAI, etc.) to multiple recipientsestimate_gas_savings— Compare gas costs: batch vs individual transfersget_supported_chains— List all chains where Spraay is deployed
- Spraay App: spraay.app
- Spraay GitHub: github.com/plagtech/spray-app
- Spraay x402 Gateway: gateway.spraay.app
- AutoGen Docs: microsoft.github.io/autogen
- Twitter: @Spraay_app
MIT