docs reference
Agent runtime
The runtime runs one worker per active delegation. It is built around ports: the tick pipeline depends only on interfaces, and RUNTIME_MODE picks the wiring (fake: in-memory, no keys; live: Postgres, Elysium and Hyperliquid).
Ports
| Port | Live implementation | Used for |
|---|---|---|
IntentLogPort | LiveIntentLog | commit, postResult, checkpoint, terminate; serialized writer per runner key, batching, idempotent retries |
ChainReaderPort | LiveChainReader | Delegations, agent status, checkpoints, onchain commitments |
FeeRouterPort | LiveFeeRouter | previewFee, settle, forward with the settler key |
HlInfoPort | LiveHlInfo | Agent approval, fills, account state, mids, funding |
| Executor | HyperliquidApiExecutor | Signs orders with the derived agent key; refuses if it differs from the registered agent wallet |
| Strategy resolver | RegistryStrategyResolver | Rule strategies and LLM providers |
Tick pipeline
Each tick runs these steps in order and stops at the first one that ends the tick:
- preflight: delegation active and unexpired, agent active, stored limits hash to the onchain hash, Hyperliquid approval present, late commits reconciled.
- snapshot: market data and account state.
- context: strategy context with the remaining risk budget.
- decide: the strategy proposes, within
decisionTimeoutMs. A failure becomes a no-op. - risk:
DefaultRiskGuardproduces the verdict. - persist: the decision payload and its hash are stored with the next nonce.
- commit:
IntentLog.commit. On failure the decision isSKIPPED_NO_COMMITand nothing executes. - execute: approved orders and cancels go to Hyperliquid.
- result: wait for fills within the result window.
- postResult: hash the result payload and post it.
Recovery at boot never re-executes orders. It re-derives every needed write from stored decisions and re-posts pending results.
Keys
- Runner (
RUNNER_PRIVATE_KEY): commits, results, checkpoints andterminate. Needs HYPE for gas. - Settler (
SETTLER_PRIVATE_KEY):settleandforward. Without it settlement is disabled. - Master seed (
RUNTIME_MASTER_SEED): derives every Hyperliquid agent key from(agentId, user, index, seedVersion). Leaking it allows trading, not withdrawing, until users revoke.
HTTP
GET /healthz (executor reachability, workers, queue), GET /metrics (Prometheus), and POST /internal/delegations/prepare for the indexer, protected by a shared secret header.
Environment
| Variable | Default | Notes |
|---|---|---|
RUNTIME_MODE | fake | fake or live |
PORT | 8787 | Use 8788 next to the indexer |
ELYSIUM_CHAIN_ID / ELYSIUM_RPC_URL | 99801 / public RPC | |
HL_ENV | testnet | mainnet or testnet |
HL_BUILDER_ADDRESS / HL_BUILDER_FEE_TENTHS_BP | none / 10 | Builder fee on every order |
COMMIT_MODE | receipt | receipt waits for the receipt; submitted accepts the tx hash |
ANTHROPIC_API_KEY / OPENAI_API_KEY | none | Needed for LLM agents |