Agentic tradingPerpetual futuresRiskDevelopers

How to run a perpetual futures trading agent: a step-by-step checklist

Build a perpetual futures trading agent safely with this step-by-step checklist covering limits, sizing, testing, and live controls before real capital.

By the Felix team10 min read
Key takeaways
  • 01Perpetual futures trading with an AI agent requires explicit leverage caps, position limits, and liquidation-aware sizing before any capital is deployed.
  • 02Paper trading on Felix validates the agent's loop, but live activation requires owner approval of the scoped key and a verified panic switch.
  • 03Dollar-based order sizing normalizes venue-specific contract math, yet the agent must still account for margin mode and funding rate exposure.
  • 04Hard limits on spend, drawdown, and open interest prevent the agent from amplifying losses beyond the owner's predefined risk budget.
  • 05Non-custodial architecture means the agent can trade within bounds but cannot withdraw funds; revocation is instant if behavior drifts.

Perpetual futures trading with an AI agent demands a stricter control surface than spot markets because leverage magnifies both direction and timing risk. A practical checklist must cover leverage limits, margin awareness, liquidation distance, funding rate exposure, and a kill switch before the first order is placed. This guide walks through each step from paper trading to live execution on Felix.

Unlike spot trading, a perpetual contract introduces funding payments, maintenance margin, and the possibility of liquidation. An agent does not experience stress or fatigue, but it also lacks intuition about how fast a leveraged position can unravel. Every variable that a human trader might adjust by feel must become an explicit, bounded parameter in the agent's configuration.

What makes perpetual futures different for an agent?

A perpetual futures contract tracks an underlying price without an expiry date, which means the position can remain open indefinitely as long as margin requirements are met. The agent must therefore account for funding rates, which are periodic payments between long and short holders that can erode a position held over time. Because venues offer leverage, a small adverse move can trigger a margin call or liquidation far sooner than in spot markets.

The agent sees prices and order books, but it does not see its own liquidation price unless you explicitly calculate and expose it. You must instruct the agent to know the margin mode, whether isolated or cross, and to treat maintenance margin as a hard floor rather than a suggestion. If the agent opens a position and then stops checking because of a logic error, the position can be liquidated while the owner is unaware. This means the agent needs both pre-trade checks and post-trade heartbeat monitoring.

Funding rates are often small percentages, but they compound every few hours. An agent that holds a directional position for days can see its profit expectation eroded by funding costs, or even turn a correct directional bet into a net loss. You should instruct the agent to check the current and predicted funding rate before opening a position, and to include projected funding cost in its expected return calculation. If the agent is not aware of funding, it is not ready for perpetual futures.

Liquidation is not just a risk for the agent. It can also affect market dynamics around the liquidation price. While the agent cannot predict cascading liquidations, it can avoid being close to the liquidation price of other large positions by maintaining a wider buffer. Teach the agent to treat the maintenance margin requirement as a warning zone, not a target.

How should you size positions and set leverage limits?

Position sizing for perpetual futures starts with the premise that leverage is a multiplier on risk, not a way to increase expected return. The agent should be configured with a maximum leverage ceiling that applies before any signal is considered. For example, if the owner decides that no single position may exceed three times notional exposure, the agent must reject any calculation that implies higher leverage, even if the model's confidence is high.

Felix normalizes order sizing in plain US dollars, which removes the need for the agent to compute venue-specific contract sizes. However, the agent still needs to translate that dollar value into the correct notional size given the chosen leverage. Position sizing from first principles explains how to derive the dollar amount from a risk budget rather than from a profit target. The key idea is to decide how much of the total capital can be lost on a single trade, then work backward to the dollar size and leverage that respects that loss limit.

  • ·Set a maximum leverage cap per position and per account.
  • ·Define the maximum dollar notional for any single trade.
  • ·Require a minimum distance to liquidation, expressed as a percentage move against the position.
  • ·Recalculate sizing if the account balance changes due to realized profit or loss.

