Collar Guardrail
Pre-Trade Risk API
← Back to app

Getting Started

Core Concepts

API Reference

More

API Documentation

A deterministic risk layer for autonomous trading agents.

Collar Guardrail provides deterministic, advisory risk checks for autonomous trading agents operating on Robinhood Chain.

Important: Collar Guardrail currently returns advisory verdicts. A deny response does not itself prevent an agent from submitting a transaction on-chain. The integrating agent is responsible for honoring the verdict.

Quickstart

Get up and running in under 2 minutes. This complete Python script demonstrates how to request a nonce, sign it, authenticate, and run a pre-trade risk check.

import requests
from eth_account import Account
from eth_account.messages import encode_defunct

# Configuration
BASE_URL = "https://backendai-x4m1.onrender.com"
PRIVATE_KEY = "0x..."  # Your agent's private key
account = Account.from_key(PRIVATE_KEY)
wallet_address = account.address

# Step 1: Get authentication nonce
res = requests.get(f"{BASE_URL}/api/v1/auth/nonce", params={"address": wallet_address})
res.raise_for_status()
message_to_sign = res.json()["message"]

# Step 2: Sign EIP-191 message
message = encode_defunct(text=message_to_sign)
signature = Account.sign_message(message, private_key=PRIVATE_KEY).signature.hex()

# Step 3: Exchange signature for access token
auth_res = requests.post(f"{BASE_URL}/api/v1/auth/wallet", json={
    "address": wallet_address,
    "signature": signature
})
auth_res.raise_for_status()
token = auth_res.json()["access_token"]

# Step 4: Analyze a trade before submission
headers = {"Authorization": f"Bearer {token}"}
trade_payload = {
    "wallet": wallet_address,
    "asset": "NVDA",
    "side": "buy",
    "amount": 10.0,
    "contract_address": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
    "request_id": "quickstart-test-001"
}

trade_res = requests.post(f"{BASE_URL}/api/v1/analyze/trade", json=trade_payload, headers=headers)
print("Trade Verdict Response:", trade_res.json())

Why Collar exists

Robinhood Chain is a blockchain built for autonomous trading agents. Agents on it are fast, tireless, and increasingly handling real money.

They are also probabilistic. Every LLM-based agent can hallucinate a token address, ignore its own risk rules under pressure, or be talked into a bad trade by a prompt injection hidden in some piece of data it happened to read. When that happens, the agent does not stop. It executes.

The existing risk tooling was not built for this. Most platforms in the space use machine learning to monitor activity across many chains. That is the right model for institutional security. It is not designed for the independent agent developer who needs a deterministic second opinion in one HTTP call.

Deterministic, not probabilistic. Collar does not use an LLM to make the verdict. The policy engine is a fixed set of rules. The same request always produces the same response, with a reason attached. Nothing is inferred, nothing is hallucinated, nothing can be prompt-injected.

Collar does not try to be smarter than the agent. It tries to be predictable in a way the agent cannot be. It sits outside the agent's runtime, at the last point before a trade is signed, and returns one of three answers.

VerdictWhat it means
allowNo rule was violated. Proceed.
warnSomething is off — high risk score, nearing a limit, unusual frequency. Proceed with caution, or don't.
denyA rule was violated. Do not submit the trade. The reason is in the response.

When to use Collar

You're shipping an autonomous agent

Add one HTTP call before every trade. If the verdict is deny, don't sign. That's the entire integration.

You run a frontend or a bot

Call Collar before submitting a user's trade. Show the verdict in your UI. Turn a deny into a stop button.

You're a DeFi protocol

Use Collar as a second opinion before liquidations or large position changes. Deterministic verdicts are auditable.

You just want to see what happens

Hit the unauthenticated demo endpoint, or connect a wallet in preview mode. No COLR required pre-launch.

How Collar differs

There are already tools that watch on-chain activity. Most of them are excellent — for their intended audience. Collar is built around four choices that put it in a different shape.

Design choiceWhat it means
REST API, not MCP Most agent guardrails ship as MCP servers, which only work for agents whose client speaks MCP. Collar is a plain HTTP API. Any language, any framework, any agent can call it.
Deterministic, not ML Most risk platforms use machine learning. That is the right model for institutional security. It is not the right model for a guardrail that needs to be predictable. Collar uses fixed rules. Same input, same output.
Advisory, not enforced Collar returns a verdict. It does not, today, block a transaction at the sequencer level. The integrating agent is responsible for honoring a deny. Stated plainly so no one assumes a guarantee that isn't there yet.
Stock-Token aware Robinhood Chain's tokenized equities have failure modes generic tools don't model: corporate actions that pause the oracle, weekend staleness, multiplier adjustments. Collar reads oraclePaused() and applies stock-specific staleness windows.

Collar is not claiming to be the first risk tool on Robinhood Chain. It is claiming to be a specific shape of one: API-first, deterministic, and stock-token aware.

Overview

Collar evaluates trade requests against a deterministic policy before the integrating agent submits them for execution. Each request is checked against:

  • USD trade notional limits based on wallet COLR tier.
  • Real-time Chainlink oracle prices for the traded asset.
  • Corporate-action pause state (oraclePaused()) for tokenized equities.
  • Feed staleness relative to heartbeat.
  • Asset restrictions configured for eligible tiers.
  • Potential runaway activity based on request frequency.

COLR is an access and tier-gating token

