Official SDK for the Reap Protocol: Agentic Commerce Grid
Project description
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 (Base Sepolia), 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 -> Settlement.
import os
from reap_protocol.client import ReapClient
# 1. Configuration
# Use a Base Sepolia Wallet with ETH (for gas) and USDC (for purchases)
PRIVATE_KEY = os.getenv("MY_WALLET_KEY")
def main():
# Initialize the Agent (Points to official middleware by default)
client = ReapClient(private_key=PRIVATE_KEY)
# 2. Identity (One-time setup)
# Registers your wallet as an authorized Agent on the Protocol
print("🆔 Checking Identity...")
client.register_identity()
# 3. JIT Stocking (Discovery)
# Searches Web2 (Reap Deals), registers items on-chain, and returns inventory
print("📦 Stocking Shelf with 'Gaming Laptop'...")
result = client.stock_shelf("Gaming Laptop")
inventory = result.get('items', [])
print(f" 🔍 Found {len(inventory)} items on-chain.")
if not inventory:
return
# 4. Decision Logic
# Example: Pick the first available item
target_item = inventory[0]
print(f" 🎯 Selected: {target_item['name']} (${target_item['price']})")
print(f" ID: {target_item['id']}")
# 5. 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()
🛠 Configuration
You can override defaults for custom RPCs or self-hosted middleware.
client = ReapClient(
private_key="...",
chain_rpc="https://base-sepolia.g.alchemy.com/v2/YOUR_KEY", # Faster RPC
builder_url="https://api.reap.deals" # Official Middleware
)
✨ Features
- 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.
- Self-Custody: Your private key never leaves your local machine. The SDK signs transactions locally.
- Smart Updates: The Middleware checks on-chain state to prevent redundant transactions.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reap_protocol-0.1.1.tar.gz.
File metadata
- Download URL: reap_protocol-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d0bf7138e4e51f7378e3e0f12a6d48272345894d6b90f46277ed2f443265efa
|
|
| MD5 |
fa0786aba280dce1ba15e0156451ba85
|
|
| BLAKE2b-256 |
96d61a6e2f6319654c8e31c35e82b2273740f1ac2381030edbd1795270753f6d
|
File details
Details for the file reap_protocol-0.1.1-py3-none-any.whl.
File metadata
- Download URL: reap_protocol-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
521f6ef306348b7258a71217bde0b084ff25f980fd15a6c7ead68e63f09ddae8
|
|
| MD5 |
3ca587dd88111c6501cc262c0fbfaa4d
|
|
| BLAKE2b-256 |
7c67eeff9134a156f60b9f5a580c763da62a3585fedc64fc3c7b5bd04cf810bc
|