Prompt designAgentic tradingRiskDevelopers

How to design prompts for trading agents from first principles

Good prompt design for trading agents starts with clear intent, bounded action space, and explicit refusal rules rather than clever wording or model selection.

By the Felix team9 min read
Key takeaways
  • 01A trading prompt must define intent so precisely that doing nothing is as clearly specified as taking action.
  • 02Context injection, not prompt length, keeps the agent grounded; assume the model knows nothing about current positions or time unless told.
  • 03The decision boundary should be structured as explicit if-then rules with allowed actions and mandatory refusal conditions.
  • 04Every untested assumption in a prompt becomes a liability; paper trade and version prompts like production code.
  • 05Prompts align reasoning, but hard limits on scoped keys and budget caps are what prevent catastrophic execution.

A well-designed prompt is the primary control surface for a trading agent because it defines what the agent sees, how it interprets context, and which actions it considers valid. Poor prompt design does not fail with an error message; it fails by producing subtle, expensive misinterpretations of market data or owner intent. The goal is not to trick a model into correct behavior, but to remove ambiguity so that correct behavior is the only remaining path.

Why do prompts matter more than model choice for trading?

Trading agents operate in high-stakes environments where a single misinterpretation can open an unintended position or ignore a stop-loss. A more capable model given a vague prompt will simply generate more plausible-sounding reasoning for the wrong action. The prompt is the interface between the owner's strategy and the agent's execution. It must encode intent, constraints, and context in a way that leaves no room for creative interpretation. This is why prompt engineering for trading is closer to writing a specification document than to casual conversation. You are not asking for advice; you are defining a procedure. A larger context window or newer model weights cannot compensate for a procedure that contains internal contradictions or undefined terms. If the prompt says 'reduce risk' without defining the metric, the model may interpret that as closing a position, reducing size, or hedging with an option, depending on what it saw in training data. The owner needs deterministic alignment, not statistical creativity.

What should a trading prompt specify about intent?

Start with a single sentence of intent that is specific enough to exclude alternative interpretations. 'Trade profitably' is not intent; it is a wish. 'Maintain a delta-neutral portfolio within a five percent tolerance by rebalancing at a fixed daily time' is intent. The prompt should state the asset class, the desired exposure direction if any, the time horizon, and the conditions under which the agent should do nothing.

Define invariants next. These are the properties that must hold true after any action. For example, 'total notional exposure must never exceed the budget cap configured on the scoped key,' or 'only one open position per market is permitted at a time.' Invariants give the agent hard boundaries that do not depend on market interpretation. They also make it easier to audit decisions later, because every output can be checked against a simple true or false statement.

Replace vague adjectives with numeric thresholds or explicit references to context variables. Words like 'aggressive,' 'conservative,' 'high,' or 'low' shift meaning across market regimes and model versions. Instead, write 'if the twenty-four hour volume is below the thirty-day average, do not open a new position.' This removes the model's need to interpret language and turns the decision into a comparison that the context data either satisfies or does not.

  • ·Define the strategy in one sentence that excludes opposite interpretations.
  • ·List the allowed instruments using the exact identifiers the API expects.
  • ·State the default action when no signal is present, usually 'hold and wait.'
  • ·Specify whether the agent may hedge, close, or only open positions.
  • ·Write invariants as absolute statements that must remain true after any action.

How do you ground the agent in current context?

An agent without context hallucinates market states. The prompt must describe what information is injected at inference time and how the agent should weigh it. Include the current portfolio state, open orders, available buying power, and the timestamp of the last market data update. If the prompt relies on external reasoning tools, state that explicitly. Never assume the model knows the current time, the trading day, or whether a position is already open.

Time is a common source of error. The prompt should specify the timezone for any scheduled logic and should require the model to check the timestamp of the provided market data before acting. If the data is stale, the prompt should instruct the agent to return a refusal rather than trade on outdated prices. For multi-market agents, the context must clearly separate data from one market type (e.g., stocks) from another (e.g., a perps venue) so that the agent does not conflate prices or margin rules.

Portfolio state should be expressed in dollars, not in share counts or token amounts, because the agent needs to reason about exposure in consistent units. If the prompt allows the agent to trade across multiple markets, it should include a summary of total exposure and available buying power so that the agent can enforce the owner's invariants. A practical checklist for building your first LLM-powered trading agent

Where do most prompt designs fail?

Most failures come from ambiguity, overload, or hidden assumptions. Ambiguity appears when prompts contain conflicting goals, such as 'maximize returns while minimizing risk' without defining the trade-off. Overload happens when a prompt tries to embed a full technical analysis manual, causing the model to ignore the specific constraints. Hidden assumptions are the worst: the owner assumes the agent knows not to trade during specific events, or knows that 'sell' means 'close the long' rather than 'open a short.'

