Limits discovery#
Read your remaining room before every action. One block, every number sourced.
GET /torii/mandates/{id} and MCP mandate_get carry one limits block next to clauses. The answer to POST .../events returns the same block after your event, so a loop needs no extra read. There is only this one limits key. A mandate read from an older build has no limits: treat that as unknown and read clauses 2 and 3.
Shape#
{
"allowed": {"per_tx": "25.000000", "per_day": "60.000000", "stop_floor": "170.000000",
"budget": "200.000000", "ends_at": "2026-11-10T09:00:00Z",
"source": "terms", "caps_source": "columns"},
"used": {
"spent_24h": {"value": "24.000000", "source": "chain", "basis": "chain_window"},
"left_today": {"value": "36.000000", "source": "chain", "basis": "chain_window"},
"left_total": {"value": "176.000000", "source": "events", "basis": "chain_events"},
"per_action_max": {"value": "25.000000", "source": "chain", "basis": "chain_window"},
"window_frees_at": {"value": "2026-10-13T08:10:00Z", "source": "events", "basis": "rolling_24h"},
"largest_action_24h": {"value": "24.000000", "source": "events", "basis": "chain_events"},
"spent_total": {"value": "24.000000", "source": "events", "basis": "chain_events"}
},
"breaches": {"count": 0, "last": [], "reverts": {"count": null, "source": "none"}, "outside_limits": "none"}
}
The values above are illustrative.
Fields#
| Field | Meaning |
|---|---|
allowed | per_tx, per_day, stop_floor, budget (6-decimal strings), ends_at, source: terms, caps_source (columns: caps the owner set as fields; legacy_caps_entry: an older row; budget: caps left out default to the whole budget) |
used.spent_24h | Spend in the last 24 hours. From the vault itself when the chain is readable, else from chain-confirmed events, else from your own reports |
used.left_today | per_day minus spent_24h, never below zero |
used.left_total | budget minus all spend, never below zero |
used.per_action_max | The largest single action that stays inside every limit right now: the smallest of per_tx, left_today and left_total |
used.window_frees_at | When the oldest spend in the 24-hour window leaves it, so room opens again. null (basis: nothing_in_window) when nothing is in the window. The window is rolling, not a calendar day |
used.largest_action_24h, used.spent_total | Facts from the same ledger |
breaches | count, the last few rule breaks (at, kind, amount_usdc, codes, clauses, source), reverts, and outside_limits: none, flagged or unknown |
Usage and refusals on the same read#
GET /torii/mandates/{id} (and mandate_get) also carries two small blocks for live widgets, derived from the same ledger as limits. The detail read is for page load (it refreshes from the chain and loads the whole ledger); polling widgets read GET /torii/mandates/{id}/live instead, which gives the same keys from stored rows only.
usage:{today_usdc, largest_action_usdc, window: "rolling_24h", source}.today_usdcisused.spent_24handlargest_action_usdcisused.largest_action_24h, so on the detail read the widget never disagrees with the cap. On/livethe figure is always the events figure (source: "events"); the detail read may show the chain's ownspentInWindowinstead (usage.source: "chain"), so the two can differ slightly until the vault's events are ingested. Both arenull(never"0.000000") while nothing is known.refusals_7d: the number of refused attempts on the record in the last 7 days: agent refusal reports, chain-proved reverts and the keeper'sowner_declinednotes, each counted once (a chain row that only proves an agent's report is not a second one). It counts the whole ledger, not just the 150 steps the record shows.nullon a draft.
The owner's read adds agent: {agent_id, name, last_seen_at, channel}: when the agent's key was last seen (the first call in each minute) and over which door (mcp or http). Both are null until the first call is recorded. You do not see this block on your own read.
Sources and bases#
Every number in used is {value, source, basis}.
valueis a 6-decimal string, ornullwhen unknown. Never"0.000000"for unknown.sourcesays who knows it:chain,events,termsornone.basissays how it was derived:chain_window,chain_events,chain_events+agent_reports(chain rows plus the agent reports no chain log claimed, such as x402 and venue spend; the same number the cap enforces),agent_reports,none_recorded,rolling_24h,nothing_in_window.
When chain Executed events exist, your own buy and move reports are not added on top (single counting).
Rules of thumb#
- Plan each action to stay under both
used.left_todayandallowed.per_tx. The contract refuses anything above either. - The chain counts the rolling 24 hours in hourly steps, so stay a little under
left_today. fees.net_after_fees_estandfees.net_after_fees_realizedare separate figures. Never add them.outside_limitsisnoneonly when the mandate is signed and nothing is flagged.- A refused or flagged attempt counts in
breacheswhere the owner sees it.
Clauses 6 and 7: what Torii holds and what it closes#
Read clauses[5] (asking) and clauses[6] (at the stop line). Each has status (enforced or stored_pending), enforced_by and a scope object.
{"n": 6, "key": "asking", "status": "enforced", "enforced_by": "Torii guard",
"text_en": "asks you before any action above 25.00 USDC; enforced by Torii guard for relayed actions; direct vault calls are only limited by the contract caps",
"scope": {"covers": "relayed_actions", "relayed": ["execute-call", "mandate_execute_call"],
"not_covered": "direct vault calls signed and sent by the agent",
"text_en": "enforced by Torii guard for relayed actions; direct vault calls are only limited by the contract caps"}}
{"n": 7, "key": "at_stop", "status": "enforced", "enforced_by": "Torii guard",
"scope": {"covers": "relayed_positions", "markets_with_close": ["hyperliquid"], "markets_without_close": [],
"keeper_dry_run": false, "text_en": "closed by the Torii keeper for positions opened through Torii's relay; ..."}}
scope is null when the clause asks nothing (clause 6 mode: own, clause 7 mode: keep). Clause 7 is stored_pending when any market has no close, or while the keeper runs in dry run; markets_without_close names them.
Clause 6 in your loop. Orders above 25% of the budget or above 1,000 USD (whichever is smaller) wait for one owner tap; the owner can set a different line, and the limits view keeps approval_above_usdc as the owner's own value (null when unset), shows the line in force as reconfirm_line_usdc, and approval_source says owner or default. An order at the line passes; above it waits. If your execute-call / mandate_execute_call / hl-order is above the line, you get HTTP 202 {status: "pending_approval", approval: {id, status: "pending", amount_usdc, threshold_usdc, expires_at}} and no calldata. Poll GET /torii/mandates/{id}/approvals or MCP mandate_approvals (approval_id, status filters). When the item reads approved, ask for the same call again (same target, data and amount): it is released once and the item becomes executed. A declined item makes the next ask fail with owner_declined (HTTP 409) and the record shows Refused: owner_declined. An item not decided in 24 hours reads expired; asking again opens a new one. At most 10 items wait at once. A call you sign and send without asking Torii for calldata is not held; only the contract caps limit it.
Asking for more room. POST /torii/mandates/{id}/approvals/request with {"kind": "cap_raise", "per_tx_cap_usdc", "daily_cap_usdc", "reason"} (agent key only; the new caps must be above the current ones and not above the budget) opens a pending item of kind cap_raise, listed with the other approval items. One owner tap raises the caps and writes a cap_raise_approved note; nothing changes before that. Same 24 hour life and 10-item limit. Cap raise applies to Hyperliquid-only mandates; vault mandates keep the caps they signed (the request is refused with 409 cap_raise_not_available: this mandate's limits are written into its vault terms; they cannot be raised after signing). The approved caps are checked again at approval time and are never lowered.
Clause 7 in your record. When the chain shows worth below the stop line (or the vault stopped) and the owner chose close, the keeper records one stop_line step per market (closed, no_position, failed, close_unavailable), each marked Computed by Torii. Markets without a close are yours to unwind with unwind-call.
Limits on a Hyperliquid mandate#
A mandate with Hyperliquid and no vault (hl_native) has no contract behind it. Torii enforces these numbers on hl-order / mandate_hl_order.
| Topic | Value |
|---|---|
| Per-action default when the owner leaves it empty | min(budget, max(12.5% of budget, 11 USDC)). A vault mandate gets the whole budget. A draft you create with mandate_propose gets the whole budget for both caps when you omit them |
| Per-day default when empty | The whole budget, never below per-action. The Standard preset on the owner's screen fills 30% of the budget, at least per-action |
| Owner value under 10 USDC | Accepted with a warning (code: per_tx_below_hl_min, field per_tx_cap_usdc): "Hyperliquid needs at least 10 USDC per order; below that your agent cannot trade." |
| 10 USDC minimum | Venue rule. hl-order does not pre-check it: a smaller opening order is sent and Hyperliquid answers status: rejected. usd is turned into coins rounded down to the size step, so the real minimum can be well above 10 (0.1 of a $40 market is $4 a step). Check trading.min_order_usd_safe before sizing an order (get_kg_facts with the ticker, or GET /markets/trading-rules) and size from it |
| Counted by per_tx and daily | Opening orders only (notional_usd). Reduce-only is not counted or capped. A rejected order is removed again. UTC day. Over the limit: 403 tw_hl_over_cap, which: per_tx or daily, with remaining_usd |
| Reconfirm line | approval_above_usdc, else min(budget x TW_RECONFIRM_BUDGET_PCT / 100, TW_RECONFIRM_USD) (25 and 1000). An open above it answers 202 pending_approval. The owner sees it as "Waiting for you". Reduce-only is never held |
| Stop line | Whole Hyperliquid account worth (all dexs plus spot USDC, less a 15 bps exit allowance on open positions) against budget x (1 - stop_floor_bps / 10000) |
| Not armed | Opening orders: 409 wrong_status, "the stop line is not armed yet: fund the Hyperliquid account to at least the stop line (amount) USDC and wait for the next check". Clears after one check at or above the line |
| Other waits | A failed last read, or a check older than 1200 seconds (TW_HL_NATIVE_MARK_MAX_AGE_SEC): 409 wrong_status. Reduce-only always passes |
| Line crossed | Status stopped; the keeper sends reduce-only IOC closes (bands 5%, 10%, 15%); notes floor_stop, floor_closed, stop_line_done. on_floor is ignored |
| Editing | Nothing after signing (409 wrong_status). Caps can only rise through a cap_raise approval |
What to do:
- Read the
limitsblock ofGET /torii/mandates/{id}first:allowed.per_tx,allowed.per_day,used.left_today,used.per_action_max,reconfirm_line_usdc. - Send opening orders of at least 10 USDC and at most
used.per_action_max. If a 409 says "not armed", wait for the next check and send again. - On 202
pending_approval, pollmandate_approvalsand resend the same order after the owner approves. Send closes withreduce_only: true.