Notional exposure is the total dollar value the position controls, while margin is the collateral required to keep it open. An agent that reports only margin used can hide the true scale of risk. Require the agent to log notional exposure after every fill so that you can compare it against the total account size and enforce concentration limits.

What safety controls belong in the agent loop?

Safety controls are the boundaries that prevent the agent from misinterpreting a signal as permission to ignore risk. On Felix, these controls include scoped API keys, budget caps, position limits, and a panic switch that flattens all positions and revokes access. The agent cannot withdraw funds to itself because the wallet is non-custodial. Withdrawal addresses are owner-approved only. This architecture limits the damage to trading losses within the authorized scope.

Before the agent runs, configure spend caps and drawdown limits that trigger an automatic halt. A spend cap limits the total capital the agent can deploy, while a drawdown limit stops trading after a cumulative loss reaches a threshold. These limits should be set conservatively for the first live deployment and only relaxed after consistent, predictable behavior in paper trading.

An exit plan is as important as an entry plan. The agent should know when to close a position because of time, profit target, stop loss, or a change in market structure. Stops should be placed at the venue level when possible, so they execute even if the agent loses connectivity. If the venue does not support native stops, the agent must run a tight loop that checks open positions frequently, with a fallback to the panic switch if the loop fails.

Every order, cancellation, and error should feed into audit logs and observability with hard limits so that the owner can reconstruct what the agent did and why. Observability is not only for debugging. It is the evidence trail that tells you whether the agent is respecting its guardrails or drifting toward unintended behavior.

Scoped keys are the foundation of this control model. A key created for perpetual futures trading can be restricted to specific venues, specific symbols, and specific action types. If the agent attempts to exceed its budget, the API rejects the order. If the agent attempts to withdraw funds, the architecture prevents it. These limits are enforced by the infrastructure, not by the agent's own code, which means a bug in the agent cannot bypass them.

How do you test the agent before live capital?

Paper trading on Felix lets the agent execute against live market data without committing real funds. This is the stage where you validate the entire loop, including signal generation, sizing calculation, order placement, position tracking, and exit logic. Run the agent for enough time to encounter different market regimes, including sideways price action and volatility, because funding rates and margin requirements behave differently in each.

Before paper trading, you may use backtesting without fooling yourself to sanity-check the strategy. A good backtest reveals whether the agent would have been liquidated during a past drawdown, whether funding costs would have consumed profits, and whether the order frequency is realistic. Do not treat backtested returns as a forecast. Treat them as a filter for strategies that fail under friction.

During paper testing, introduce artificial stress scenarios. Simulate a sudden funding rate spike, a margin requirement change, or a missed heartbeat that delays a stop order. Observe whether the agent recovers or whether it accumulates phantom risk. If the agent behaves unpredictably in simulation, it will behave worse with real money. Fix the logic before authorizing a live key.

It is useful to run two identical agent instances in parallel during paper testing, one with conservative parameters and one with slightly more aggressive settings. Compare their behavior under the same market conditions to see which control surface produces more stable outcomes. This A/B approach reveals whether a limit is actually binding or merely cosmetic.

If the agent trades multiple pairs, test whether the positions are correlated. Two seemingly independent perps can move together during a market stress event, doubling the effective leverage and drawdown speed. Paper trading should include scenarios where the agent holds multiple positions to verify that the total account leverage stays within the cap.

What checks matter when going live?

Moving from paper to live requires explicit owner authorization of the scoped API key. Do not reuse a paper key for live trading. Create a new key with the live budget and stricter limits. Verify that the panic switch is accessible and that you know how to flatten positions manually if the agent does not respond.

  • ·Confirm the wallet holds only the capital you intend to trade. Keep reserves elsewhere.
  • ·Double-check that the margin mode is set as expected, because cross margin can put the entire account at risk.
  • ·Start with the smallest viable position size and verify that the agent's reported exposure matches the venue's actual open position.
  • ·Review the funding rate and ensure the agent's holding period aligns with the cost of carrying the position.
  • ·Verify that the agent's host is stable and that network connectivity is redundant enough to sustain the required heartbeat.

