
Executive Summary
MEXC’s 2026 AI Trading Survey found that while AI is already widely used in crypto trading, users place strong emphasis on control as AI moves closer to execution. Willingness to use automated trading rose from 55% to 71.8% when limits on funds, positions, leverage and losses were introduced.
Building on these findings, MEXC and Hacken developed this AI Trading Safety Handbook to provide practical guidance on the safer use and deployment of AI-assisted and automated trading tools, covering secure access, permission and financial limits, tiered approvals, execution controls, monitoring and security testing.
The handbook considers AI trading safety from both the user and platform perspectives. After outlining the key risks and safeguards, it translates these principles into practical self-check guidance for users and platforms.
1. Why AI Trading Needs a Different Safety Model
AI can support research, decision making and trade execution, but its output should not be treated as the final authority for execution. AI responses can be incorrect, influenced by external content or affected by compromised inputs, and confidence alone does not guarantee reliability.
As AI moves closer to execution, proposed actions should pass through independent controls before reaching the market. These controls should verify whether each action falls within predefined permissions, financial limits and risk parameters.
For exchange-integrated agents, this control layer can sit between the AI agent and the exchange API, with additional protections enforced at the account level. The goal is not to prevent automation, but to ensure that automated actions remain within clearly defined boundaries.
2. Secure the Connection Between AI and the Exchange
When an AI agent connects to an exchange account, the integration layer becomes a critical part of the security model. Key risks include:
- API keys stored in configuration files, logs or model context
- Sessions that remain trusted after initial authentication
- Broad tools with access to multiple API endpoints
- Third-party plugins with access to credentials
A 2026 study of 7,973 live remote MCP servers found that 40.55% exposed tools without authentication. Among 119 testable OAuth-enabled MCP servers, every server exhibited at least one authentication flaw.
A safer setup should minimize the credentials and permissions available to the AI agent itself. Key protections include:
- Credential brokering. The exchange API key is stored in a separate gateway rather than given to the AI agent. The agent sends a trade request to the gateway, which submits it to the exchange.
- Per-action authorisation. Each trade request is checked against the agent’s permissions before reaching the exchange. An existing login or session does not automatically authorise new actions.
- Sandboxing. The agent runs in an isolated environment and connects only to approved services required for its operation.
- Scoped keys. The exchange key can place trades but cannot withdraw funds or change account permissions. It should also be restricted to approved IP addresses and remain immediately revocable.
3. Input data and execution risks
3.1 Indirect prompt injection
Trading agents process external content such as news, research pages, social posts, token descriptions and API responses. This content may contain instructions designed to influence the agent’s behaviour.
An attacker does not need direct access to the agent, exchange account or API key to affect its output. For example, a malicious instruction embedded in a research page could tell the agent to ignore its trading criteria and buy a particular token.
Hacken lab testing demonstrated a similar attack path in which an instruction embedded in a changelog caused an agent to execute a script without explicit approval. In a trading context, the potential consequence could be an unauthorised trade, a change in trading parameters or a series of orders.

External content should therefore be treated as data, not as a trusted source of instructions. The agent can propose an action, while a separate policy layer determines whether that action is permitted before it reaches the exchange.
3.2 Market-signal manipulation
An agent can also make an inappropriate trading decision when its inputs are technically valid but the underlying market signal has been manipulated.
Examples include:
- Fake volume: Artificial trading activity makes an illiquid asset appear more liquid.
- Spoofed order books: Large orders create apparent buying or selling pressure before being cancelled.
- Coordinated sentiment: Multiple accounts publish similar claims to influence an asset’s perceived sentiment.
- Stale or incorrect data: A delayed or faulty price feed causes the agent to calculate an order using an outdated price.
The resulting order may be valid from the exchange’s perspective. The risk comes from the information used to make the decision. Controls should validate data quality before execution and apply limits to the resulting order.
4. Build Deterministic Guardrails Around AI Execution
An AI agent may continue to operate with valid credentials even if its decision-making has been influenced or manipulated. A valid API key, a permitted endpoint and a technically valid order do not by themselves ensure that the action is safe or intended.
Deterministic guardrails provide a separate enforcement layer. They apply fixed rules to proposed transactions before execution and do not depend on the model correctly interpreting or following those rules.
4.1 Where controls should operate
Where a control is enforced determines how effectively it can constrain an AI agent if the agent is compromised or behaves unexpectedly.

