Skip to Content
nullPointdocs

Running the agent

Configuration, running testnet and mainnet side by side, and keeping it alive.

One agent per network

npm run agent           # testnet, reads .env
npm run agent:mainnet   # mainnet, reads .env.mainnet

Both can run on one machine: each network has its own lock, journal (apps/agent/.state/, .state/mainnet/), keys and env file. Never run two agents with the same NEAR key; their transactions would fight over the key's nonce.

Environment

VariableTestnetMainnetWhat
NETWORKtestnet (default)mainnetWhich vault, Intents contract and Hyperliquid
OWNERnullpoint.testnetnullpoint.nearThe vault is vault.$OWNER
AGENT_ACCOUNT, AGENT_PRIVATE_KEYkeeper.nullpoint.testnetagent.nullpoint.nearFunction-call key that can only call the vault (scripts/add-agent-keys.ts)
HL_AGENT_PRIVATE_KEYor .keys/hl-agent.jsonor .keys/mainnet/hl-agent.jsonHyperliquid trading key
SOLVER_ACCOUNT, SOLVER_PRIVATE_KEY, SOLVER_HL_PRIVATE_KEYneedednot usedThe mock 1Click solver
NEAR_INTENTS_API_KEYnot usedpartner key1Click quotes without the 0.25% unauthenticated fee
NEARAI_API_KEYThe AI; without it the rule decides
NEAR_RPC_URLStestnet RPCsmainnet RPCsTried before the public ones. The agent refuses to start if one serves the other network
INTERVAL_S60600Seconds between runs
STRATEGIST_INTERVAL_MIN3030Minutes between AI decisions

NEAR for gas

Transactions that ask NEAR's signers for a signature attach 300 Tgas, and NEAR wants about 0.3 NEAR available up front for that (most of it comes back). Keep at least 0.5 NEAR free on the agent account at all times; under it, swaps and payouts fail. Running costs are about 1.1 NEAR a day on testnet (every 60 s) and about 0.14 on mainnet (every 10 min). /api/health flags the account under 1 NEAR.

On a server

ecosystem.config.cjs runs both agents under pm2 with automatic restarts. Copy .env, .env.mainnet and .keys/ to the server, never to the repository. Keep the owner's full-access key off the server: the agent only ever needs its restricted keys.

The Hyperliquid key expires

Hyperliquid approves agent keys for 90 days. Run node scripts/approve-agent.ts --network mainnet again before the date shown on the status page (10 Feb 2027 for the current mainnet key).

Reading the log

LineMeaning
NAV 42.57 USDC | target BTC | HL 7.62 | [...] | paused falseA report was accepted
sent 14.76 USDC margin to Hyperliquid (sign tx …)Collateral transfer signed and settled
shorted BTC 0.0004 -> filled then bought BTC with 29.32 USDCShort first, then the coin
hedge off for BTC; not reporting until it's fixedWaiting for the hedge before reporting
allocation step failed: …That step is skipped; the report still goes out
vault paused, skippingThe owner needs to look

On this page