Pre-trade checks for AI trading agents
reTrade is an independent pre-trade check for AI trading. Before your agent’s order reaches the broker, the SDK asks reTrade, and the order is placed as sent, cut to what fits, or blocked.
What reTrade does
We make AI Agentic Trading mistakes insurable. Your AI agent still decides what to trade. reTrade checks each of its orders against rules your business sets, such as how much of the account one stock may take, and answers in the same request. No AI can change those rules, your own agent included.
Each order gets one of three answers. Nothing waits for a person: there are no holds and no approval step.
| Answer | What it means | What the SDK does | What your code does |
|---|---|---|---|
| ALLOW | The order fits every rule. | Places it as sent, once. | Keep the decision id with your order record. |
| CUT | It fits only at a smaller quantity. | Places the smaller quantity reTrade approved. | Treat quantity as what was placed. Don’t send the rest another way. |
| BLOCK | It breaks a rule, or no room is left. | Places nothing. | Don’t send it another way. Resize to fits when it’s set, re-plan or ask your user. |
Every answer comes with a signed receipt, chained into your log so any later change shows: the log is tamper-evident. The SDK keeps the signed records on your side, as evidence an insurer can review. reTrade is not an insurer, guarantees nothing and pays no losses.
How one order flows
- Your agentDecides on an order and hands it to the SDK with
place. - The SDKReads the account and a fresh quote from your broker through your adapter, signs the request with your bot’s key and sends it to reTrade.
- reTradeChecks the order against your rules, answers ALLOW, CUT or BLOCK with the rule that decided, signs the answer and chains it into your log.
- The SDKChecks the signature and that the answer is about this exact request, then places what was approved through your adapter: the order, the smaller size, or nothing.
- Your recordsThe SDK reports what the broker did, gets a signed receipt back and keeps all of it in the claim kit. Your agent gets the result.
reTrade never connects to your broker, never holds your broker login and never moves money. Only your own code, the adapter, talks to the broker.
An example
Your agent asks to buy 40 shares at a 187.25 limit, an order worth 7,490. The account’s per-order line is 5,000, so reTrade answers BLOCK, reason approval_line per_order, with fits of 26: 26 shares at 187.25 is 4,868.50. Nothing is placed. Your agent can send 26, re-plan, or ask its user.
What you need
- Python 3.12 or later, or Node 22.18 or later.
- A tenant at reTrade with at least one account in it. Access comes through a pilot: ask for one.
- From your admin: your bot’s key id and the account’s ref. From reTrade: its root public key.
- Your broker code: four small functions the SDK calls to read the account and to place, find and cancel orders.
Where to go next
- Quickstart: install, set your keys and run a first check.
- ALLOW, CUT and BLOCK: what each answer means for your code.
- Python SDK and TypeScript SDK: the full guides.
- SKILL.md: a file your AI coding agent can follow to add reTrade to a bot you already have.
reTrade is pre-release, and live trading isn’t switched on yet: test with a paper or practice account. Ids, prices and orders in these docs are illustrations.