codingBy HowDoIUseAI Team

How to set up an agentic AI trading pod on Hyperliquid with Codex

Learn how to build an AI agent that backtests, evaluates, and trades on Hyperliquid using Codex CLI, without risking real money on day one.

Most people who try "AI trading" skip straight to the part where a bot places orders with real money. That's backwards, and it's why so many of these experiments end in a wiped account and a sad tweet. The agentic traders getting real results do something much less exciting first: they make their AI agent prove itself on historical data before it ever touches a live position.

This guide walks through how that actually works in practice — using an autonomous coding agent to design a backtest, evaluate the results with real risk metrics, and only then decide whether a strategy deserves to go live on a venue like Hyperliquid.

What is agentic AI trading, exactly?

Agentic AI trading means handing a task — not just a question — to an AI agent that can plan, write code, run it, look at the output, and decide what to do next. Instead of asking a chatbot "what's a good EMA crossover strategy?" you tell an agent to research a strategy, build a backtesting environment, pull historical price data, run the simulation, calculate performance metrics, and report back with a recommendation.

The "pod" framing that's popular in AI trading circles right now treats each strategy as its own contained unit: one pod might test a 4-hour trend breakout, another might test a mean-reversion setup on a different timeframe. Each pod gets backtested independently, scored on its own risk-adjusted returns, and only promoted to live trading if it clears a bar you set in advance.

What is Hyperliquid, and why does it show up in these workflows?

Hyperliquid is available at app.hyperliquid.xyz and is a decentralized exchange where you can trade crypto, commodities, indices, and more — with 300+ perpetual and spot markets, fully onchain, non-custodial, and available 24/7. That combination — programmatic access plus non-custodial control of funds — is exactly what makes it a popular sandbox for agentic trading experiments. You're not handing your keys to a centralized broker; you're signing your own transactions.

Hyperliquid's developer documentation breaks the API into a few clear pieces. According to a detailed community walkthrough of the docs, Info endpoints are used to fetch public and account-related data, and these endpoints do not require signatures and are publicly accessible. Separately, Exchange endpoints handle write operations like placing trades, and these requests must be signed with a wallet key because they can directly affect funds and positions, requiring much stricter security handling. There's also a WebSocket layer for anyone who needs faster reactions than polling REST endpoints allows.

One important detail if you're planning to test before going live: Hyperliquid does not currently provide a separate perpetuals testnet environment for full trading simulation, so if you need to test live execution, you should use very small position sizes first. That single fact is the whole reason a rigorous backtesting step matters so much — you can't just flip a switch to "paper trading mode" and walk away.

If you're wiring up your own agent or script, the official Python SDK is the most direct starting point, with community-maintained TypeScript and Rust SDKs also linked from the docs.

What is Codex, and what does it add to this workflow?

Codex CLI is OpenAI's terminal-based coding agent, and it's the tool doing the heavy lifting in this kind of setup. Codex CLI is a coding agent from OpenAI that runs locally on your computer, which matters for trading workflows because your strategy logic and any credentials stay on your machine rather than bouncing through a third-party server.

Getting it installed is a one-line job. On Mac or Linux you can run curl -fsSL https://chatgpt.com/codex/install.sh | sh, and on Windows you can use powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex", or install it via npm install -g @openai/codex or brew install --cask codex. Once it's running, you just describe what you want — no separate scripting environment required to get started.

A few features make Codex particularly well-suited to research-heavy tasks like backtesting:

  • Delegated sub-agents — you can ask Codex to delegate focused work to specialized agents, then bring their findings back into the main terminal session, which is handy when one agent is pulling data while another is calculating metrics.
  • Live web search mid-task — you can switch a run to live web search when a task depends on current releases, documentation, or external behavior, and that search activity stays visible in the transcript, so you can see exactly what data or docs it referenced when writing your backtest logic.
  • MCP connections — Codex supports connecting to external tools and data sources directly, so you can plug in a Hyperliquid data source or a spreadsheet without leaving the CLI.

How do you actually set up an agentic trading pod step by step?

Here's a practical sequence that mirrors how experienced agentic traders structure their pods:

1. Install and open Codex CLI. Run the install command above, then launch it by typing codex in your terminal. You'll land in an interactive session where you can describe tasks in plain English.

2. Ask Codex to design the backtest before collecting any data. This is the step most beginners skip. Instead of jumping straight to "pull me some price data," prompt Codex to define the best-practice backtesting setup first — what timeframe, what slippage assumptions, what fee structure, what sample size counts as statistically meaningful. Getting the methodology right before you have results prevents you from unconsciously cherry-picking a lookback window that makes the strategy look good.

3. Have it pull historical data and run multiple strategy variants. A single pod might test an EMA breakout on the 1-hour chart, the 4-hour chart, and the daily chart simultaneously. Let Codex run all three and report back with a comparison table rather than committing to one timeframe upfront.

4. Evaluate results using risk-adjusted metrics, not just raw returns. This is where the Sharpe ratio comes in — more on that below. A strategy that returns 40% with wild swings is often worse than one that returns 15% smoothly, and risk-adjusted scoring is how you catch that.

5. Only promote a strategy to live trading if it clears your bar. If a pod's Sharpe ratio and drawdown numbers look strong across multiple market conditions, it earns the right to trade with real (small) capital. If not, it goes back to the design stage or gets shelved entirely.

6. Connect to Hyperliquid and start small. When a pod is ready, connect using an API wallet rather than your main wallet. Do not use the same wallet that holds your long-term assets as your API trading wallet — keep your trading capital segregated from your holdings. And because there's no full perpetuals testnet, use very small position sizes first even after a strategy passes backtesting.

What is a Sharpe ratio, and why should it decide whether you go live?

The Sharpe ratio measures return relative to risk taken, and it's the single most useful number for deciding whether a backtested strategy deserves real capital. A Sharpe ratio of 1.2, for example, means the strategy earned roughly 1.2 units of extra return for every unit of risk taken on. Anything meaningfully below 1.0 usually means you're being paid poorly for the volatility you're absorbing — even if the raw percentage return looks exciting on a chart.

This is exactly the kind of calculation worth handing to an agent rather than doing by hand, because it needs to be run consistently across every strategy variant you test, not just the one that happened to post the best headline return.

What mistakes do beginners make with these setups?

A few patterns show up constantly:

  • Skipping the backtest design step. Jumping straight into data collection without defining rules first almost guarantees a biased result.
  • Trusting a single backtest run. One good-looking equity curve means nothing. Strategies need to hold up across different timeframes and market regimes.
  • Ignoring rate limits. Hyperliquid's exchange endpoints are stricter than info endpoints, and if you receive a 429 response, you should stop sending requests immediately and use exponential backoff instead of blindly retrying.
  • Going live too fast. Even a strategy that backtests well can behave unexpectedly once real fills, funding rates, and liquidation mechanics enter the picture. That's exactly why small positions matter early on.

Should you actually trust an AI agent with real capital?

Not without a track record it earned itself. The entire value of the pod structure is that it forces every strategy — no matter how convincing the initial pitch sounds — to survive a rigorous, skeptical evaluation before a single dollar of real money is at risk. An agent that recommends "move forward, but don't trade live yet" is doing its job correctly. The goal isn't to find an agent that always says yes; it's to find one that says no often enough that when it finally says yes, you can trust it.

Build the skepticism into the system before you build the strategy. That's the part that actually separates agentic trading from gambling with extra steps.