Reap Protocol SDK
The official Python SDK for the Reap Protocol: The Agentic Commerce Grid.
The Reap Protocol enables AI Agents to search for products, register them on-chain, and execute atomic purchases without needing to understand smart contract ABIs.
📦 Installation
pip install reap-protocol
🚀 Quick Start
This example demonstrates the full Agentic Commerce Loop: Identity -> Discovery -> Smart Sync -> Settlement.
import os
import time
from reap_protocol.client import ReapClient
# 1. Configuration
# Use a funded testnet wallet (AVAX Fuji, Celo Alfajores, or Base Sepolia)
PRIVATE_KEY = os.getenv("MY_WALLET_KEY")
CHAIN_RPC = "https://api.avax-test.network/ext/bc/C/rpc" # Example: Avalanche Fuji
def main():
# Initialize the Agent
client = ReapClient(
private_key=PRIVATE_KEY,
chain_rpc=CHAIN_RPC
)
# Wait for connection
time.sleep(1)
print(f"🤖 Agent Online: {client.account.address}")
# 2. Identity (One-time setup)
# Registers your wallet as an authorized Agent on the Protocol
print("🆔 Checking Identity...")
client.register_identity()
# 3. Discovery (Dry Run Mode)
# Searches Web2 (Reap Deals). We use dry_run=True to get the data
# without executing the registration transactions immediately.
print("📦 Browsing for 'Gaming Laptop'...")
result = client.stock_shelf("Gaming Laptop", dry_run=True)
items = result.get('items', [])
transactions = result.get('transactions', [])
print(f" 🔍 Found {len(items)} items.")
if not items:
print("❌ No items found.")
return
# 4. Decision Logic
# Example: Pick the first available item
target_item = items[0]
# The API returns transactions in the same order as items.
# We grab the specific registration TX for this item.
target_tx = transactions[0]
print(f" 🎯 Selected: {target_item['name']} (${target_item['price']})")
print(f" ID: {target_item['id']}")
# 5. Smart Sync
# The SDK checks if item is stocked.
# - If found: It skips registration (Zero Gas).
# - If missing: It runs the registration TX and updates the index.
print("🧠 Running Smart Sync...")
client.smart_sync(target_item, [target_tx])
# 6. Agentic Cart (Settlement)
# Handles ERC20 Approvals and Atomic Purchase in one flow
print(f"💸 Buying Item...")
receipt = client.buy_product(target_item['id'])
if receipt:
print(f"🎉 SUCCESS! Transaction Hash: {receipt['transactionHash'].hex()}")
if __name__ == "__main__":
main()
🕵️ Agent Discovery (New)
You can now search for other AI Agents (MCP, x402, A2A).
# 1. Search for Agents
# Registries: 'mcp', 'x402', 'a2a'
agents = client.search_agents("ecommerce", registry="x402")
if agents:
target_agent = agents[0]
print(f"Found: {target_agent.get('name')}")
🛠 Configuration
You can override defaults for custom RPCs or self-hosted middleware.
client = ReapClient(
private_key="...",
chain_rpc="https://avax-fuji.g.alchemy.com/v2/YOUR_KEY", # Faster RPC
builder_url="https://avax2.api.reap.deals" # Official Middleware
)
✨ Features
- Agent Discovery: Search thousands of AI Agents from MCP, x402, and A2A registries.
- Agentic Cart: Routes single or multiple items through a batch processor, optimizing gas and handling USDC approvals automatically.
- JIT Stocking: "Just-In-Time" inventory system. If an agent searches for an item not yet on the blockchain, the Protocol indexes it in real-time.
- Smart Updates: The Middleware checks on-chain state to prevent redundant transactions.
License
MIT
Metadata
Release files for reap-protocol 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reap_protocol-0.1.3.tar.gz | 6.6 kB | Without provenance | Details for reap_protocol-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reap_protocol-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for reap_protocol-0.1.3-py3-none-any.whl |
Total release size: 13.5 kB
Release files / reap_protocol-0.1.3.tar.gz
| Download URL | reap_protocol-0.1.3.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db7dfed412395884970189e59e07e99f869218ef6ce7c4de03c10c6d89663114
|
|
BLAKE2b-256 checksum How to use checksums |
fe163b6f797ce977d9b323815a515df4b51d255df01f6a13ed758620da4a3452
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / reap_protocol-0.1.3-py3-none-any.whl
| Download URL | reap_protocol-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbc84037de2eaef7ca065f6ed5108f91790455e892d34aaa74c4307f5e3fdc70
|
|
BLAKE2b-256 checksum How to use checksums |
10ddf3c02457941dca225decee1b3fcc1c5bbef46b31d7d431ff1afa10386f66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for reap-protocol 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.