Developers

Build on the policy contract

Everything an agent builder needs to read a policy, check an order and wire a model in. The addresses are live on Elysium mainnet (chain 99901) and every snippet on this page runs as written.

Quickstart

Contracts on Elysium

Chain id 99901, RPC https://rpc.elysium.kinetiq.xyz, explorer elysium.kinetiq.xyz. Source is verified on the Kinetiq explorer. The contracts are unaudited.

PolicyFactory

Creates a policy per HyperCore account (minimal clones) and lists them by owner.

0xd98fC54553881d0d430EA422C5747fC90B97f8Ee
Policy (implementation)

The logic every policy clone runs. `evaluate` is pure, so anyone can eth_call it.

0xfD0E10371fe17737512776406e33d929EdeBbDDe
Open Desk policy

The public policy on the house account. A minimal proxy of the implementation. Not funded yet.

0x729c246974B19a89a09B0457b7e1C733b4Cd1Dc4
EquityInbox

Receives equity snapshots and marks that policies read for daily loss.

0xeABFa58AF82F222A1f265Bc8a0C7E90E27532AD2
Intent router (execution)

The intent router on Elysium that accepted proposals go through to HyperCore.

0x552f76aa792fb53f966afd50fae48D765B4A854F

ABIs: /abi/Policy.json, /abi/PolicyFactory.json, /abi/EquityInbox.json. The Open Desk is a minimal proxy of the Policy implementation, so it uses Policy.json.

Quickstart: an agent proposes, the contract answers

TypeScript with viem. It reads the Open Desk limits, takes the BTC mark from HyperCore, asks the deployed Policy.evaluate for the verdict, then signs the same order as an EIP-712 proposal and simulates propose. Every call is an eth_call, so nothing is sent and no gas is spent.

Download agent.mjs
// An agent proposes "20x long BTC" to the Open Desk policy and reads the verdict.
// Runs as written: `npm i viem` then `node agent.mjs`. Every call is an eth_call; nothing is sent.
import { createPublicClient, http, defineChain, parseAbi } from "viem";
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";

const elysium = defineChain({
  id: 99901,
  name: "Elysium",
  nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
  rpcUrls: { default: { http: ["https://rpc.elysium.kinetiq.xyz"] } },
});
const client = createPublicClient({ chain: elysium, transport: http() });

const POLICY = "0x729c246974B19a89a09B0457b7e1C733b4Cd1Dc4"; // Open Desk policy
const IMPLEMENTATION = "0xfD0E10371fe17737512776406e33d929EdeBbDDe"; // Policy implementation
const abi = parseAbi([
  "struct Limits { uint32 maxLevX10; uint64 maxOrderNotionalE8; uint64 maxOpenNotionalE8; uint64 maxDailyLossE8; uint32 cooldownSecs; uint16 maxOrdersPerHour; uint16 priceBandBps; bool reduceOnly; bool paused; }",
  "struct Book { int64 posSzE8; uint64 markE8; int256 equityE8; uint256 otherOpenNotionalE8; uint256 lossUsedE8; uint64 lastLosingCloseAt; uint64 nowTs; uint16 ordersThisHour; }",
  "struct Order { bool isBuy; bool reduceOnly; uint64 sz; uint64 limitPx; uint32 leverageX10; }",
  "struct Proposal { uint32 asset; bool isBuy; bool reduceOnly; uint64 sz; uint64 limitPx; uint32 leverageX10; uint64 nonce; uint64 issuedAt; uint64 deadline; }",
  "function evaluate(Limits l, Book b, Order o) pure returns (uint8)",
  "function propose(Proposal p, bytes sig) returns (uint256 id, uint8 code)",
  "function config() view returns (uint64 maxOrderNotionalE8, uint64 maxOpenNotionalE8, uint64 maxDailyLossE8, uint32 cooldownSecs, uint16 maxOrdersPerHour, uint16 priceBandBps, bool flattenOnBreach)",
  "function maxLevX10(uint32 asset) view returns (uint32)",
  "function lossUsed() view returns (uint256)",
]);
const e8 = (x) => BigInt(Math.round(x * 1e8));
const REASON = { 0: "ACCEPTED", 1: "BAD_SIGNATURE", 5: "MARKET_NOT_ALLOWED", 7: "ORDER_SIZE", 8: "LEVERAGE", 9: "OPEN_NOTIONAL", 10: "DAILY_LOSS", 14: "PRICE_BAND" };

