AI agents are getting smarter every week. They can browse the web, write code, manage your calendar, and post on social media. But ask one to pay someone? That's where they hit a wall.
I just opened PR #12533 on AutoGPT — the biggest open-source AI agent platform on GitHub — adding native crypto payment blocks powered by Spraay, the multi-chain batch payment gateway I've been building.
This is the first crypto payment integration in AutoGPT's block ecosystem. Here's why it matters and how I built it.
The problem: AI agents can't pay for anything
Think about it. AutoGPT can already:
- Scrape Reddit for trending topics and create video content
- Monitor your YouTube channel and auto-generate blog posts
- Manage GitHub issues and coordinate workflows
But the moment an agent needs to compensate a freelancer, pay a bounty, or settle an invoice? It's stuck. There's no native payment rail.
Traditional payment APIs (Stripe, PayPal) require KYC, bank accounts, and don't work well for autonomous systems. Crypto solves this — specifically stablecoins like USDC that don't fluctuate in value.
Enter x402: HTTP meets crypto payments
The x402 protocol is elegantly simple. It extends HTTP with status code 402 (Payment Required) to let APIs accept USDC micropayments per request. No subscriptions. No invoices. Just pay-per-call.
Spraay's gateway sits at gateway.spraay.app and exposes 76+ paid endpoints across 13 blockchain networks. When an AI agent calls the API, it pays a fraction of a cent in USDC and gets the service done. That's the entire auth model.
What I built: 4 payment blocks
AutoGPT's platform uses a modular "block" system. Each block performs a single action, and users chain them together visually to build agent workflows. I added four blocks:
SpraayBatchPaymentBlock — The flagship. Send payments to multiple recipients in a single on-chain transaction. One call, multiple payees, massive gas savings.
SpraayTokenTransferBlock — Simple one-to-one transfer. Agent pays someone. Done.
SpraayGetBalanceBlock — Check any wallet's token balance on any chain. Essential for pre-flight checks before sending payments.
SpraayTransactionStatusBlock — Track confirmation status. Lets agents wait for finality before proceeding in a workflow.
The code: how AutoGPT blocks work
AutoGPT blocks follow a clean pattern: a Python class inheriting from Block, with typed input/output schemas and an async run method. Here's a simplified look at the batch payment block:
class SpraayBatchPaymentBlock(Block):
class Input(BlockSchema):
credentials: spraay_provider.credentials_field()
chain: ChainNetwork = SchemaField(
description="Blockchain network to send payments on",
default=ChainNetwork.BASE,
)
recipients: list[str] = SchemaField(
description="List of recipient wallet addresses",
)
amounts: list[str] = SchemaField(
description="List of amounts to send",
)
class Output(BlockSchema):
transaction_hash: str = SchemaField(...)
status: str = SchemaField(...)
error: str = SchemaField(...)
async def run(self, input_data: Input, **kwargs):
result = spraay_request(
method="POST",
endpoint="/v1/batch/send",
api_key=api_key,
json_body={
"chain": input_data.chain.value,
"recipients": input_data.recipients,
"amounts": input_data.amounts,
},
)
yield "transaction_hash", result["transaction_hash"]
yield "status", result["status"]
The provider config uses AutoGPT's ProviderBuilder for API key management:
from backend.sdk import BlockCostType, ProviderBuilder
spraay_provider = (
ProviderBuilder("spraay")
.with_api_key("SPRAAY_API_KEY", "Spraay x402 Gateway API Key")
.with_base_cost(1, BlockCostType.RUN)
.build()
)
Clean, typed, testable. Every block includes test_input, test_output, and test_mock so it plugs right into AutoGPT's test suite.
What you can build with this
Once these blocks are merged, AutoGPT agents can do things like:
Freelancer payroll agent — Reads a Google Sheet of contractors, batch pays them all in USDC on Base. One transaction. Done weekly on a schedule.
Bounty payer — Monitors GitHub issues tagged bounty. When a linked PR gets merged, it automatically pays the contributor's wallet.
Agent-to-agent payments — One agent hires another agent for a subtask and pays via x402. This is the foundation of an autonomous agent economy.
Conditional payment workflows — Check balance → if sufficient funds → send batch payment → verify confirmation → log to Google Sheets. All without human intervention.
13 chains, one API
The blocks support every chain Spraay runs on:
Base, Ethereum, Arbitrum, Polygon, BNB Chain, Avalanche, Unichain, Plasma, BOB, Solana, Bittensor, Stacks, and Bitcoin.
Each chain is a simple enum value. Switch from Base to Solana by changing one field. The gateway handles all the chain-specific logic.
Why open source this into AutoGPT?
Visibility and ecosystem growth. AutoGPT has 183K stars and an active contributor community. Getting payment blocks into their marketplace means every AutoGPT user can add crypto payments to their agents without writing custom code.
It's also a signal. AI agents handling money is inevitable. The infrastructure should be open, auditable, and composable — not locked behind proprietary APIs.
What's next
The PR is live at #12533. If you're interested in AI agent payments, here are some links:
- Spraay gateway: gateway.spraay.app
- Docs: docs.spraay.app
- MCP server (for Claude, Cursor, etc.): @plagtech/spraay-x402-mcp
- GitHub: github.com/plagtech
If you're building agents that need to move money, I'd love to hear what you're working on. Drop a comment or find me on X at @Spraay_app.
Follow me for more on building crypto infrastructure for AI agents. I write daily about Web3, x402, and the agent economy.
Top comments (0)