A control should be enforced outside the component it is intended to constrain. In practice, this means an AI-generated trade should not rely on the AI itself to decide whether it stays within the rules. Before execution, the proposed trade should pass through an independent check against predefined permissions and risk limits. If it stays within those limits, it can proceed; if not, it should be blocked.
For example, a model instruction saying «never trade more than $10,000» is a recommendation to the model. A gateway that rejects orders above $10,000 enforces the limit regardless of the model’s output.
Preventive controls should enforce limits automatically. Alerts and manual pauses remain useful for investigation and incident response, but they depend on user intervention.
4.2 Withdrawal and financial limits
A trading agent should not have permission to withdraw or transfer funds. This reduces the impact of a compromised API key, but it does not by itself prevent trading losses.
An attacker controlling a trade-only key could still:
- Buy a low-liquidity asset from an attacker at an inflated price.
- Trade against a manipulated market and provide the attacker with an exit.
- Open a highly leveraged position that generates losses.
For this reason, safe AI trading requires more than permission controls alone. It also requires clear financial limits on how much the agent can trade, how much exposure it can build and how much loss it can incur.
A permission limit defines what the agent may do, such as trading without withdrawals. A financial limit defines the maximum exposure, such as a $10,000 order limit, $25,000 position limit or $5,000 daily loss limit.
Both are important for safer AI trading. Removing withdrawal access does not prevent losses through authorised trading functions.
4.3 Independent Rules Check Before Execution
Before an AI-generated trade reaches the exchange, it should pass through an independent rules check. This control layer, often implemented as a policy gateway, evaluates the proposed order against predefined permissions and risk limits. It either rejects the order or allows it to proceed to the exchange.

For example:
Agent: Buy 50,000 units of Token X at $2.10.
Gateway checks:
- Is the agent authorised to trade Token X?
- Is Token X on the approved market list?
- Is the order within the configured order limit?
- Would the resulting position exceed the exposure limit?
- Is leverage within the configured limit?
- Is the price within the permitted range against an independent reference price?
- Has the agent exceeded its order-rate limit?
- Is the market sufficiently liquid?
- Is the price data sufficiently recent?
If a mandatory condition fails, the gateway rejects the order. The model cannot override the decision.
Recommended controls include:
- Agent and account scope: Only approved agents can submit orders for designated accounts.
- Market allowlists: The agent can trade only approved pairs and markets.
- Order and position limits: Individual orders and total exposure have fixed maximums.
- Leverage limits: The gateway prevents the agent from exceeding configured leverage.
- Rate limits: The number and frequency of orders are capped.
- Price collars: Orders outside an allowed range around a reference price are rejected.
- Loss and drawdown monitoring: Trading stops when predefined thresholds are reached.
- Behaviour monitoring: Significant deviations from expected activity can trigger additional controls or a stop.
- Data-quality checks: Stale prices, insufficient liquidity or conflicting market data can prevent execution.
The gateway does not determine whether the AI’s strategy is correct. It determines whether the proposed action is permitted and within defined risk limits.
4.4 On-Chain Execution Controls
When an AI agent operates on-chain, transaction permissions can also be enforced at the wallet or smart-contract level, providing an additional layer of control outside the AI model itself.
- Session keys: Mechanisms such as ERC-4337 and ERC-7579 can restrict an agent to specified contracts, assets, functions and spending limits for a defined period.
- Time-locks: Transactions above a defined threshold can be delayed, allowing a user or security system to cancel an unexpected transaction.
- Transaction simulation: Transactions can be simulated before signing to identify expected effects, including contracts called, assets transferred and amounts involved.
These controls do not depend on the AI model following instructions. Because session-key and policy mechanisms are themselves smart contracts, they should be independently audited and included in security testing.
5. Match Controls to the Level of Risk
5.1 Tiered approvals
Approval requirements should reflect the level of risk involved. Requiring users to repeatedly confirm low-risk actions may reduce the attention they give to higher-risk requests.

