BlockRun: AgentOps
Ampersend and BlockRun provide infrastructure for secure, observable, and programmable AI agent payments using x402, A2A communication, and onchain authorization flows.
This guide shows how to:
- Run buyer and seller AI agents locally
- Process AI-to-AI payments through x402
- Connect agents to BlockRun using X402Transport
- Configure smart accounts and session keys
- Test autonomous payment workflows on Base Sepolia
The example architecture uses:
- ADK Agents
- LiteLLM
- x402 payment flows
- BlockRun inference APIs
- Base Sepolia testnet infrastructure
Architecture
Buyer
↓
A2A (x402: buyer pays seller)
↓
Seller (ADK Agent + LiteLLM)
↓
X402Transport
↓
BlockRun API
Components
Seller
An ADK Agent with a LiteLLM model backend.
Responsibilities:
- Receives A2A requests
- Charges buyers through x402
- Forwards requests to BlockRun through
X402Transport - Handles payment signing transparently
Buyer
A simple X402RemoteA2aAgent.
Responsibilities:
- Proxies requests to the seller via A2A
- Handles x402 payments automatically
Setup
1. Install dependencies
uv sync
2. Start the seller
Run in Terminal 1:
uv run python examples/a2a_communication.py --seller
3. Run the Buyer
One-shot
Run in Terminal 2:
uv run python examples/a2a_communication.py --buyer --prompt "What is 2+2?"
Interactively via ADK
Run in Terminal 2:
uv run -- adk run src/blockrun_agent/buyer_a2a
Environment Variables
| Variable | Purpose |
|---|---|
SELLER_SMART_ACCOUNT_ADDRESS | Seller wallet address. Receives buyer payments and pays BlockRun. |
SELLER_SESSION_KEY | Seller session key used for signing. |
BUYER_SMART_ACCOUNT_ADDRESS | Buyer wallet address used to pay the seller. |
BUYER_SESSION_KEY | Buyer session key used for signing. |
AMPERSEND_API_URL | Ampersend API endpoint. Default: https://api.staging.ampersend.ai |
Seller Setup
Programmatic setup
from blockrun_agent import SellerAgent, SellerConfig
config = SellerConfig(
smart_account_address="0x...",
session_key_private_key="0x...",
network="base-sepolia",
model="openai/gpt-oss-20b",
)
seller = SellerAgent(config=config)
await seller.serve() # Starts on http://0.0.0.0:8001
Run with Uvicorn
uvicorn blockrun_agent.seller:a2a_app --port 8001
Development
Install development tools
uv sync --group dev
Lint
uv run ruff check src/ examples/
Format
uv run ruff format src/ examples/
Type check
uv run mypy src/
Testnet
BlockRun provides a Base Sepolia testnet environment for development.
Use testnet USDC from public faucets.
| Setting | Mainnet | Testnet |
|---|---|---|
| API URL | https://blockrun.ai/api/v1 | https://testnet.blockrun.ai/api/v1 |
| Network | base (Chain 8453) | base-sepolia (Chain 84532) |
| Models | 26 production models | openai/gpt-oss-20b, openai/gpt-oss-120b |
Faucets
On-Chain Proof
Verified Base Sepolia transaction showing the x402 payment flow.
| Field | Value |
|---|---|
| Transaction | 0xf77aca47...ecddd3 |
| Network | Base Sepolia (Chain 84532) |
| Value | 0.001 USDC |
| Method | transferWithAuthorization |
Additional Technical Information
For full source code, configuration files, and the latest updates, visit the official repository.