// 1. The policy's limits, read from Elysium. BTC is HyperCore asset 0.
const [cfg, levBtc, lossUsed] = await Promise.all([
  client.readContract({ address: POLICY, abi, functionName: "config" }),
  client.readContract({ address: POLICY, abi, functionName: "maxLevX10", args: [0] }),
  client.readContract({ address: POLICY, abi, functionName: "lossUsed" }),
]);

// 2. The BTC mark from the HyperCore info API.
const mids = await fetch("https://api.hyperliquid.xyz/info", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ type: "allMids" }),
}).then((r) => r.json());
const mark = Number(mids.BTC);

// 3. The order: 20x long BTC on a 30 USD account, limit 0.3% through the mark.
const equity = 30, leverage = 20;
const order = { isBuy: true, reduceOnly: false, sz: e8((leverage * equity) / mark), limitPx: e8(mark * 1.003), leverageX10: leverage * 10 };
const limits = { maxLevX10: levBtc, maxOrderNotionalE8: cfg[0], maxOpenNotionalE8: cfg[1], maxDailyLossE8: cfg[2], cooldownSecs: cfg[3], maxOrdersPerHour: cfg[4], priceBandBps: cfg[5], reduceOnly: false, paused: false };
const now = BigInt(Math.floor(Date.now() / 1000));
const book = { posSzE8: 0n, markE8: e8(mark), equityE8: e8(equity), otherOpenNotionalE8: 0n, lossUsedE8: lossUsed, lastLosingCloseAt: 0n, nowTs: now, ordersThisHour: 0 };

// 4. The verdict from the deployed contract (eth_call, no gas).
const code = await client.readContract({ address: IMPLEMENTATION, abi, functionName: "evaluate", args: [limits, book, order] });
console.log("evaluate:", code, REASON[code] ?? "");

// 5. The full agent path: sign the proposal (EIP-712) and simulate `propose`.
// With a key the owner issued (setKey), the code is the policy's verdict. A fresh key gets 1, BAD_SIGNATURE.
const agent = privateKeyToAccount(process.env.AGENT_KEY ?? generatePrivateKey());
const proposal = { asset: 0, isBuy: true, reduceOnly: false, sz: order.sz, limitPx: order.limitPx, leverageX10: order.leverageX10, nonce: now, issuedAt: now, deadline: now + 60n };
const signature = await agent.signTypedData({
  domain: { name: "Agentisium Policy", version: "1", chainId: 99901, verifyingContract: POLICY },
  types: { Proposal: [
    { name: "asset", type: "uint32" }, { name: "isBuy", type: "bool" }, { name: "reduceOnly", type: "bool" },
    { name: "sz", type: "uint64" }, { name: "limitPx", type: "uint64" }, { name: "leverageX10", type: "uint32" },
    { name: "nonce", type: "uint64" }, { name: "issuedAt", type: "uint64" }, { name: "deadline", type: "uint64" },
  ] },
  primaryType: "Proposal",
  message: proposal,
});
const { result } = await client.simulateContract({ address: POLICY, abi, functionName: "propose", args: [proposal, signature], account: agent.address });
console.log("propose (simulated):", result[1], REASON[result[1]] ?? "");
$ npm i viem && node agent.mjs
evaluate: 8 LEVERAGE
propose (simulated): 1 BAD_SIGNATURE

A fresh key gets code 1 because the owner has not issued it. Set AGENT_KEY to a key issued with setKey on your own policy and the second line returns your policy's verdict.

Solidity: create a policy and check a verdict

A contract that creates a policy from the factory, issues an agent key, previews an order and reads the latest verdict of any policy. Tested with forge test --fork-url https://rpc.elysium.kinetiq.xyz.

Download PolicyUser.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

// Create a policy from the Agentisium PolicyFactory on Elysium (99901) and check verdicts.
// The caller of `create` becomes the policy owner: here, this contract.
interface IPolicyFactory {
    struct Config {
        uint64 maxOrderNotionalE8; // USD, 8 decimals
        uint64 maxOpenNotionalE8;
        uint64 maxDailyLossE8;
        uint32 cooldownSecs; // after a losing close
        uint16 maxOrdersPerHour;
        uint16 priceBandBps; // limit price distance from the mark
        bool flattenOnBreach;
    }

    function create(address coreAccount, Config calldata cfg, uint32[] calldata markets, uint32[] calldata levsX10)
        external
        payable
        returns (address policy);
}

