Agentic tradingRiskSafety

How guardrails keep AI trading agents from losing everything

Guardrails are hard limits that prevent AI trading agents from overspending or draining funds. They cap budgets, restrict positions, and require owner approval before live trading.

By the Felix team9 min read
Key takeaways
  • 01Guardrails are technical constraints enforced by infrastructure, not polite suggestions in a prompt.
  • 02Budget caps and position limits work together to limit both total spending and the size of any single bet.
  • 03A kill switch flattens positions and revokes the agent's key instantly, without requiring the agent to cooperate.
  • 04Paper trading guardrails mirror live ones, but only real trading with a small budget cap reveals true execution risk.
  • 05Owners must explicitly approve live keys and withdrawal addresses, keeping the agent non-custodial by design.

Guardrails are the hard limits and safety rules that prevent an AI trading agent from overspending, overleveraging, or draining your wallet. They work by capping budgets, restricting position sizes, and enforcing owner-approved controls before any live trade can occur. Without them, an agent with API access could place orders that are too large, too frequent, or simply wrong. These controls are not suggestions. They are enforced by the infrastructure and can be tightened or revoked by the owner at any time.

What are guardrails in agentic trading?

When people talk about AI safety, they often think of prompt instructions or behavioral guidelines. In trading, guardrails are technical constraints baked into the infrastructure that connects the agent to the market. They exist because an agent that can send orders with real money needs physical limits, not polite requests. A guardrail is any hard rule that stops the agent from acting outside a predefined boundary. The core set of guardrails includes several layers.

  • ·Scoped API keys mean the agent only receives permission to trade, not to move funds to an unknown address.
  • ·Budget caps define how much notional value the agent can deploy in a given period.
  • ·Position limits restrict how large any single position can grow.
  • ·Approved withdrawal addresses ensure the agent can never send funds to a destination the owner has not reviewed.
  • ·The kill switch lets the owner instantly flatten everything and revoke access.

These controls matter because the agent is autonomous. It may run while you sleep, read news feeds, or react to price movements faster than a human can intervene. If its logic drifts, a guardrail acts as a circuit breaker. A practical checklist for non-custodial AI trading covers how to verify that each layer is in place before you authorize live trading. It is worth stating plainly that trading can lose money, including everything. Guardrails do not eliminate risk. They contain the scope of what the agent can lose in a single sequence of bad decisions. A budget cap of one hundred dollars means the agent cannot turn a mistake into a thousand dollar loss. That containment is the entire purpose of the guardrail system.

How do budget caps prevent runaway spending?

A budget cap is a simple idea with strict enforcement. You declare a maximum amount of capital the agent may deploy, measured in plain US dollars, over a fixed time window. The infrastructure tracks every order the agent attempts to place. If the cumulative notional value hits the cap, the API rejects any new orders until the window resets or the owner increases the limit. The cap applies to notional value, not just realized profit or loss. If the agent attempts to open a position worth fifty dollars, that fifty dollars counts against the budget even if the position is closed immediately. This prevents rapid cycling in and out of trades as a way to bypass the limit. Because the API normalizes venue-specific contract math, the agent does not need to understand lot sizes, tick values, or margin multipliers. It thinks in dollars, and the infrastructure translates that into the correct size for a stock broker, a perps venue, or an options venue. This removes an entire class of sizing errors. Budget caps can be layered. You might set a daily cap of fifty dollars for testing, a weekly cap of two hundred dollars for a strategy you trust, and a monthly cap of one thousand dollars as an absolute ceiling. If the agent hits the daily limit by noon, it stops trading until the next day. The owner remains in control and can adjust the numbers as confidence grows or shrinks. For anyone starting with limited capital, how to start an AI agent with a small budget explains how to use these caps to learn without exposing your full wallet. The key principle is to let the agent prove itself under tight constraints before you relax them. A small budget cap is a calibration tool, not a sign of weakness.

What are position limits and why do they matter?

Budget caps control total spending over time. Position limits control the shape of the portfolio at any single moment. A position limit is a maximum dollar value that the agent can hold in one instrument, one market type, or one direction. It prevents the agent from concentrating too much capital in a single bet, even if that bet fits within the overall budget. Suppose you allow the agent to trade stocks, crypto, and prediction markets. A position limit might say that no single market can exceed twenty percent of the total allocated budget. Another limit might cap leverage so that a perps position cannot exceed a two to one ratio. You can also set directional limits. For example, you might allow long positions up to one hundred dollars but restrict short positions to fifty dollars. This is useful if you want to limit exposure to one side of the market. These rules force diversification and prevent an all-in wager that could wipe out the account if the market moves sharply. Position limits also interact with exit plans. An exit plan is a guardrail that instructs the infrastructure to close a position if it hits a certain loss threshold or if a time limit expires. The agent does not get to argue with the exit plan. The infrastructure executes it automatically. This means a bug in the agent's reasoning cannot turn a small losing trade into a catastrophic drawdown, because the position limit and exit plan cap the damage. Understanding how to set these numbers from first principles is covered in how to size positions for an AI trading agent from first principles. The article explains why position sizing is more important than entry timing. Even a perfectly logical agent will eventually face a losing streak. Position limits ensure that the streak does not take the whole account.

