Lab · architecture note

Building a trading agent from scratch

Six services, one VPS, and a rule I will not bend: the model proposes, a human disposes. This is the architecture note for the platform — what runs today, what the risk gate has to look like before any order is ever sent, and how the whole thing is staged.

Open the platform Private workspace, login required

Where this stands. The live platform is Slice 1: multi-agent research on US and European equities, watchlists, HTML reports, and per-call cost tracking — with no broker connected and live trading disabled by design. Portfolio analytics, backtesting, order staging and the execution gateway below are the target architecture, not shipped features. They are marked as such throughout.

01 · System architecture

Six services, decoupled on purpose

Separation is not elegance here: the agent engine is the component most likely to break, so it must be able to crash without taking the API, the database or the site down with it.

1 · Web dashboard
analysis · watchlists · reports · cost  — live
↓ REST
2 · Backend API
auth · job management · routing  — live
Market data
prices · news · filings
live
3 · Agent engine
bull / bear debate · rating
live
4 · Risk & execution
rule checks · broker API
not built
↓ persistent storage
5 · PostgreSQL (runs, usage, watchlists) · Redis (queue) — live  |  6 · audit log of every agent turn — live
01

Frontend

Responsive single-page dashboard: launch an analysis, follow its stage, read the debate, download the report, watch the spend.

02

Backend API

FastAPI: authentication, job submission, history, watchlists, cost reporting. One operator, one password, signed sessions.

03

Agent engine

TradingAgents on LangGraph: four analysts in parallel, then a bull/bear debate, a risk debate, and a five-tier rating.

04

Risk & execution gateway

The component that does not exist yet — and the reason nothing can trade today. Hard limits and broker calls live outside the model, never inside it.

05

Persistence

Every run, section, token count and cost is stored: the audit trail is a product feature, not a log file.

06

Assistant bridge

A messaging bot that delivers a finished report or answers "what did the last NVDA run say" without opening the dashboard.

02 · Risk management

What must be true before an order exists

  • No direct execution by the model. Agents produce a recommendation and a rationale. They have no credential, no endpoint and no tool that can reach a broker.
  • Rule validation first. Exposure caps, position sizing, stop-loss and instrument eligibility are deterministic code, checked before anything is staged.
  • Human in the loop. An order sits in an approval queue until a named person validates it — with the agent's reasoning attached.
  • Kill switch. One control halts every automated workflow immediately, and the halt is logged.
Target execution pipeline
1 · Market analysislive
2 · Strategy & risk checksnot built
3 · Human approvalnot built
4 · Order submissionblocked
5 · Reconciliation & auditblocked

Steps 4 and 5 are blocked by construction: the platform ships with live trading hard-disabled and no broker connector in the codebase.

Mockup of a risk dashboard: drawdown gauge at 12 percent, equity curve, daily loss limit, maximum trailing drawdown and real-time P&L
Target risk & exposure monitor — drawdown gauge, trailing limit, daily loss cap and live P&L. Mockup, not a shipped screen.
03 · Functional modules

What it exposes — and what it will look like

Running today

Analysis on US and European equities and ETFs · watchlists · self-contained HTML reports with full history · per-call token and cost ledger · six LLM providers, French or English output. That is the whole product, and it does not look like the mockups below.

Target interface

Mockup of a market overview: major indices, commodities, crypto and a watchlist

Market overview

planned

Indices, commodities, crypto and a live watchlist on one screen — the entry point before an analysis is launched.

Mockup of an AI research screen: bullish picks, AI targets, hit rate and forward-testing panel

AI research terminal

partly live

Thesis reports, agent debate transcripts and bullish/bearish scoring. The reports and transcripts exist today; the scored, ranked layout does not.

Mockup of portfolio analytics: Sharpe ratio, cumulative return versus benchmark, asset allocation donut and risk metrics

Portfolio analytics

planned

Sharpe, drawdown, volatility, allocation and benchmark comparison — designed, not shipped. Nothing here is wired to a broker, so it would run on declared positions first.

Mockup of backtest results: equity curve, drawdown chart, monthly returns grid, strategy statistics and trade list

Backtesting

next

Historical simulation with fees and slippage — the gate that decides whether a rating carries information at all. This is stage 3 of the roadmap.

Mockup of an approval queue: pending orders listed per user with approve and decline actions

Order management & approval

blocked

The staging area where an agent recommendation waits for a named human. It only makes sense once the risk engine exists — and it has no broker behind it today.

Every image on this page is a target-interface mockup, not a screenshot of the running platform. The live Slice 1 UI is plainer: an analysis form, a stage tracker, the debate transcripts, the HTML report and the cost ledger.

04 · Hosting

One VPS, no collateral damage

Component Deployment Impact
This websiteUntouched, separate containernone
Assistant gatewayIndependent containernone
Agent engineIsolated worker, Redis queueone run at a time
API & databaseFastAPI + PostgreSQL, own volumes~400 MB RAM
Reverse proxyExisting Traefik, own host rule and certificateno port published
Model callsExternal APIs, no local inferenceno GPU needed
05 · Rollout

Five stages, and where the line is

01

Setup

Environment, dependencies, containers.
done

02

Validated

End-to-end runs on US and EU tickers, cost measured per run.
done

03

Backtest

Historical testing with fees and slippage.
next

04

Paper

Live feeds, simulated fills, no capital.
planned

05

Live

Broker execution under risk gates and human approval.
blocked

Stages 3 to 5 stay closed until a rating can be shown to carry information. Publishing a trading platform is easy; publishing one that has earned the right to touch capital is the work. Until then the platform produces research, and says so.

See the running part

The analysis engine, the debate transcripts, the reports and the cost ledger are live on the platform. The rest is a roadmap, deliberately gated.

Open the platform Back to the Lab