Negation is weaker than enumeration. Telling a model what not to do leaves an infinite space of alternative actions, many of which are also wrong. It is more reliable to define the small set of valid actions and state that any other situation must produce a refusal. For example, instead of 'do not trade if volatility is high,' define the exact volatility threshold that triggers a refusal, or remove the action entirely by requiring the agent to check a precomputed signal that already filters for it.

Prompts that read well to a human often fail under logical scrutiny. A sentence like 'act cautiously when the market is uncertain' sounds reasonable but contains no executable logic. Trading prompts should be read as if they were code review comments. If a statement cannot be translated into a boolean check or a variable assignment, it should be rewritten or removed. This discipline prevents the 'sounds good' trap where the owner feels confident but the agent has no actual instruction.

  • ·Remove adjectives that do not have numeric definitions.
  • ·Split complex strategies into sequential prompts or distinct tool calls.
  • ·State every assumption you would tell a human trader on their first day.
  • ·Replace negation with a closed set of allowed actions plus a default refusal.

How should you structure the decision boundary?

The decision boundary is the set of conditions that map context to action. Structure it as an explicit if-then framework inside the prompt, even if the model will output structured JSON. List the allowed actions, the required fields for each, and the conditions that trigger a refusal. A refusal is a valid and desirable output; the prompt should state exactly what to return when no action is appropriate.

Avoid asking the model to rate its own confidence. Confidence scores are uncalibrated and create a false sense of control. Instead, define the threshold in the prompt and let the decision be binary: either the conditions for action are met, or they are not. If the owner wants to see reasoning, require a short chain-of-thought in a dedicated field, but keep the final output strictly structured. The reasoning field is for audit; the action field is for execution.

If the agent uses tools to calculate position size or risk metrics, the prompt should name the tool explicitly rather than asking the model to perform the calculation. This reduces arithmetic errors and ensures that the agent reasons about values that have been computed consistently. For example, write 'call the sizing tool with the current portfolio state and use the returned dollar amount for the order.' This aligns the agent's reasoning with the same math the API will use. How to build scoped API keys for a trading agent step by step

The refusal condition is as important as the action condition. Specify the format of a refusal so that downstream automation can log it, alert the owner, or simply wait for the next cycle. A refusal should include a reason string drawn from a closed set, such as 'budget_cap_exceeded' or 'stale_data,' so that the owner can filter logs without parsing free text.

How do you test and version prompts before going live?

Never test a new prompt with live capital. Use paper trading to observe how the prompt behaves across different market regimes, but be aware that paper fills do not guarantee live execution quality. Version your prompts with the same discipline as code. Maintain a changelog that records the prompt text, the model version, the date, and the observed behavior changes. What beginners get wrong when taking an AI trading agent live

Build a regression suite of context snapshots representing different market states, including edge cases. For each snapshot, the prompt should produce the same decision every time, given the same model version. Add snapshots that contain stale data, zero balance, or conflicting signals to verify that the agent refuses correctly. Red-team the prompt by deliberately injecting nonsensical or extreme values to see if it ever bypasses the refusal logic.

When reviewing outputs, look for any response that adds caveats or asks clarifying questions. If the agent ever writes 'it depends,' the prompt is under-specified. The goal is deterministic structured decisions given the same context. Before moving from paper to live, re-evaluate the prompt under the assumption that latency and slippage may change the economics of the strategy. A prompt that works in simulation may need tighter thresholds in production.

Finally, review the prompt alongside the infrastructure limits. The scoped key, budget cap, and kill switch are the hard controls. The prompt is the soft control that aligns reasoning. Both must be reviewed together during audits. If the prompt assumes a ten thousand dollar position but the scoped key allows fifty thousand, the owner has created a gap between intent and enforcement. How prompt design breaks trading agents in 2026

Frequently asked questions

Should I include technical indicators in the prompt text?

No. Feed market data and indicators through the context or tool results. Keep the prompt text static and focused on decision rules so that it remains stable and testable across different market conditions.

How long should a trading prompt be?

As short as possible while preserving completeness. Every extra sentence is a potential source of drift. If the prompt exceeds a few hundred tokens of instruction, decompose it into a system prompt plus a structured reasoning template.

Can I reuse the same prompt across stocks, crypto, and prediction markets?

Only if you have explicitly parameterized the asset-specific logic. Each market type has different settlement rules, margin mechanics, and hours. A generic prompt will make assumptions that cost money.

What happens if the model ignores the prompt constraints?

The infrastructure layer must still enforce hard limits through scoped keys, budget caps, and position limits. The prompt is a soft control that aligns reasoning; the API layer is the hard control that prevents execution.

Do I need to update the prompt when market volatility changes?

You should update the prompt if your strategy's decision rules depend on volatility regimes. However, avoid hardcoding specific numbers that change daily. Instead, reference variables that the context provides.

Is it better to use chain-of-thought reasoning or direct action output?

Chain-of-thought can help during testing and audit, but it should be constrained to an internal reasoning field. The final output must be a structured action or refusal with no ambiguity. Never let the model emit free-text trade instructions.

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.