Hand this to your agent
Start here, then https://essey.xyz/llms.txt. This page is the testnet path an agent can finish from the public docs and the packages @esseyonsui/sui-sdk 0.1.12 and @esseyonsui/sui-mcp 0.1.16. Mainnet is not deployed. The code is not audited. The Groth16 keys are a TEST-ONLY single-party setup. tUSDsui is the mock coin mock_usdsui::MOCK_USDSUI.
Hosted AI mode is off: a lender form with aiMode: true is refused. A hosted account holds at most 3 agents (maxAgentsPerUser on GET /v1/config). Revoke one to free a slot. More agents are self-run (ESSEY_TREASURY, ESSEY_AGENT_CAP).
Essey's sealed rooms are Essey Move contracts. Mysten has not published a Sui Agent Rooms SDK, so do not look for a Rooms package.
Install#
Node 22 or newer. The install that does not print the three high advisories is the root package.json in Install:
{
"dependencies": {
"@esseyonsui/sui-sdk": "0.1.12",
"@esseyonsui/sui-mcp": "0.1.16"
},
"overrides": {
"underscore": "1.13.8"
}
}@esseyonsui/sui-mcp@0.1.16 depends on @esseyonsui/sui-sdk@0.1.12. The override is required because snarkjs@0.7.6 pulls bfj → jsonpath → underscore@1.13.6 (GHSA-qpx9-hpmf-5gmw). npm applies overrides only from the project that is installing.
Save the two id files and do not edit them:
API=https://sui-agent-prototype-production.up.railway.app
curl -s $API/v1/config > essey-testnet.json
curl -s $API/v1/private/config > essey-private.json
curl -s $API/healthz
curl -s https://essey-relayer-production.up.railway.app/healthzIs ESSEY_DEPLOYMENT. GET /v1/private/config is ESSEY_PRIVATE. Its saleRoomV2 and privateLoanV2 sections are the sealed-settlement rooms. Chain id 69WiPg3DAQiwdxfncX6wYQ2siKwAe6L9BZthQea3JNMD. If kill.on is true, the service has stopped building transactions.
Fund#
| Coin | How | Stuck when |
|---|---|---|
| SUI | Install the CLI, then sui client faucet --url https://faucet.testnet.sui.io --address <ADDRESS>. On macOS: brew install sui. Elsewhere: Cargo from source, or a release binary. The install page those commands come from is https://docs.sui.io/guides/developer/getting-started/sui-install (suiup install sui@testnet is that page's recommended installer). About 1 SUI into the address balance. A person can use https://faucet.sui.io. | POST /v1/faucet/sui returns 400 SUI_FAUCET_EXTERNAL. Mysten's HTTP route POST https://faucet.testnet.sui.io/v2/gas returns compatibility_disabled. Do not call it. On a rate limit, wait and retry, or use another address. One grant is not enough for a full SUI sale plus a SUI loan. Request the faucet again. |
| tUSDsui | POST $API/v1/faucet/usdsui {"address":"0x..."}. 10 tUSDsui, once per address per day. | 429 ADDRESS_FUNDED_TODAY, TRY_LATER or FAUCET_EMPTY_TODAY. |
| USDC | POST $API/v1/faucet/usdc {"address":"0x..."}. 2 USDC, once per address per day. | 503 RESERVOIR_EMPTY when the reservoir holds less than one amount. Read available on GET /v1/faucet first; when it is short, retry later or ask the operator. refill names the Circle testnet faucet (20 USDC per address every 2 hours, https://faucet.circle.com, network Sui Testnet), a browser form behind reCAPTCHA, made for a person. |
Lists amounts, limits and available. Coin type for USDC is 0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC.
Gas: a transaction the hosted API builds is sponsored. A self-run agent pays its own gas. ESSEY_GAS=address-balance spends faucet SUI as it arrives. ESSEY_GAS=coins (the MCP default) needs one SUI coin of at least 50,000,000 MIST, which EsseyOwner.fundGas sends. Sale-room calls are never sponsored. The SUI pool insert fee is 0.1 SUI per deposit. A pool bid or loan offer pays that fee twice more (change note and refund note).
Three ways to send the same flows#
Each track below is enough to start. Do not import the other track's package.
SDK#
Install @esseyonsui/sui-sdk 0.1.12 with the override above. Point ESSEY_DEPLOYMENT at the saved GET /v1/config and, for private flows, load GET /v1/private/config. Fund with the faucet table. Proving keys are @esseyonsui/proving-keys-testonly and @esseyonsui/settle-keys-testonly, both 0.1.0, from https://cdn.jsdelivr.net/npm/@esseyonsui/proving-keys-testonly@0.1.0/manifest.json and https://cdn.jsdelivr.net/npm/@esseyonsui/settle-keys-testonly@0.1.0/manifest.json. Then Quickstart, EsseyOwner (the owner side: a plain wallet key, no browser and no passkey), Owner actions, and Private flows. One upkeep pass is upkeep with dryRun: true.
MCP only#
Do not call the SDK for the flows. npx essey-sui-mcp over stdio after essey-sui-init. The server requires an agent key file before it starts, even to list its tools. It reads the path only from ESSEY_AGENT_KEY_FILE. That variable is required and has no default. From the project that installed the packages, this writes a mode-600 testnet file and prints the new address: node --input-type=module -e "import { createAgentKeyFile } from '@esseyonsui/sui-sdk'; console.log(createAgentKeyFile('agent.env', 'testnet'))". That command only writes the key file. Point the server at it with ESSEY_AGENT_KEY_FILE=agent.env. essey-sui-init --key writes the same kind of file when that path is missing. ESSEY_DEPLOYMENT is GET /v1/config. ESSEY_PRIVATE is GET /v1/private/config saved unchanged. Fund with the faucet table. The public tools are MCP server (24 tools). The private tools, including the wallet loan room, v1 sales, and relayed v2 settle, are Private-flow tools. Wallet room: essey_wallet_loan_open, essey_wallet_loan_bid, essey_wallet_loan_open_bids, essey_wallet_loan_settle, essey_wallet_loan_repay, essey_wallet_loan_decline, essey_wallet_loan_refund. v1 sales, in order: essey_sale_open_v1, essey_sale_attest_v1 (required; bids abort 23 without it), essey_sale_bid_address_v1 or essey_sale_bid_v1 (one kind per room, set by shieldedOnly), essey_sale_finish_v1 or essey_sale_expire_v1, essey_sale_collect_v1, essey_sale_claim_v1. essey_loan_settle_v2 with relayed: true posts settle_relayed_v2. essey_upkeep with dryRun: true signs nothing.
Raw HTTP only#
Do not import @esseyonsui/sui-sdk or @esseyonsui/sui-mcp. fetch or curl, Content-Type: application/json, sign with @mysten/sui. Config is GET /v1/config and GET /v1/private/config. Faucets are GET /v1/faucet, POST /v1/faucet/usdc, POST /v1/faucet/usdsui, and Sui's own faucet (POST /v1/faucet/sui is SUI_FAUCET_EXTERNAL). Every shielded, v2, and v1 step, the local Poseidon, snarkjs, and Seal steps, and all eight relayer bodies are Raw HTTP private flows. Proving keys are the same two 0.1.0 packages named in the SDK track, downloaded by URL, not imported from the Essey SDK. Upkeep that signs nothing is POST /v1/upkeep/dry-run.
| Way | When |
|---|---|
| MCP | The MCP-only track above. |
| SDK | The SDK track above. |
| Raw HTTP | The raw HTTP track above. Self-serve API is the hosted account surface. |
Admin routes (POST /v1/admin/kill, /deny, /undeny, /denied) answer 403 NOT_ADMIN without the operator token. Do not call them.
Sign in before any session route: POST /v1/auth/challenge {address}, sign the message as a Sui personal message, POST /v1/auth/session {address, message, signature} → token. Send Authorization: Bearer <token>. POST /v1/auth/logout ends it. GET /v1/me is the address, the sign-in scheme and {sui, loan} balances. GET /v1/errors needs no session and names the Move aborts.
A built transaction is POST the build route, sign bytes with signTransaction, then POST the execute route {signature} within 120 seconds. Owner builds are POST /v1/agents/:id/tx. Borrow builds are POST /v1/borrow/tx.
1. Public lending#
Hosted lender: POST /v1/agents {name, preset} (steady, yield or refinancer), POST /v1/mandate/preview {form}, then create with that form and an amount. Later: set-mandate, deposit, withdraw, revoke, claim-default. Forms and refusals: Agent transactions.
Hosted borrower presets are taker, switcher and shopper. Preview the form at POST /v1/borrow/preview. create and deposit take the form. rules rewrites the rules without moving money. deposit without a form adds USDC to the cash treasury. withdraw, revoke, repay, claim and add-collateral are the other borrower actions. aiMode must be omitted or false.
After create lands, POST /v1/agents/:id/launch. POST /v1/agents/:id/pause and /stop halt it. POST /v1/agents/:id/settings sets autoTopUp and autoClaim for a hosted borrower. GET /v1/agents/:id returns the agent, the runner, balances and warnings. GET /v1/agents/:id/loans and GET /v1/agents/:id/activity are the loan list and the feed. GET /v1/agents lists the account's agents.
Self-run, when the agent holds its own key: POST /v1/agent/challenge and /session (a different message from the owner challenge), POST /v1/agent/setup {side} → code, the owner POST /v1/byo/peek {code} then POST /v1/byo/claim {code, name, preset}, then the owner create above. The agent sends its own bytes to POST /v1/agent/sponsor. The server will not launch a self-run agent (SELF_RUN). Details: Self-run agents.
The agent's own lending calls, once the account exists, are SDK EsseyAgent or the MCP tools essey_post_offer, essey_cancel_offer, essey_borrow, essey_repay, essey_refinance, essey_add_collateral, essey_claim, essey_upkeep. Reads: essey_status, essey_offers, essey_loans, essey_quote, essey_rooms, essey_warnings. Quote before borrowing. A size the oracle refuses is EOverMarketLtv.
2. Borrow from the owner's wallet#
These are session routes. The operator sponsors them. "gas": "own" pays from the wallet after 429 SPONSOR_BUDGET_SPENT.
| Call | What it does |
|---|---|
POST /v1/borrow/quote {collateral, amount} | Offer, pool and room quotes before anything is signed. |
POST /v1/borrow/preview {form} | Borrower-agent rules, nothing signed. |
GET /v1/borrow/rooms | Rooms this address opened. |
GET /v1/borrow/rooms/:id | One room, its sealed offers, and the Seal material. |
GET /v1/borrow/loans | Newest loans whose deed this address still holds. |
GET /v1/borrow/history | Older loans. |
POST /v1/borrow/tx offer-fill | {offerId, collateral, amount, maxRateBps}. |
POST /v1/borrow/tx pool-borrow | {collateral, amount, maxRateBps}. |
POST /v1/borrow/tx repay | {loanId}. Pays what the loan will owe five minutes ahead. |
POST /v1/borrow/tx add-collateral | {loanId, collateral} in SUI. |
POST /v1/borrow/tx refinance | {loanId, offerId} from a REFINANCE_CHEAPER warning. Offer to the same lender treasury aborts CommandArgumentError argument 5. Pool to offer, and offer to a different lender, work. |
POST /v1/borrow/tx claim-surplus | {loanId} after liquidation, write-off or default. |
POST /v1/borrow/tx room-decline or room-refund | {roomId} for a v1 room. |
Execute with POST /v1/borrow/tx/:txId {signature}. Field rules: Borrow transactions. room-open and room-settle are the v1 loan room. Do not open one: settle publishes every losing rate. Use section 4.
MCP wallet loan room, when a caller still wants that v1 room: essey_wallet_loan_open, essey_wallet_loan_bid (same Seal offer as essey_sealed_bid), essey_wallet_loan_open_bids, essey_wallet_loan_settle, essey_wallet_loan_repay, essey_wallet_loan_decline, essey_wallet_loan_refund. The signer is the wallet. Salts from open-bids stay in the mode-600 file and are not returned.
3. Classic shielded sale#
Still supported. Finish publishes every bid price. For a sale whose losing bids stay sealed, use section 4.
Deposit into the coin's shielded pool, prove a pass (POST /v1/private/credential or POST /v1/agent/credential with {commitment} only, then a membership proof), seal the bid, and POST kind=bid to the relayer path for that coin. Withdraw with kind=withdraw. Open, attest, finish, claim and expire are chain transactions from the seller's or winner's key. The copy-paste raw HTTP path, including the local Poseidon, snarkjs and Seal steps, is Raw HTTP private flows. MCP, and attest before any bid: essey_sale_open_v1, essey_sale_attest_v1, essey_sale_bid_address_v1, essey_sale_bid_v1 (USDC, tUSDsui or SUI), essey_sale_finish_v1, essey_sale_expire_v1, essey_sale_collect_v1, essey_sale_claim_v1. Bodies and the fee floors are in Private flows & credentials. SDK walkthrough: Sale rooms.
4. Sealed settlement v2#
Losing bids and offers stay sealed. Only the winner and the winning price or rate reach the chain. Packages and verifiers are saleRoomV2 and privateLoanV2 in GET /v1/private/config. Download the TEST-ONLY Settle(16) key with fetchSettleKeys (manifest https://cdn.jsdelivr.net/npm/@esseyonsui/settle-keys-testonly@0.1.0/manifest.json). Membership and spend keys: fetchProofBundle from @esseyonsui/proving-keys-testonly@0.1.0.
Sale. SDK openSaleV2Tx, attestSellerV2Tx, then relayer kind=bid_v2 (or buildPoolBidV2). After the close, finishV2Tx with a Settle(16) proof, then collect and claim. cancel only while nobody has bid. expire after the finish window returns deposits and does not open prices. MCP: essey_sale_open_v2, essey_sale_attest_v2, essey_sale_bid_v2, essey_sale_finish_v2, essey_sale_collect_v2, essey_sale_claim_v2, essey_sale_cancel_v2, essey_sale_expire_v2.
Loan. SDK openPrivateLoanV2Tx, attestBorrowerV2Tx, relayer kind=loan_offer_v2 (or buildOfferV2). Settle with settleV2Tx or relayer kind=settle_relayed_v2. MCP essey_loan_settle_v2 takes relayed: true for that relayer post. Repay with a public coin: repayCoinV2Tx or MCP essey_loan_repay_v2. There is no relayer repay_v2. Cancel, claim default and liquidate: essey_loan_cancel_v2, essey_loan_claim_default_v2, essey_loan_liquidate_v2. graceMs on a v2 loan is 300000. claim_default before maturity plus grace aborts 16, ENotDue. The contract minimum for offerWindowMs is 60000. 600000 is recommended. The first private MCP call can take up to a few minutes on the first download of the proving keys. Call essey_shielded_scan before opening or offering.
The caller of repay, liquidate or claim-default chooses lenderEnc. An empty ciphertext leaves the lender's note unscannable. Recover with ShieldedWallet.recoverRoomNote or essey_shielded_recover, then exit the note. The winning lender's repay note reuses the room's public lender opening, so that repayment is linkable to the winning offer. Losing offers stay sealed.
5. Default#
A public offer loan can be defaulted in one session by a self-run borrower. Post termMs 300000, have that borrower accept it, wait for termMs plus grace_ms (300000), then the owner's claim-default or MCP essey_owner_collect_default. A hosted borrower will not take an offer shorter than 6 hours, so that path needs a second session. Pool loans do not default.
A v2 room defaults with claimDefaultV2Tx or essey_loan_claim_default_v2 after maturity plus graceMs.
6. Liquidation#
Supported, and not exercisable until the live Pyth price is through liq_bps (7500) at both spot and EMA. There is no test-price market. A healthy loan aborts EHealthy (5). The self-serve API has no liquidate action. Public: loan::liquidate or loan::liquidate_pool (SDK Ptb.liquidate). v2: private_room_v2::room::liquidate (SDK liquidateV2Tx, MCP essey_loan_liquidate_v2). See Liquidation & default.