Calling actions
Describes Orbit 0.1.8 ·What changed ·Markdown
This page is for agents that move money with Orbit 0.1.8: position changes, harvests, swaps, bridges and Hyperliquid perp orders. It gives the exact argument shape of each kind, a worked example, and the unit rules that caused most real-world mistakes. Tool replies win over this page: when a tool’s next, in_words or refusal says something different, follow the tool.
The pipeline in one line
Section titled “The pipeline in one line”Every write is discover → (quote or prepare) → simulate_action → execute_action.
simulate_actionbuilds the transaction, simulates it, runs the policy check against the signed mandate, and returns asim_receipt.execute_actiontakes thesim_receiptfor the identicalcall, re-checks policy with a fresh simulation, then signs and sends. A receipt for a different call is refused (simulation_required).- Both take
safe(the configured Safe name fromlist_safes) andcall(an object whosekindismanage_position,harvest,swap,bridgeorraw). - The receipt is short-lived: its lifetime is in
sim_receipt.valid_for_s. A receipt already past its lifetime whenexecute_actionis called is refused (simulation_stale, withage_sandvalid_for_s); nothing is sent, so simulate again and relay the newin_words. A receipt that runs out whileexecute_actionis already working is renewed once.
raw calls exist for developer mode only; under a mandate they are never priceable and are always denied. Do not use them.
Step 1: discover the exact action name
Section titled “Step 1: discover the exact action name”Rooted actions (positions and harvests) must be named exactly as the Safe’s root names them.
{ "tool": "list_actions", "arguments": { "safe": "base-safe", "kind": "management" } }kind filters on management, accounting, harvest or flashloan_management; protocol filters by protocol. Each entry has:
| Field | Use |
|---|---|
qualified_name |
The action id. Copy it exactly, character for character. Format <protocol>.<action>.<label>; the label is the position’s label and can contain spaces (for example hyperliquid.deposit_usdc_for_perp.Hyperliquid USDC funding and withdrawal). |
kind |
The module’s instruction type: management goes in a manage_position call; harvest goes in a harvest call. It does not say what the action does (Hyperliquid orders, cancels, closes and account transfers are harvest); the reply’s kind_meaning says so. Only an entry with claims_rewards: true claims rewards. |
params |
The input slots: each has name and kind (uint256, address, …). Pass every slot by this name. |
amount_units |
The unit rule for amount params (base units; see Units). |
claims_rewards |
Present on a reward-claim harvest: call it with no params. |
Rules:
- Never guess or reconstruct an id. An id that is not in the root is refused with
data.code: "unknown_action"(message starts “unknown action...: not in machine …‘s rootfile”). It is sent as JSON-RPC error -32602, so some hosts show only “invalid params”. If you see “invalid params” right after naming an action, calllist_actionsand copy the name. - Absence from
list_actionsis not a verdict on swaps or bridges. They are not rooted actions and never appear there. The reply’snot_listed_hereblock says where each is checked: a swap byget_swap_quote→executable, a USDC bridge route byget_setup_bridge_eligibility. - Pass numeric params as decimal strings (
"20000000", not20000000). As of 0.1.8 a JSON number is accepted but passes through floating point, so a large base-unit amount (above about 9 × 10^15) is rounded without warning.
preview_action resolves an action and its params into the on-chain instruction and merkle proof without simulating or sending. Use it to inspect or debug an encoding. It takes action and params (not mgmt_action):
{ "tool": "preview_action", "arguments": { "safe": "base-safe", "action": "<qualified_name>", "params": { "amount_to_deposit": "20000000" } } }Field names differ by kind
Section titled “Field names differ by kind”This is the most common argument mistake. A tool’s top-level arguments refuse unknown fields. Inside call (and a bridge order), a wrongly named field is silently ignored, not refused: the call then fails for the real field it lacks (for example, params on a manage_position is dropped and the action fails for a missing slot). Use the names in this table.
| Call | Action field | Params field |
|---|---|---|
kind: "manage_position" |
mgmt_action |
mgmt_params |
kind: "harvest" |
action |
params |
preview_action (tool) |
action |
params |
get_position_value (tool) |
action (an accounting action) |
params |
Position change (manage_position)
Section titled “Position change (manage_position)”Deposit, withdraw, supply, borrow, repay: any management action from list_actions.
{ "tool": "simulate_action", "arguments": { "safe": "base-safe", "call": { "kind": "manage_position", "mgmt_action": "<qualified_name from list_actions>", "mgmt_params": { "amount_to_deposit": "20000000" } } } }This deposits 20 USDC (6 decimals, so 20 × 10^6 base units). "20" would be 0.00002 USDC.
acct_actionandacct_paramsare optional. Leave them out: Orbit uses the root’s paired accounting instruction for the position.- To exit a position in full, prefer a decrease action whose name ends in
_relativeand takesbps_to_redeem, with"bps_to_redeem": "10000". It redeems the whole holding at execution time. Otherwise read the balance fresh (get_balanceswith"fresh": true) and withdraw that amount. - A failed simulation restates the amount it read. If it says you are moving a tiny amount, your units are wrong.
Harvest (harvest)
Section titled “Harvest (harvest)”Harvests are receive-only actions (claims, and on HyperEVM the transfers between the Safe and its Hyperliquid account).
{ "tool": "simulate_action", "arguments": { "safe": "base-safe", "call": { "kind": "harvest", "action": "<harvest qualified_name>", "params": {} } } }- An action with
claims_rewards: truetakes no params: Orbit fills the claim for this Safe and pays it only to the Safe. A reply withnothing_to_claim: trueis an answer, not a failure. - Leave
swap_ordersout. No Orbit tool builds one and aquote_idis not accepted there. To convert harvested tokens, harvest first, then swap. - Harvest amount params use the same base-unit rule as
mgmt_params.
Swap (swap)
Section titled “Swap (swap)”Three calls, in one persistent session, promptly:
{ "tool": "get_swap_quote", "arguments": { "safe": "base-safe", "input_token": "USDC", "output_token": "WETH", "amount": "50" } }- Tokens: a 0x address, or a symbol when exactly one of the Safe’s tokens on that chain has it (otherwise the refusal lists candidates). HyperEVM’s
USD₮0can be namedUSD₮0orUSDT0, and only at its listed address; any other token calling itself that is not picked by name. amount: "max"quotes the Safe’s whole balance of the input token, read when quoting. A zero amount, or a swap of a token into itself, is refused.- Amount:
amountin token units ("50"is 50 USDC) oramount_rawin base units ("50000000"). Never both. Older fields (input_amount,input_amount_raw,input_amount_human) still work but cannot be combined with the new ones. slippage_bpsis optional; its default is stated in the tool’s argument schema, andmin_outshows the floor the tolerance produces.- Read
executable. When it isfalse, do not simulate:missing_feed_routesorbalance_notesays why. - Tell the user
output.expected_out_humanandoutput.min_out_humanwithoutput.symbol. The rawexpected_outandmin_outare output-token base units.
{ "tool": "simulate_action", "arguments": { "safe": "base-safe", "call": { "kind": "swap", "quote_id": "q_..." } } }{ "tool": "execute_action", "arguments": { "safe": "base-safe", "call": { "kind": "swap", "quote_id": "q_..." }, "sim_receipt": "<sim_receipt object or its id>", "idempotency_key": "swap-usdc-weth-2026-11-17-01" } }- The quote lives for the
expires_in_sin its reply (set by[mcp] quote_ttl_sin the config). If it expires between simulate and execute, Orbit re-quotes once with the same parameters: the result hasrequoted: true, and whenmin_out_changedis true you must tell the user the new minimum fromnotes.requote. - A stale quote at simulate is refused with
quote_stale; an unknown id withquote_not_found(usually a quote from another process). Re-quote. - Swaps and bridges always simulate on the local fork, or on Tenderly if you pass
backend: "tenderly". A requestedeth_callis overridden, with a note. The on-chainminOutputAmountfloor and the module’s swap loss cap still bind. The simulation’spolicy.swap_constraintsshows the swap-loss limit and the module’s swap fee (swap_fee_rate_pct), which is charged on the output on top of that limit; relay itsswap_fee_note.
Bridge (bridge)
Section titled “Bridge (bridge)”Moves tokens between the owner’s own Safes on different networks. Not a rooted action.
- USDC uses Circle CCTP,
bridge_id: 3. Check the route first:
{ "tool": "get_setup_bridge_eligibility", "arguments": { "source_safe": "base-safe", "safe": "hyperevm-safe" } }An unavailable route comes back as an error, not false. Tell the owner the USDC route is not set up.
- Simulate:
{ "tool": "simulate_action", "arguments": { "safe": "base-safe", "call": { "kind": "bridge", "order": { "bridge_id": 3, "dest_chain": "hyperevm", "input_token": "USDC", "output_token": "USDC", "amount": "10", "min_output": "10" } } } }amountandmin_outputare token units ("10"is 10 USDC). Base-unit forms areamount_rawandmin_output_raw.dest_chainis the network’s config name:base,mainnet,hyperevm.recipient, when left out, is a matching[[safes.<name>.bridge_intents]]recipient in the config, else the Safe configured ondest_chain, else this Safe’s own address.- CCTP:
min_outputequal toamountrequests a 1:1 self-claim (no fee); a lower floor sets the difference as a forwarding fee budget.cctp_finalityisstandard(default) orfast(needs a fee budget). - Other tokens use Across,
bridge_id: 1. A relayer takes a fee, somin_outputmust sit belowamountby enough for it, within the Safe’s bridge loss cap. A floor equal to the amount is unlikely to fill; unfilled money returns on the source network after the fill deadline (optionalfill_deadline_offset_s; its default is described in thebridgeorder’s argument schema, and the tracked transfer recordsfill_deadline_unix). The eligibility tool does not cover Across: the simulation is the route check. bridge_id: 2(LayerZero) is refused.
- Relay
in_words, thenexecute_actionwith the samecall.
A successful bridge execution means the money left, not that it arrived. The simulation only validates the source-chain send; settlement is decided by a destination-chain event. Follow it in health_check → reliability.bridge_transfers (CCTP) or list_incomplete_operations by disposition (Across). Any Orbit that starts claims a ready CCTP transfer; there is nothing to sign.
Hyperliquid perp order (HyperEVM Safe)
Section titled “Hyperliquid perp order (HyperEVM Safe)”Never encode an order’s size or price by hand.
{ "tool": "prepare_perp_order", "arguments": { "safe": "hyperevm-safe", "market": "ETH", "side": "buy", "size_usd": "25", "order_type": "limit", "limit_price": "3000" } }market: the coin (ETH), the package label, or the position id.side:buy(long) orsell(short).- Size:
sizein coins orsize_usdin USDC notional. order_type: "limit"needslimit_price(USDC).order_type: "market"needsslippage_bps(unless the package declares one), which only the owner chooses: ask, never pick one.- To close, pass
"close_position": trueinstead of a side (without a size it closes the whole position). - An order under Hyperliquid’s opening minimum is not a refusal with a
code: the reply isready: falsewithstate: "below_minimum", andin_wordsstates the minimum and the smallest size that clears it. Its other “cannot prepare” answers use the same shape, so branch onstate. It rounds size and price to the market’s steps, saying so. - It returns
in_wordsand acall. Pass thatcallunchanged:
{ "tool": "simulate_action", "arguments": { "safe": "hyperevm-safe", "backend": "fork", "call": "<call from prepare_perp_order>" } }Use "backend": "fork": Orbit reads the order’s CoreWriter intent only from fork receipt logs. Without it the order can be refused as core_order_unverified (nothing was sent; relay its message and workaround_text).
Then execute_action with the same call, the receipt and an idempotency_key.
- A successful order is enqueued at Hyperliquid, not filled. Relay
core_order.status_lineand check the position, not the HyperEVM transaction. - One open order per market slot. A prepared order reserves nothing: send or drop it before preparing another on the same market.
- No Hyperliquid signer is needed to open, close or cancel through the module. A signer is needed only for leverage and margin changes and for stop-loss / take-profit (
protect_position). - Funds must be in the Safe’s Hyperliquid trading account first (
hyperliquid.deposit_usdc_for_perp.<label>, a harvest action). While a transfer is still settling, increases are refused; wait and retry.
Units caused the most expensive real mistake: an agent passed "10" in mgmt_params for 10 USDC, which is 0.00001 USDC, got a value-loss refusal, and read it as “venue blocked” for days.
| Where | Unit | 10 USDC is | Notes |
|---|---|---|---|
mgmt_params amount slots (manage_position) |
base units of the action’s token | "10000000" |
list_actions → amount_units says so. Token decimals are in get_balances. Non-amount uint params (price, size, index) keep their own scale. |
harvest params amount slots |
base units | "10000000" |
Same rule as mgmt_params. |
hyperliquid.deposit_usdc_for_perp → usdc_amount |
USDC base units (6 decimals) | "10000000" |
Harvest action, Safe to Hyperliquid account. |
hyperliquid.transfer_usdc_perp_to_spot / transfer_usdc_spot_to_perp → transfer_amount |
6 decimals | "10000000" |
Inside the Hyperliquid account. |
hyperliquid.withdraw_usdc_to_evm withdraw amount |
8 decimals (HyperCore USDC) | "1000000000" |
100× the 6-decimal figure. It moves USDC from the spot balance. The current package names the slot withdraw_amount_core_usdc; older packages named it withdraw_amount_wei, with the same unit. |
HYPE spot sale (sell_spot) limit_px / sz |
price 6 decimals / size 2 decimals | price 1 USDC = "1000000"; 1.5 HYPE = "150" |
Owner picks the lowest price. |
get_swap_quote amount |
token units | "10" |
amount_raw for base units. |
bridge order.amount, order.min_output |
token units | "10" |
amount_raw / min_output_raw for base units. |
prepare_perp_order size_usd, limit_price |
USDC (token units) | "10" |
Orbit converts to the order’s wire format. |
Swap quote expected_out, min_out (reply) |
output-token base units | Quote *_human fields to the user. |
|
Mandate caps (per_tx, daily_deployment, …) |
accounting-currency units | "10" |
Human figures, not base units. |
When unsure, simulate: in_words restates the amounts in token units. If it says something other than what the user asked for, stop and fix the units.
What simulate returns, and what to read
Section titled “What simulate returns, and what to read”Read these before calling execute_action:
| Field | Meaning | Do |
|---|---|---|
in_words |
One verdict line, then what the action does in plain words (amounts, symbols, side, leverage, a dollar value when priced). | Relay it to the person before executing. |
restatement_verdict |
The verdict line alone: “Ready to send.” or “Won’t go through: …”. | Same sentence that opens in_words. |
ready_to_execute |
true only when execute would proceed. |
Execute only on true. |
next |
What to do now, in one line. | Follow it; on false relay it. |
policy |
The mandate verdict: verdict allow / needs_review / deny, with rule, explanation, remediation; policy_is_primary; for bridges settlement. |
deny: relay and stop. needs_review: executing will queue it for the owner. |
sim_receipt |
id and valid_for_s (its lifetime in seconds). |
Pass it (or its id) to execute_action promptly. |
success, error |
Whether the simulated transaction succeeded; the decoded revert on failure. | |
refusal |
The module refused on chain: code, status_for_the_user, next. |
Relay status_for_the_user as written, follow next, never paste the raw error. |
operating_mode |
OPEN, FENCED, WALLED or UNKNOWN. |
Outside WALLED the chain does not check position-change losses (FENCED still checks swaps and bridges; OPEN checks neither); the mandate is the binding limit. |
ran_on, backend |
Where it ran. ran_on: "fork" is a practice copy. |
Never report a practice run as money moved. |
fidelity_note, sim_backend_fallback_from |
The fork failed and a lighter backend answered. | Relay the note. |
What “executed” means
Section titled “What “executed” means”execute_action returns either a review or a send:
status: "pending_confirmation"withpending_id: the action is above a review threshold and is queued for the owner. Relayapprove_hint. Underveto_windowit runs at the deadline unless the owner objects; underexplicit_approvalit waits for an approval (record_review_outcomewith the owner’s genuine quoted reply, or the owner page). Track it withget_confirmation.- Otherwise
statusis the send’s outcome:
status |
Meaning | Do |
|---|---|---|
success |
Mined and succeeded on the source chain. | Report it. For a bridge or a Hyperliquid order, say it was sent, not that it arrived or filled. |
reverted |
Mined and failed. | Relay the decoded error; do not resend unchanged. |
pending |
Sent, not mined yet. | Follow next. Retry only with the same idempotency_key. |
unknown_broadcast |
Orbit could not establish the outcome; it may still land. | Never resend under a new key. Check list_incomplete_operations. |
dropped |
The chain does not have it. | Follow next. |
The idempotency_key is yours to choose. Reusing a key returns or continues the original send; a new key is a new send.
“Executed” is not “settled”: a successful swap or position change is final on that chain, but a bridge settles only when the destination event is seen, a Hyperliquid order is only enqueued, and a queued-vault withdrawal request pays out when the request settles.
See also
Section titled “See also”- Refusals and recovery for every refusal code.
- Permissions and limits for what the mandate and module check.
- Bridging and Hyperliquid perps for the full workflows.
- Guides:
get_guidewithname: "orbit-portfolio"andname: "orbit-hyperliquid-perps".