The agent must not have permission to grant itself additional permissions or raise its own limits. More broadly, the goal is not to require confirmation for every action, but to apply stronger controls as the potential impact increases.
5.2 Minimum Control Baseline
A strong baseline for AI trading safety should include:
- Agent keys without withdrawal or transfer permissions
- Isolated funds for agent activity
- User-defined loss limits
- Full-path logging
- An exchange-operated kill switch
Changes that reduce risk should take effect immediately, while changes that increase permissions or limits should require additional confirmation and, where appropriate, a delay.
5.3 Kill switch and logging
The kill switch should operate independently of the AI agent and its vendor. It should be able to revoke the agent’s key or permissions, cancel open agent orders and block new orders. Automatic activation can be configured for conditions such as unusual order-rate spikes, loss-limit breaches or activity from an unapproved IP address.
Each agent order should also maintain a clear audit trail, including the input that triggered the action, model output, tool calls and parameters, policy decisions, required approvals and the exchange order ID. These records support incident investigation, dispute handling and post-incident analysis.
6. Audit and Red Teaming: Test the Full Execution Path
General security certifications such as SOC 2 address important organisational and technical controls, but they do not by themselves test how an AI trading agent behaves under adversarial conditions. AI-specific red teaming can complement traditional security assessments by testing the full path from model input to trade execution.
For a trading agent, testing should cover the model, external inputs, tools, APIs, permissions and execution controls. The goal is to determine not only whether the agent can be manipulated, but whether that manipulation can lead to an unauthorised trade, excessive exposure, credential compromise or another defined business impact.
Hacken’s AI Red Teaming Methodology structures this assessment around reconnaissance, vulnerability assessment, controlled exploitation and impact analysis, followed by remediation and verification.

