Use LeashFi
with confidence.
A practical guide to putting an AI agent behind deterministic policies on Robinhood Chain and Robinhood Agentic Trading.
What LeashFi does
LeashFi is the control layer between an AI agent and financial execution. The agent can create an intent, but policy decides whether that intent is allowed, needs owner approval, or must be blocked.
Policy-enforced vault
Payments execute through the LeashFiVault on Robinhood Chain. Caps and recipient rules are enforced onchain.
Fail-closed MCP gateway
Trading write tools are evaluated before they reach Robinhood's official remote MCP connection.
Quick start
For the first workspace, the dashboard is the fastest path. You do not need to generate an agent key inside LeashFi.
- Connect the owner wallet. Open the dashboard and sign the EIP-191 challenge. This wallet owns the workspace and reviews sensitive actions.
- Register the agent. Go to
Dashboard → Agents, add a name and the agent's public EVM address, then selectChainorTrading MCP. - Set guardrails. Configure daily cap, per-recipient cap, allowlists/blocklists, allowed assets, symbols, order types, and an approval threshold.
- Create an API key. In
Settings → API keys, create a key and copy it immediately. Store it as a server-side secret. - Fund and run. For Chain payments, fund the configured vault and the agent with enough ETH for gas. For trading, connect Robinhood through its official OAuth flow.
- Watch the dashboard. Use Activity, Approvals, and the LFI utility card to see execution, blocks, pending reviews, and usage.
Run a Chain payment
Use @leashfi/sdk from your agent service. The SDK verifies the agent, loads the current policy, checks spend, and then submits directly to the policy vault. Use network: "mainnet" for chain ID 4663.
import { privateKeyToAccount } from "viem/accounts"
import type { Address, Hex } from "viem"
import { LeashFi, ROBINHOOD_ASSETS } from "@leashfi/sdk"
const agent = new LeashFi({
account: privateKeyToAccount(process.env.AGENT_PRIVATE_KEY as Hex),
network: "mainnet",
vaultAddress: process.env.LEASHFI_VAULT_ADDRESS as Address,
apiKey: process.env.LEASHFI_API_KEY!,
walletId: process.env.LEASHFI_WALLET_ID!,
})
const result = await agent.pay({
to: "0xRecipientAddress",
amount: 60_000_000n, // 60 USDG, 6 decimals
asset: ROBINHOOD_ASSETS.USDG,
memo: "agent invoice",
})
console.log(result.status, result.transactionHash)| Asset | Decimals | Example |
|---|---|---|
| ETH | 18 | 1 ETH = 1_000_000_000_000_000_000n |
| WETH | 18 | 1 WETH = 1e18 |
| USDG | 6 | 60 USDG = 60_000_000n |
A payment returns success, pending_approval, blocked, or a failure status. Keep the returned transaction hash and approval ID in your agent logs.
Guard Agentic Trading
Robinhood brokerage access remains an OAuth connection between the user's MCP client and Robinhood. LeashFi sits in front of tool execution: read-only tools pass through, known order writes are checked, and unknown writes fail closed.
import {
RobinhoodTradingGateway,
TradingPolicyEngine,
} from "@leashfi/sdk"
const gateway = new RobinhoodTradingGateway(
new TradingPolicyEngine({
maxOrderNotionalUsd: 250_000_000n,
dailyTradingNotionalUsd: 1_000_000_000n,
tradedTodayUsd: 0n,
allowedSymbols: ["AAPL", "MSFT", "BTC"],
allowedOrderTypes: ["market", "limit"],
allowOptions: false,
allowCrypto: true,
requireReview: true,
}),
callOfficialRobinhoodMcp,
parseOrderIntent,
)
await gateway.callTool(toolCall)approval, do not retry the write blindly. Show the owner the pending request, resolve it in Dashboard → Approvals, then retry only after approval.Policies and approvals
Policies are the rules that every request must satisfy. Use the smallest permissions your agent needs, then expand deliberately.
A blocked request is not an approval request. A request above the configured threshold can wait for approval; an unknown tool, invalid address, or policy violation is rejected.
$LFI, tiers, and API credits
LFI is optional for basic access and stays in the user's wallet. The application reads the wallet's LFI balance on Robinhood Chain and derives a tier for workspace entitlements.
Token contract: 0x2A09f1AB7FA98eC1b733814E49a0806b4f3333F3 · chain ID 4663.
Production checklist
- Use a dedicated owner wallet and keep its private key out of the agent runtime.
- Use a separate agent signer with only the permissions it needs.
- Set conservative caps first; test a success, a block, and an approval path.
- Keep API keys in server-side environment variables. Never commit them to GitHub or expose them in browser code.
- Use a production RPC URL and confirm chain ID
4663before sending funds. - Monitor approvals and blocked actions; treat unknown writes as expected failures.