Agentic tradingRisk managementDevelopersMCP

How to configure spend caps and drawdown limits for live agent trading

A guide to configuring spend caps and drawdown limits that keep a trading agent within owner-defined bounds when it trades real money across stocks, crypto, and derivatives.

By the Felix team9 min read
Key takeaways
  • 01A spend cap is an absolute dollar ceiling on notional exposure that prevents an agent from over-deploying capital, regardless of wallet balance.
  • 02A drawdown limit monitors peak equity and automatically halts trading, flattens positions, and revokes the key when losses cross an owner-defined threshold.
  • 03These limits are scoped per API key, enforced by the infrastructure, and operate independently of the agent's own reasoning, which prevents hallucinations or bugs from bypassing them.
  • 04Limits should be tested in paper trading, authorized explicitly for live use, and reviewed regularly to ensure they match the strategy's risk profile.
  • 05The non-custodial model means the owner retains all funds and withdrawal rights; the agent can only trade within the sandbox defined by the spend cap and drawdown settings.

Spend caps and drawdown limits are owner-controlled guardrails that prevent an AI trading agent from deploying more capital than intended or continuing to trade while losses deepen. A spend cap sets a hard ceiling on the notional dollars the agent can place into positions across all connected markets. A drawdown limit monitors the wallet's equity peak and automatically halts trading when losses reach a predefined percentage or dollar threshold. Together they form the primary safety layer for live agentic trading without requiring the owner to surrender custody of funds.

What is a spend cap and how does it work?

A spend cap is an absolute budget boundary denominated in plain US dollars. It tells the Felix infrastructure how much notional capital the agent is allowed to deploy at any given time. Because the API normalizes contract sizing across stocks, crypto, perpetual futures, options, and prediction markets, the owner does not need to translate venue-specific margin formulas or lot sizes. The cap is simply a dollar number, and the same figure applies consistently whether the agent is buying shares, opening a perps position, or taking a side in a prediction market.

When an agent trades options, the notional value of the contract counts toward the cap, not just the premium paid. For perpetual futures, the position size in dollar terms is tracked. For prediction markets, the maximum loss is treated as the deployed capital. This normalization prevents the agent from hiding exposure inside complex instruments or shifting risk into a different market type to evade the budget.

When the agent attempts to open a position that would push total deployed capital beyond the cap, the order is rejected before it reaches a venue. The cap is scoped to a specific API key, which means different agents or strategies can carry different budgets. An owner might give one agent a $1,000 daily spend cap for equities and another a $5,000 weekly cap for perpetual futures. The key cannot exceed its own boundary even if the wallet contains additional funds.

Spend caps can be configured as lifetime limits or as recurring windows. A lifetime cap is appropriate for a one-time experimental allocation. A recurring window, such as a daily or weekly reset, is better for ongoing strategies that are expected to trade repeatedly. The reset is automatic and does not require manual intervention. If the agent closes positions and realizes a profit, the realized gain does not increase the spend cap unless the owner explicitly raises it. The cap is about exposure, not about performance.

It is important to distinguish the spend cap from the wallet balance. The wallet may hold $50,000, but if the agent's key is capped at $2,000, the agent can only deploy $2,000. The remaining funds are invisible to the agent and cannot be touched. This separation is what makes the non-custodial model practical. The agent operates inside a sandbox defined by the owner. How a Claude trading agent trades without taking custody of your funds

What is a drawdown limit and when does it trigger?

A drawdown limit measures the decline from the highest equity value the wallet has reached since the limit was activated. It is expressed either as a percentage of peak equity or as a fixed dollar amount. When the limit is breached, the system treats it as a critical failure condition and executes a preconfigured exit plan. The calculation uses mark-to-market equity, which includes unrealized profit and loss on all open positions, so a sudden adverse move in any held instrument will immediately affect the reading.

The exit plan typically includes two actions. First, the agent sends flattening orders to close all open positions as quickly as the underlying venues allow. Second, the agent's trading key is revoked or suspended so that no new orders can be placed. This is the kill switch in action. The owner retains full withdrawal rights, but the agent cannot continue trading until the owner manually reviews the situation and reauthorizes the key.

Drawdown limits can be set at multiple time horizons. Suppose you set a daily drawdown limit at a small percentage. That might catch a strategy that behaves badly during a single session. Imagine a total drawdown limit at a larger percentage. That protects the overall allocation from sustained erosion. The owner should set the tighter limit inside the looser one so that the daily circuit breaker trips before the total budget is threatened. These limits are not suggestions. They are enforced by the infrastructure, not by the agent's own logic, which means a buggy or hallucinating model cannot talk its way around them.

The limit is calculated on total wallet equity, not on individual positions. This avoids a common pitfall where one position is profitable while others are losing. The aggregate equity curve is what matters for survival. If the owner adds external funds to the wallet, the peak equity may reset upward depending on configuration, but the limit parameters themselves do not change unless the owner updates them. What changes when an agent manages your small trading budget

How do you configure these limits before the first live order?

