Strategy Studio
The Studio tab is a two-pane workspace for building strategies — with AI or by hand — that follow the strategy contract and flow through the same backtest → gauntlet → paper pipeline.
- A left rail lets you create a strategy (Describe with AI or Start from scratch) and browse/search your saved ones; click any to open it.
- A right workspace holds the active strategy in two tabs: Code (a syntax-highlighted editor → validate → save → backtest) and Copilot (a research chat that reads the strategy’s results and can revise its code).
Turn a plain-English idea (“buy SPY when RSI(2) closes below 10; sell after 5 days”) into runnable code, or open the Start from scratch template and write it yourself — either way it’s validated and sandboxed before it runs.
Bring-your-own LLM key
Section titled “Bring-your-own LLM key”The Studio uses your own Anthropic API key (the same bring-your-own posture as the data keys). Add
it on the Settings page or as ATS_ANTHROPIC_API_KEY; it’s stored in backend/.env, never logged,
and your prompt and the generated code go only to Anthropic — no app-run cloud service. It works the
moment you save the key (no restart). The model is ATS_STUDIO_MODEL. See the
configuration reference.
The flow
Section titled “The flow”- Create from the left rail — Describe with AI (plain English → the LLM writes a complete Nautilus strategy) or Start from scratch (a valid starter template you edit by hand; no LLM key required). Click a saved strategy in the rail to reopen it instead.
- Edit + validate in the Code tab — a syntax-highlighted Python editor with a Validate button (the button turns into Validated on a clean pass; failures list the errors, and Fix with AI can repair generated code from them).
- Save — set the name/key, then save. It’s stored under a
gen:<slug>key and joins the Backtests strategy picker, marked as generated. (Saving again upserts; Duplicate forks an editable copy.) - Backtest it / Run the gauntlet — deep-links into the Backtests builder pre-filled.
- Research in the Copilot tab once saved (see below).
It runs AI-written Python — safely
Section titled “It runs AI-written Python — safely”Generated code is executed, which is a deliberate, sandboxed exception to the rule that web-submitted code is never run. The safety layer (full detail in the security model):
- Static allow-list validation — the source is AST-parsed and rejected unless it imports only
nautilus_trader/math+ the three strategy-discipline helpers;eval/exec/open/__import__,os/sys/subprocess/socket, dunder traversal, and star imports are all refused. No file, network, or system access. - Restricted execution + process isolation — loading runs the validated source with minimal
builtins and a guarded
__import__; a generated strategy’s backtest runs in a spawned, resource-limited subprocess so a bad generation can’t take down the worker or reach the broker. - Not eligible for live — a generated strategy is scoped to backtest + paper, and can’t go live until it clears the gauntlet and you complete the same audited approve-to-live step as any strategy.
It is static validation + least-privilege execution + subprocess limits — sized to a single-user box you own, not a hardened multi-tenant sandbox.
The research copilot
Section titled “The research copilot”Once a strategy is saved and you’ve run a backtest, the copilot (the workspace’s Copilot tab) turns the LLM into an R&D partner. It is a multi-turn chat that reads that strategy’s backtest and gauntlet results — Sharpe, drawdown, buy-and-hold excess, round-trips, rule-test/WFO verdicts — so you can:
- Discuss them (“why does it underperform buy-and-hold in 2022?”).
- Iterate — ask for a change and it proposes revised code; Apply to editor swaps it in, you re-Save and re-run, and the new numbers flow into the next message.
It stays human-in-the-loop: the copilot reads results and writes code, but you launch every run. The conversation is saved per strategy so you can resume the research thread later. (Note: this sends the strategy’s result numbers to your own LLM along with the code.)
Related
Section titled “Related”- The strategy contract — what the generated code conforms to.
- The gauntlet — what you run the result through.
- Ask the docs — a separate assistant that answers general technical questions about the app (this page is part of what it reads).