A production AI trading agent is not a single model call. It is a composed system: data planes, decision services, risk gates, execution adapters, and observability — wired so that failure is local and recoverable.
This article outlines a practical blueprint used by serious desks building autonomous or semi-autonomous crypto systems. Treat it as a reference architecture you can thin down for research or harden for live capital.
Design principles
- Separate cognition from control — models propose; risk services dispose.
- Make state explicit — inventory, limits, regime, and open orders live in typed stores, not chat history.
- Prefer idempotent actions — retries must not double-spend or double-order.
- Observe everything — if you cannot reconstruct why a trade happened, you cannot improve the agent.
- Degrade gracefully — stale data or model outages should force flat or human mode, not improvisation.
Reference layers
1. Ingress & market data plane
Expanded treatment: Data Stack for AI Trading Agents.
WebSocket and REST collectors normalize venue feeds into a canonical event schema. Include sequence numbers, receive timestamps, and quality flags. A dedicated data quality service marks feeds as healthy, delayed, or dead — downstream modules must refuse to trade on dead data.
Venue WS/REST → Normalizer → Event bus
↓
Feature store (online)
Historical lake (offline)
2. Feature & context assembly
Online features power low-latency decisions (book imbalance, short-horizon volatility, inventory skew). Offline/batch features capture slower structure (regime clusters, funding cycles, narrative scores). Context for LLM planners is assembled as structured tool outputs — never as raw firehose dumps.
3. Decision core (the “agent”)
Implement as modules that can be mixed:
- Signal models — scores, forecasts, classifiers
- Planner — LLM or rules engine selecting a playbook
- Tool layer — portfolio query, risk preview, simulators, venue health
- Policy compiler — converts high-level intent into order intents with size caps
For crypto, multi-agent designs (research agent, risk agent, execution agent) are popular, but start with a single orchestrator and hard interfaces. Coordination tax is real.
The planner can be smart. The order path must be boring.
4. Risk gate (mandatory)
Independent process or service that validates every order intent against: max position, max notional, max daily loss, symbol allowlist, leverage caps, concentration, and venue status. The risk gate is not optional middleware — it is the product boundary between “research toy” and “capital system.”
The model must not be able to bypass the risk gate by prompting, configuration, or direct venue credentials. Keys and signing live behind the execution/risk path only.
5. Execution adapters
Per-venue adapters handle auth, rate limits, order types, and reconciliation. A smart order router (SOR) may split flow, but keep the agent’s mental model at the intent level: target exposure, urgency, max slippage. Microstructure tactics belong in execution, not in the LLM prompt.
6. Memory & ledger
- Operational memory — positions, balances, open orders, last decision IDs
- Episodic memory — trade rationales, incident notes, regime tags
- Ledger — immutable record of intents, approvals, fills, cancels
Vector stores are optional for narrative recall. A reliable relational or time-series store for money state is not optional.
7. Control plane & human loop
Dashboards, kill switches, mode toggles (shadow / paper / live), and alert routing. Human-in-the-loop should be a first-class mode: agent proposes, human approves above a notional threshold.
Latency tiers
Not every decision needs the same speed:
- Hot path (ms–s) — market making, inventory skew, cancel/replace
- Warm path (s–min) — tactical entries, funding trades, alert-driven hedges
- Cold path (min–hours) — research agents, rebalancing, narrative risk reviews
Put LLMs on warm/cold paths. Put deterministic microcontrollers on hot paths. Hybrid systems win because they respect physics and fees.
Recommended service split
services/
marketdata/ # ingest + normalize
features/ # online feature compute
agent-core/ # policy + tools + planner
risk/ # limits + kill switch
execution/ # venue adapters + SOR
ledger/ # intents & fills
ops-api/ # UI, auth, mode control
observability/ # metrics, traces, logs
Monoliths are fine early. Keep logical boundaries even if processes are co-located. When you scale, split along failure domains: market data crashes should not take risk offline without a safe default.
Security surfaces
- API keys in HSM/KMS with least privilege (trade vs withdraw separation)
- Prompt injection resistance when tools can read web/social content
- Signed config for risk parameters; no silent remote edits
- Network isolation between research notebooks and live order path
Evolution path
- Rules + risk + execution + logs
- Add ML signals offline; shadow score live
- Add agent planner for research and playbook selection
- Promote limited autonomy with tight notional and symbol scopes
- Expand only after evaluation gates pass (see our evaluation article)
Architecture is a product of risk appetite. Start narrow. Widen only when the measurement system is stronger than the marketing story.
Frequently asked questions
What is a good architecture for an AI trading agent?
A composed system with market data ingress, feature assembly, a decision core, a mandatory independent risk gate, venue execution adapters, ledger/memory, and a human control plane with kill switches.
Why must risk be a separate service?
So models cannot bypass position, loss, or venue limits. Risk is a product boundary between research demos and systems allowed to risk capital.
Should LLMs run on the order hot path?
Usually no. Use deterministic logic for millisecond-to-second execution and reserve LLMs for research, playbook selection, and lower-frequency decisions.
What is the recommended evolution path for trading agents?
Start with rules + risk + execution + logs; add offline ML shadow scores; introduce planners for research; promote limited autonomy only after evaluation gates pass.
Related: Data Stack · Types of AI Trading Agents · How to Build an AI Trading Agent · What Is an AI Trading Agent? · Backtesting & Evaluating Trading Agents