6.1 Assessment approach
- Reconnaissance and Attack-Surface Mapping
Start by mapping how the agent receives information, what systems it can access and where it can take action. This should include:
- Model and model version
- System and developer instructions
- External data and retrieval systems
- Trading tools and APIs
- Authentication and authorisation flows
- API keys and other credentials
- Exchange accounts and sub-accounts
- Plugins and third-party services
- Policy gateways and execution controls
- Logging, monitoring and kill-switch mechanisms
The goal is to identify where an attacker or malicious input could enter the system, and what actions the agent could potentially take from there.
- Vulnerability assessment
Test the identified attack surfaces for:
- Direct and indirect prompt injection
- External data manipulation
- Unsafe tool invocation
- Excessive permissions
- API authentication and authorisation weaknesses
- Session and credential weaknesses
- Malicious or over-privileged plugins
- Insufficient execution guardrails
- Memory or retrieval poisoning
- Weak approval controls
- Missing or ineffective kill switches
The assessment should distinguish between manipulating the model and reaching a sensitive action. The second determines the potential business impact.
- Controlled exploitation
Where a vulnerability is identified, reproduce the attack in a controlled environment and follow it through to the execution layer. For example:
- Place an instruction in a research source available to the agent.
- Observe whether the agent interprets it as an instruction.
- Determine whether it generates an order.
- Submit the proposed order to the execution layer.
- Check whether the policy gateway blocks it.
- Record prompts, responses, tool calls, policy decisions and resulting activity.
The same approach can test order splitting, stale market data, restricted API functions and compromised credentials.
- Impact analysis
If the attack succeeds, assess the resulting business and user impact, including:
- Unauthorised trades
- Excessive position or leverage exposure
- Financial loss
- Unauthorised transfer of value through trading
- Credential or data exposure
- Access to other accounts or services
- Circumvention of trading policies
- Operational disruption
- Regulatory or compliance exposure
The analysis should account for controls encountered during the attack. A manipulated model whose proposed order is rejected by an exchange-side gateway presents a different business impact from a manipulated model whose order executes.
6.2 Minimum trading-agent test cases
At a minimum, security testing for an AI trading agent should cover the following scenarios:
- Indirect prompt injection: Test whether instructions embedded in news or research content can change the trading decision or trigger a tool call.
- Token metadata injection: Place instructions in token names or descriptions and test whether the agent treats them as commands.
- Market-data manipulation: Test stale prices, incorrect data, spoofed order-book information and artificial volume.
- Tool and privilege abuse: Attempt to invoke functions or permissions outside the agent’s intended scope.
- Order-limit bypass: Split transactions across multiple orders to test whether cumulative exposure controls still hold.
- Loss-limit and kill-switch testing: Generate controlled losses or order bursts and verify that execution stops as configured.
- Credential misuse: Attempt to use a leaked key from an unapproved IP address or outside its permitted scope.
- Malicious tool testing: Introduce a controlled tool that attempts to send credentials or sensitive data to an unauthorised destination.
- Approval bypass: Manipulate information presented to a human reviewer and verify that the approval interface still displays the actual transaction and relevant risk.
Each test should record the input, agent response, tool invocation, control decision and final outcome.
6.3 Remediation and verification
Findings should identify the affected component, attack path, supporting evidence, severity, impact and recommended remediation.
Remediation may involve:
- Restricting agent permissions
- Separating external content from trusted instructions
- Strengthening policy-gateway checks
- Restricting tools and API endpoints
- Improving input or output validation
- Adding data-quality checks
- Strengthening monitoring and kill-switch logic
- Changing approval requirements
- Rotating or restricting credentials
After remediation, the original attack or test scenario should be repeated to verify that the fix is effective. A model or prompt change alone may not close the underlying attack path.
Production systems should also be reassessed after material changes to the model, tools, permissions or execution architecture. Periodic and regression testing can help identify newly introduced attack paths.
From Principles to Practice
5 Safety Checks for Users and 5 Safety Principles for Platforms
Users can use these checks to stay in control when trading with AI, while platforms can use the principles to build safer AI-enabled trading systems.
Part I | For Users: Use AI, Keep Control
1 | THINK & ASK
Ask Better Questions
Pick an asset and let AI help you understand market moves and the key factors behind them.
Try: “What important market moves has BTC seen recently, and why?”
2 | RESEARCH & VERIFY
Don’t Just Trust. Verify.
Check the AI’s sources, how recent its data is, and any possible errors.
Try: “What is your analysis based on? Which information hasn’t been verified yet?”
3 | USE RISK LIMITS
Set Your Boundaries
Decide whether AI only provides advice or also takes part in execution. Before using automated trading, define your limits on funds and risk.
Try: “Before I use AI for automated trading, what limits on funds and risk should I consider?”
4 | STAY IN CONTROL
Stay in Charge
Confirm the permissions the AI actually has, which trades require your approval, and how to pause trading or revoke access.
Try: “Which permissions and stop options should I check to stay in control?”
5 | TRACK & REVIEW
Learn. Adjust. Repeat.
Review the AI’s judgments, your own decisions and the actual results to find what can be improved.
Try: “Which judgments in this trading decision suggestion were sound? What could I improve next time?”
ASK → VERIFY → LIMIT → CONTROL → REVIEW
AI analysis requires independent verification. Limits on funds, permissions and risk should follow the platform’s actual settings and cannot rely on prompts alone.
Part II | For Platforms: Build Safety Into AI Execution
1 | GUARD ACCESSProtect access and credentials Use scoped permissions, credential protection, sandboxing and revocable access.
2 |USE ENFORCED LIMITSEnforce permission and financial boundaries Limit assets, funds, positions, leverage and losses.
3 | APPROVE BY RISKMatch autonomy to risk Allow low-risk actions to run automatically while requiring stronger approval for higher-risk actions.
4 | REQUIRE INDEPENDENT CONTROLSKeep execution controls independent of the AI Check proposed actions against predefined rules before execution so the AI cannot override its own limits.
5 |DETECT, LOG & TESTMonitor, log and test the full execution path Maintain logging and kill-switch capabilities, and regularly audit and red-team the system.
AI Trading Safety Checklist
For Users
- Have I verified the AI’s sources and data?
- Have I defined my fund and risk limits?
- Do I understand what permissions the AI has?
- Do I know which actions require my approval?
- Can I pause trading or revoke access immediately?
- Can I review what the AI did and why?
For Platforms
- Are credentials and permissions properly scoped?
- Are capital, position, leverage and loss limits enforced?
- Are execution controls independent of the AI model?
- Do higher-risk actions require stronger approval?
- Are logging and kill-switch mechanisms in place?
- Are controls regularly audited and red-teamed?