COLR is not the trade currency. Agents can submit trades involving other supported assets, such as ETH, USDG, or tokenized equities. The wallet's COLR balance determines the access tier:

TierCOLR balanceMaximum trade value
TIER 15,000+ COLR$5,000 USD
TIER 210,000+ COLR$10,000 USD
TIER 325,000+ COLR$25,000 USD

While COLR has not launched, the API grants a default Tier 1 to every authenticated wallet. See preview-tier testing below.

Verdicts

DecisionMeaning
allowNo configured rule violation was detected. Proceed.
warnA potential runaway-agent pattern, elevated risk score, or nearing-limit condition. The integrating agent decides its own policy: log, slow down, or alert.
denyOne or more policy rules were violated. Do not submit the trade. Reasons are always included.

Verdicts are advisory. Collar does not currently enforce the decision at the blockchain or sequencer level.

Asset registry

GET/api/v1/assets

Returns every symbol and its official contract address. Robinhood adds new tokens over time — refresh this periodically rather than caching indefinitely.

[
  { "symbol": "NVDA", "contract_address": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", "is_native": false },
  { "symbol": "ETH",  "contract_address": "NATIVE", "is_native": true }
]

Blocked-asset policy (Tier 2+)

GET/api/v1/config

Returns the wallet's current policy configuration.

{
  "blocked_assets": ["MEME", "XYZ"],
  "editable": true
}
POST/api/v1/config

Updates the blocked-asset list for Tier 2 and Tier 3 wallets.

{ "blocked_assets": ["MEME", "XYZ"] }

Trade requests against a blocked asset receive a deny verdict.

Rate limiting and runaway-agent detection

Collar tracks request frequency over a rolling 60-second window, per wallet, in Redis.

  • Tier 1: warn above 5 trades/min, deny above 15.
  • Tier 2: warn above 10, deny above 25.
  • Tier 3: warn above 20, deny above 50.

There is no separate API-level rate limit on /analyze/trade beyond this — it is the runaway-agent protection.

While COLR has not launched, every wallet is granted a default Tier 1. To test Tier 2 or Tier 3 behavior, add the header X-Preview-Tier: 2 (or 3). This header is silently ignored once COLR launches and a real balance check takes over.

Authentication

Authentication uses wallet signatures rather than API keys. The same private key the agent already holds for trading is used to sign a one-time challenge.

GET/api/v1/auth/nonce?address=0x...

Request a one-time nonce and the exact message to sign. The nonce expires in 5 minutes and can only be used once.

POST/api/v1/auth/wallet

Submit the wallet address and an EIP-191 signature of the message from the previous step.

{
  "address": "0x1234567890123456789012345678901234567890",
  "signature": "0x..."
}
{
  "access_token": "eyJ...",
  "expires_in_seconds": 3600,
  "preview_mode": true
}

Authenticated API requests use Authorization: Bearer <access_token>. To end a session immediately, call:

POST/api/v1/auth/revoke

Analyze a trade

POST /api/v1/analyze/trade

Submit a trade request for deterministic policy evaluation. Requires authentication.

Request

{
  "wallet": "0x1234567890123456789012345678901234567890",
  "asset": "NVDA",
  "side": "buy",
  "amount": 12.5,
  "contract_address": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
  "request_id": "a1b2c3d4-..."
}

Fields

FieldTypeDescription
walletstringWallet address authenticated by the session. Must match the JWT.
assetstringToken symbol (e.g. NVDA, ETH, USDG).
sidestringbuy or sell.
amountnumberQuantity of the asset — not a pre-computed USD value.
contract_addressstringMust exactly match the official contract for that symbol.
request_idstring (optional)Idempotency key. Reusing one within 5 minutes replays the original verdict.

Response

{
  "decision": "allow",
  "reasons": ["All guardrail checks passed"],
  "tier": 1,
  "max_trade_usd": 5000.0,
  "calculated_notional_usd": 2728.72,
  "price_usd": 218.298,
  "price_source": "oracle",
  "risk_score": 18,
  "timestamp": 1757520000,
  "request_id": "a1b2c3d4-..."
}

Error responses

StatusMeaning
400Malformed request (bad wallet format, invalid trade fields).
401Missing / expired / invalid token — re-authenticate.
403Wallet doesn't meet the tier threshold, or wallet mismatch.
429Rate limit hit on auth endpoints (20 req/min/IP).
5xxBackend issue — retry with backoff, don't assume "allow".
On any error, fail closed. If you can't get a verdict, don't trade until you can.

What's next

ItemWhy it matters
Behavioral guardrailsCooldown after loss, forced break after consecutive losses.
On-chain P&L analysisRead recent trades from Robinhood Chain and derive realized P&L.
Honeypot / rug-pull detectionContract-level checks: mint authority, ownership, sell tax.
Memecoin pricingRead price directly from Uniswap V4 pools without Chainlink feed.
Agent SDK (Python + JS)Thin client libraries for auth and retry logic.
On-chain enforcementMove from advisory to enforceable.

Verified against mainnet

The oracle path has been tested end-to-end against live Chainlink feeds on Robinhood Chain. Stock Token prices, oraclePaused() state, and staleness windows have all been exercised against real mainnet data.

Independence

Collar Guardrail is an independent third-party application built to provide a risk layer for autonomous trading workflows.

It is not built, operated, sponsored, or endorsed by Robinhood.

Robinhood Chain is the underlying network referenced by the integration. COLR is a separate token used for access and tier gating.