How does a kill switch protect your capital?

A kill switch is the final guardrail. It is a manual control that lets the owner instantly halt the agent, flatten open positions, and revoke the API key. When activated, the infrastructure submits closing orders for every open position and disables the agent's ability to place new ones. The key is then useless, even if the agent continues running. The kill switch works because of the non-custodial architecture. Funds sit in a wallet that the owner controls. The agent can spend within limits, but it can never withdraw to itself or to an unapproved address. When the switch is flipped, the owner retains the underlying capital. The agent simply loses its permission to access it. It is worth noting that the kill switch does not guarantee a specific exit price. In volatile markets, the closing orders may fill at prices worse than the last quoted mark. The switch guarantees that the agent stops trading. It does not guarantee the final value of the portfolio. This is different from logging into a third-party platform and changing a password. The kill switch is integrated into the trading infrastructure. It does not depend on the agent cooperating. It acts at the network level, revoking the scoped key and broadcasting cancellations. Some owners test the kill switch during paper trading to confirm it behaves as expected. That is a sensible habit. The switch should feel like a physical circuit breaker. You should know exactly where it is and what it does before you need it in a stressful moment.

What is the difference between paper and live guardrails?

Paper trading lets you test strategies without risking real money. The guardrails in paper mode mirror the guardrails in live mode, but the orders are simulated. This is useful for verifying that the agent respects budget caps, does not exceed position limits, and behaves predictably under different market conditions. However, paper guardrails can create a false sense of security. Slippage, latency, and partial fills behave differently when real counterparties are involved. An agent that neatly stays within paper limits might encounter a live market where orders fill at worse prices than expected. The budget cap still holds, but the economic outcome differs. Because of this gap, it is important to treat paper trading as a syntax check, not a proof of profitability. The real test is live trading with a very small budget cap. Why paper trading misleads beginners who build AI agents explores this problem in detail. The guardrails are real in both modes, but only live trading reveals how the infrastructure interacts with actual market liquidity. Before moving from paper to live, the owner must explicitly authorize the key for real trading. This is a separate step. The infrastructure will not send live orders until the owner confirms. That confirmation is itself a guardrail. It prevents an agent that was built for simulation from accidentally touching real markets.

How do you configure guardrails before going live?

Setting up guardrails is a sequence of decisions, not a single toggle. Start with the total amount of capital you are willing to lose. This is your maximum pain threshold, not your expected return. From that number, derive a daily or weekly budget cap that is a small fraction of the total. Many owners begin with a cap that represents one to two percent of their trading capital. Next, define position limits. Decide the maximum dollar value for any single position, the maximum number of concurrent positions, and whether leverage is allowed. If you trade options or perps, set a leverage ceiling. If you trade prediction markets, set a maximum contract count. These numbers should be tight enough that a string of five consecutive losses still leaves most of the budget intact. Then configure the exit plan. Set a time limit for how long an agent can hold a losing position. Set a drawdown threshold that triggers automatic closure. Connect these to the kill switch logic so that extreme moves trigger an immediate halt. Finally, approve only your own withdrawal addresses. The agent should never be able to send funds to a destination you have not reviewed. Some owners also set a whitelist of tradable instruments. Rather than giving the agent access to every stock or crypto pair, they restrict it to a specific list of symbols. This prevents the agent from entering obscure markets with wide spreads or low liquidity, where slippage can erode the budget even under normal conditions. Review the settings in the docs at /docs before authorizing live trading. After configuration, run the agent in paper mode for a few days to confirm it respects the boundaries. Only then authorize the live key. The entire process is designed so that the agent earns trust gradually, rather than demanding it upfront.

Frequently asked questions

Can guardrails prevent my agent from losing money?

No. Guardrails limit the speed and scale of losses, but they cannot predict market direction. Trading can lose money, including everything, and no automated limit removes that risk.

What happens if the agent hits its budget cap?

The API rejects new orders until the cap resets or the owner increases it. Existing positions remain open unless an exit plan or kill switch closes them.

Can I change guardrails while the agent is running?

Yes. Owners can tighten or loosen caps, adjust position limits, and revoke keys at any time. Changes take effect immediately without waiting for the agent to finish its current logic loop.

Does the kill switch close positions instantly?

The kill switch submits closing orders immediately, but actual fill depends on market liquidity. It also revokes the key so the agent cannot place new orders.

Are paper trading guardrails identical to live ones?

The logic and limits are mirrored, but paper trades do not face real counterparties. Paper mode is useful for testing behavior, but live trading is the only way to validate execution under real conditions.

Who controls the withdrawal addresses?

Only the owner can approve withdrawal addresses. The agent can trade within its limits, but it can never move funds to an address that the owner has not explicitly whitelisted.

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.