interface IPolicy {
    function preview(uint32 asset, bool isBuy, uint64 sz, uint64 limitPx, uint32 leverageX10) external view returns (uint8);
    function proposalCount() external view returns (uint256);
    function verdicts(uint256 id)
        external
        view
        returns (address key, uint32 asset, bool isBuy, uint8 code, uint64 sz, uint64 limitPx, uint64 at, uint256 intentId, uint8 status);
    function setKey(address key, uint64 expiry) external;
}

contract PolicyUser {
    IPolicyFactory public constant FACTORY = IPolicyFactory(0xd98fC54553881d0d430EA422C5747fC90B97f8Ee);
    uint8 public constant ACCEPTED = 0;
    uint8 public constant LEVERAGE = 8;

    address public policy;

    /// BTC (asset 0) and ETH (asset 1) at 3x, 30 USD per order, 90 USD open, 2 USD daily loss.
    function open(address coreAccount, address agentKey) external payable returns (address) {
        uint32[] memory markets = new uint32[](2);
        uint32[] memory levs = new uint32[](2);
        (markets[0], markets[1], levs[0], levs[1]) = (0, 1, 30, 30);
        IPolicyFactory.Config memory cfg = IPolicyFactory.Config({
            maxOrderNotionalE8: 30e8,
            maxOpenNotionalE8: 90e8,
            maxDailyLossE8: 2e8,
            cooldownSecs: 60,
            maxOrdersPerHour: 40,
            priceBandBps: 200,
            flattenOnBreach: true
        });
        policy = FACTORY.create{value: msg.value}(coreAccount, cfg, markets, levs);
        IPolicy(policy).setKey(agentKey, uint64(block.timestamp + 30 days));
        return policy;
    }

    /// What the policy would answer right now, with no signature and no state change.
    function wouldAccept(uint32 asset, bool isBuy, uint64 sz, uint64 limitPx, uint32 leverageX10) external view returns (bool, uint8) {
        uint8 code = IPolicy(policy).preview(asset, isBuy, sz, limitPx, leverageX10);
        return (code == ACCEPTED, code);
    }

    /// The code of the latest recorded verdict (0 = accepted, 8 = leverage, 17 = accepted, not routed).
    function lastVerdict(address p) external view returns (uint256 id, uint8 code) {
        id = IPolicy(p).proposalCount();
        if (id > 0) (, , , code, , , , , ) = IPolicy(p).verdicts(id);
    }
}

preview reads the policy's own state, marks included. It answers 15 (NO_MARK) while the Open Desk keeper is not running, because the marks in the EquityInbox are older than the policy accepts. evaluate takes the mark as an argument and works today.

Public read API

JSON over GET, CORS open to every origin, cached at the edge for a few seconds. Base URL https://agentisium.com/api/v1. No key needed.

GET/api/v1

Index of every endpoint.

GET/api/v1/contracts

Deployed addresses, explorer links and ABI URLs.

GET/api/v1/policy/0x729c246974B19a89a09B0457b7e1C733b4Cd1Dc4

A policy's limits, loss used today, proposal count and its last ten verdicts.

GET/api/v1/policy/0x729c246974B19a89a09B0457b7e1C733b4Cd1Dc4/verdicts/1

One recorded verdict: key, market, side, size, limit, code, reason, status.

GET/api/v1/evaluate?policy=0x729c246974B19a89a09B0457b7e1C733b4Cd1Dc4&market=BTC&side=long&leverage=20

The verdict a policy gives an order right now, from Policy.evaluate (eth_call) and the HyperCore mark.

GET/api/v1/book

Top six levels of the BTC, ETH and HYPE books on HyperCore, plus the SOL mid.

curl -s "https://agentisium.com/api/v1/evaluate?market=BTC&side=long&leverage=20"
→ {"verdict":"Refused","code":8,"reason":"LEVERAGE","detail":"20x requested, the licence allows 3x", ...}

MCP endpoint

https://agentisium.com/api/mcp speaks Streamable HTTP with JSON responses. Seven tools: policy, quote, propose_trade, close_position, positions, today and why_refused. It reads the Open Desk policy and returns verdicts from the deployed contract. It does not place orders.

Claude Code
terminal
claude mcp add --transport http agentisium https://agentisium.com/api/mcp
Claude Desktop
claude_desktop_config.json
{
  "mcpServers": {
    "agentisium": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://agentisium.com/api/mcp"
      ]
    }
  }
}
Cursor
.cursor/mcp.json
{
  "mcpServers": {
    "agentisium": {
      "url": "https://agentisium.com/api/mcp"
    }
  }
}
Claude.ai and ChatGPT
Settings, Connectors
https://agentisium.com/api/mcp
Call the tools from the browserllms.txt for agents