Robot Task Protocol SDK for Python. Connect any robot to the x402 payment network in minutes.
The Python implementation of the Robot Task Protocol (RTP) — the open standard for AI agents to discover, commission, and pay for physical robot tasks via x402 USDC micropayments.
Built for Raspberry Pi, Arduino bridges, industrial robots, IoT devices, and any Python-capable machine.
pip install spraay-rtpWith Raspberry Pi GPIO support:
pip install spraay-rtp[pi]With Arduino serial bridge support:
pip install spraay-rtp[serial]import asyncio
from rtp import RTPDevice, RTPDeviceConfig, ConnectionConfig, ConnectionType, TaskResult
config = RTPDeviceConfig(
name="MyRobot-01",
capabilities=["pick", "place", "scan"],
price_per_task="0.05",
payment_address="0xYourWallet",
api_key="your-spraay-key",
connection=ConnectionConfig(
type=ConnectionType.WEBHOOK,
webhook_url="https://yourserver.com/rtp/task",
port=3100
)
)
device = RTPDevice(config)
@device.on_task("pick")
async def handle_pick(params, task):
await task.progress()
# your robot code here
await task.complete(TaskResult(
success=True,
output=f"Picked {params.get('item')}"
))
async def main():
await device.register()
await device.listen()
asyncio.run(main())import asyncio
from rtp import RTPClient
async def main():
client = RTPClient(wallet="0xYourAgentWallet")
robots = await client.discover(capability="pick")
result = await client.hire(
robots[0],
task="pick",
parameters={"item": "SKU-421", "from_location": "bin_A3"}
)
print(result["status"]) # COMPLETED
print(result["result"]["output"]) # Picked SKU-421
asyncio.run(main())# Interactive setup wizard
rtp-device init
# Start your device
rtp-device start
# Check status
rtp-device status| Verb | Description |
|---|---|
move |
Relocate robot or end effector |
pick |
Grasp or retrieve an object |
place |
Set down or deposit an object |
scan |
Capture sensor data |
sort |
Categorize and route objects |
inspect |
Examine and report |
deliver |
Transport from origin to destination |
patrol |
Monitor an area over time |
charge |
Return to charging cycle |
capture |
Record video, audio, or image |
transmit |
Send data to external endpoint |
weld |
Perform welding operation |
assemble |
Combine components |
dispense |
Release measured quantity |
print |
Output physical object or document |
Custom capabilities via reverse-domain notation:
capabilities=["pick", "place", "com.acmerobotics.palletize"]| Type | Description | Best For |
|---|---|---|
webhook |
HTTPS POST to your server | Any internet-connected robot |
xmtp |
Encrypted wallet messaging | No open ports needed |
wifi |
HTTP via local relay | LAN robots |
websocket |
Persistent WS connection | Real-time control |
Agent pays (x402 USDC)
↓
Spraay validates + holds escrow
↓
Task envelope → your robot
↓
task.progress() # optional
↓
[your robot code runs]
↓
task.complete() # releases escrow to you
or
task.fail() # returns payment to agent
pip install spraay-rtp[pi]
cp .env.example .env
# fill in .env
python examples/pi_servo_robot.pySee examples/pi_servo_robot.py
pip install spraay-rtp[serial]
python examples/arduino_bridge.pyPattern:
Spraay Gateway ←WiFi→ Raspberry Pi (SDK) ←USB/Serial→ Arduino
See examples/arduino_bridge.py
python examples/agent_test.pyWALLET_ADDRESS=0xYourWalletAddress
SPRAAY_API_KEY=your-spraay-api-key
WEBHOOK_SECRET=any-random-secret-string
PUBLIC_IP=https://your-public-url.com
# Arduino bridge (optional)
SERIAL_PORT=/dev/ttyUSB0
BAUD_RATE=9600| Device | SDK Direct | Method |
|---|---|---|
| Raspberry Pi | ✅ | pip install |
| Any Linux machine | ✅ | pip install |
| Arduino / ESP32 | Serial via Pi | |
| Industrial robots | Vendor API | |
| Windows machines | ✅ | pip install |
Full compatibility guide: device-compatibility.md
rtp-python-sdk/
├── rtp/
│ ├── __init__.py — exports
│ ├── types.py — dataclasses + enums
│ ├── device.py — RTPDevice + TaskContext
│ ├── client.py — RTPClient
│ └── cli.py — rtp-device CLI
├── examples/
│ ├── pi_servo_robot.py — Raspberry Pi GPIO demo
│ ├── agent_test.py — agent-side test client
│ └── arduino_bridge.py — Arduino serial bridge
├── setup.py
├── requirements.txt
└── .env.example
pip install build twine
python -m build
twine upload dist/*Package name: spraay-rtp
Import name: rtp
| Repo | Description |
|---|---|
| rtp-spec | RTP 1.0 open standard |
| rtp-sdk | TypeScript SDK |
| rtp-pi-demo | Pi hardware demo |
| rtp-xmtp-mesh | XMTP robot mesh |
| awesome-rtp | Compatible devices list |
MIT — build anything with it.
Built by Spraay Protocol · Part of the Robot Task Protocol ecosystem