Setting up spend caps and drawdown limits is a sequential process that should be completed before any live key is authorized. Paper trading mode exists for exactly this reason. The owner can test the behavior of the limits without risking capital. The goal is to make the safety settings feel automatic and invisible when they work, and decisive when they do not.

  1. 01Define the total allocation. Decide how much of the wallet the agent is allowed to touch. This number should be money the owner can afford to lose entirely.
  2. 02Choose the scope. Determine whether the limit applies to a single market type or to the aggregate across all five market types. A multi-market agent needs an aggregate cap to avoid accidental leverage stacking.
  3. 03Set the spend cap. Enter the dollar amount and the reset window. If the strategy is experimental, start with a small lifetime cap.
  4. 04Set the drawdown limits. Pick both a short-term and a long-term threshold. The short-term limit should be tight enough to catch abnormal behavior quickly.
  5. 05Define the exit plan. Specify what happens at breach. Flatten positions and revoke the key are the standard choices.
  6. 06Review and authorize. Double-check that the withdrawal addresses on the wallet are owner-approved and that the panic switch is accessible.
  7. 07Monitor in paper mode first. Run the agent through scenarios that would trigger the limits to confirm the behavior matches expectations.

The exact request schema is in the docs; the shape looks like this:

{
  "key_id": "YOUR_KEY",
  "spend_cap": {
    "amount_usd": 2000,
    "window": "daily"
  },
  "drawdown": {
    "daily_percent": 5,
    "total_percent": 20
  },
  "exit_action": "flatten_and_revoke"
}

After the limits are configured, the owner must explicitly authorize the key for live trading. Until that authorization is granted, the agent can only place paper orders. The authorization step is a deliberate human gate that prevents accidental deployment. How to set spend caps and drawdown limits for an MCP trading agent

How do scoped keys and the panic switch reinforce these limits?

Spend caps and drawdown limits are software rules, but they are backed by cryptographic and operational controls. Each agent receives a scoped key that carries only the permissions the owner has granted. The key cannot withdraw funds to an arbitrary address. Withdrawal addresses are whitelisted by the owner in advance, and the agent itself has no ability to modify that whitelist.

The panic switch is a separate control that sits outside the agent's normal operation. It can be triggered manually by the owner or automatically by a drawdown breach. When activated, it sends cancel and flatten instructions across all connected venues and then revokes the agent's key. Because the funds remain in the owner's wallet, flattening simply returns capital to a neutral state. The agent never holds customer assets in a separate account.

Scoped keys also prevent cross-contamination between agents. If one agent hits its drawdown limit and its key is revoked, the other agents in a multi-agent system continue to operate within their own budgets. This isolation is essential for portfolio construction. How to architect a multi-agent trading system with real money

What should you monitor after the limits are live?

Static limits are not enough. The owner should review agent behavior regularly to ensure the limits are set at the right level. A limit that triggers constantly may be too tight for a viable strategy. A limit that never triggers may be too loose to protect against tail risk. A weekly review cycle is a practical minimum.

During each review, the owner should compare the agent's actual equity curve against the theoretical strategy and check whether limit breaches clustered around specific market events or agent decisions. If the agent consistently approaches its drawdown limit during normal volatility, the strategy may be misaligned with the risk budget rather than the market being uniquely hostile.

Monitoring should focus on three metrics. First, the utilization ratio of the spend cap. If the agent consistently uses most of its cap, the strategy may be undercapitalized or the cap may need adjustment. Second, the frequency of near-drawdown events. Repeated approaches to the daily limit indicate volatility that could eventually breach the total limit. Third, the time to recover after a drawdown event. If the agent is frequently halted and resumed, the strategy may not be suitable for autonomous execution.

Owners should also log every limit breach and the reason for reauthorization. This creates an audit trail that helps distinguish between normal strategy volatility and genuine agent errors. The Felix infrastructure provides these logs, but the owner must review them. Automation does not remove the need for human oversight.

What happens when an agent hits a limit?

When a spend cap is reached, new orders are rejected with a clear error stating that the cap has been exhausted. Existing positions are not closed automatically unless the owner has configured a separate rule. The agent may still exit positions to reduce exposure, but it cannot enter new ones. This prevents the common failure mode of an agent that keeps averaging into a losing trade.

When a drawdown limit is breached, the exit plan executes immediately. Open orders are canceled, positions are flattened, and the key is suspended. The agent receives no opportunity to argue or delay. The owner is notified through the configured channel. At this point, the owner should inspect the trade history, review the strategy prompt, and decide whether to adjust the limits, modify the strategy, or retire the agent entirely.

There is no automatic restart. The owner must explicitly reauthorize the key. This design prevents a loop where the agent loses money, gets halted, and then resumes with the same broken logic. Reauthorization should be treated as a deliberate decision, not a reflex. If the owner does not understand why the limit was hit, the agent should not go back live.

Frequently asked questions

Can the spend cap be changed while the agent is trading?

Yes, but any increase requires explicit owner confirmation through the same authorization flow used for live trading. Decreases take effect immediately and may cause open orders to be rejected if the new cap is already exceeded.

Does a drawdown limit close positions or just stop new orders?

A standard drawdown limit triggers the exit plan, which includes flattening existing positions and revoking the key. The owner can configure a softer version that only halts new orders, but the recommended default is to flatten.

Are spend caps and drawdown limits shared across multiple agents?

No. Limits are scoped to individual keys. Each agent operates within its own boundaries. If you want a portfolio-level limit, you must set it at the wallet level or manage key budgets so that their sum equals your total risk tolerance.

What if the wallet receives a deposit during a drawdown?

The drawdown calculation is based on equity, so a deposit raises the equity value. However, the peak equity used for drawdown measurement does not automatically reset upward unless the owner explicitly chooses that behavior in the configuration.

Can I use these limits in paper trading?

Yes. Paper trading supports the same limit infrastructure so that owners can observe how the agent behaves when it approaches or breaches a cap. This is the recommended way to validate safety settings before live authorization.

Who controls the panic switch?

The wallet owner controls the panic switch. The agent cannot disable it. It can be triggered manually by the owner or automatically by a drawdown breach.

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.