The first live trades should be treated as a system test, not a profit opportunity. If the agent opens a position, hold it for a short duration, close it, and reconcile the profit and loss, fees, and funding against your own records. Any discrepancy means the agent's model of the world does not match reality, and that gap must be closed before scaling up.

Reconciliation should include not just the trade outcome but also the fee tier and any slippage between the agent's intended entry and the actual fill. If the agent assumes it will be filled at the mid price, but the venue charges taker fees and the spread is wide, the expected edge may disappear. Adjust the agent's cost model to reflect reality before it scales.

Before going live, document the exact market conditions under which you will pause the agent. Write these rules down and share them with anyone who has access to the panic switch. A clear decision tree prevents emotional decisions during a drawdown and ensures that intervention is consistent with the pre-defined plan.

How do you monitor and intervene after launch?

Live deployment is not the end of the checklist. Markets change, and an agent that was safe yesterday may be unsafe tomorrow if volatility increases or liquidity thins. You need continuous monitoring that compares the agent's actual behavior against its authorized parameters. Set alerts for drawdown speed, unusual order frequency, and positions that approach liquidation distance.

Schedule a regular review to audit your trading agent guardrails before they become outdated. A guardrail that made sense in a low-volatility regime may be too loose in a high-volatility regime. Adjust leverage caps, position limits, and stop distances based on current market conditions, not on the conditions that existed when the agent was first built.

If the agent deviates from its expected behavior, do not attempt to debug while it holds open positions. Hit the panic switch to flatten and revoke, then investigate. The cost of a false alarm is usually smaller than the cost of a delayed response. Non-custodial controls mean that revocation is instant and final. The agent cannot trade further, but your funds remain in your wallet.

Monitoring should also include the agent's decision latency. In fast markets, a delay of a few seconds between signal generation and order submission can turn a viable entry into a poor one. If latency is high, reduce position size or widen the margin of safety rather than chasing the original signal. Speed without control is a liability in leveraged markets.

Log retention should cover the full lifecycle of every position, from the signal that created it to the final exit. If a post-mortem is needed, incomplete logs make it impossible to distinguish between a bad strategy, a bad execution, and a bug. Store logs outside the agent's own infrastructure so they survive a host failure.

Perpetual futures offer continuous exposure, but that continuity is a double-edged sword for an autonomous agent. The checklist above is designed to keep the agent bounded, observable, and subordinate to owner intent. Trading can lose money, including everything, but a disciplined control surface prevents the agent from amplifying that risk beyond what the owner knowingly accepted. Review this checklist before every new deployment, because the market does not remember your previous precautions.

Frequently asked questions

What leverage cap should I set for a new perps agent?

Start with the lowest leverage that still allows your strategy to function, often two to three times. Increase only after prolonged paper and live testing proves the agent respects stops and position limits.

Can the agent change its own margin mode from isolated to cross?

No. The agent operates within the permissions of its scoped key. Margin mode, withdrawal addresses, and leverage ceilings are owner-controlled and cannot be overridden by the agent.

How does paper trading handle funding rates?

Paper trading simulates funding payments against live market data so the agent's logic can account for carry cost. Treat these simulated costs as real during testing to avoid surprises in live trading.

What should I do if the agent stops sending heartbeats?

Assume the worst and hit the panic switch. The switch flattens open positions and revokes the key. Investigate the outage only after the account is flat.

Does dollar-based sizing protect me from liquidation?

Dollar-based sizing simplifies order entry, but liquidation depends on leverage, margin mode, and market moves. You must still set a minimum liquidation distance and monitor it independently.

How often should I audit the agent's guardrails?

Audit before every live activation and after any significant market regime change. At minimum, review caps, limits, and the panic switch weekly during active trading.

Give your agent a key.

One key to trade stocks, crypto, perps, options, and prediction markets. Live after owner authorization.

Keep reading

Not a brokerage, exchange, or investment adviser. Not investment advice. Trading involves risk, including total loss.