REIN
Sign inGet started
Integrations

Python SDK

The REIN Python SDK works with CrewAI, LangGraph, AutoGen, and any Python-based agent framework. Install once, wrap your spend calls, and every transaction is enforced on-chain.

Install

bash
pip install rein

Basic usage

python
from rein import ReinClient, PolicyViolationError rein = ReinClient( vault="YOUR_VAULT_ADDRESS", network="devnet" ) try: receipt = rein.spend( recipient="api.openai.com", amount_usdc=1.20, memo="GPT-4o research task" ) print(f"Paid: {receipt.signature}") except PolicyViolationError as e: print(f"Blocked: {e.rule}{e.message}")

CrewAI integration

Wrap any CrewAI tool with rein.tool() to automatically enforce your policy before execution.

python
from crewai import Agent, Task, Crew from rein import ReinClient rein = ReinClient(vault="YOUR_VAULT_ADDRESS") # Wrap a tool — REIN checks policy before each call @rein.tool(recipient="api.brave.com", cost_usdc=0.02) def brave_search(query): # Your actual search logic here return search_api(query) researcher = Agent( role="Research Analyst", tools=[brave_search], # REIN-wrapped tool ... )

LangGraph integration

python
from langgraph.graph import StateGraph from rein import ReinClient rein = ReinClient(vault="YOUR_VAULT_ADDRESS") async def call_api_node(state): # REIN enforces policy before any spend receipt = await rein.spend_async( recipient="api.anthropic.com", amount_usdc=state["estimated_cost"] ) return {**state, "receipt": receipt.signature}
API reference Quick start