AlphaAirlock: A Multi-Agent Pipeline That Vets Its Own Trading Ideas Before They Touch a Backtest

· Source: Machine Learning on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering, FinTech & Digital Financial Services · Depth: Intermediate, short

Summary

AlphaAirlock is an open-source, multi-agent pipeline designed to convert unstructured market commentary into sandbox-backtested, risk-vetted trading strategies for crypto perpetuals and US equities. This system employs a five-stage LLM agent pipeline—Intake, Researcher, Coder, Backtester, and Critic—driven by an explicit state machine. Key guardrails include an AST-whitelisted sandbox for generated factor code, blocking "os", "sys", "subprocess" at the bytecode level, and an 8-second watchdog. It prevents look-ahead bias at both the factor and backtester layers, running against a bundled 2-year synthetic hourly BTC perpetual dataset (17,520 bars) with a 0.07%-per-side cost model. The Critic agent enforces hard numeric thresholds like Sharpe ratio and max drawdown, overriding LLM self-assessments. Live trading is disabled by default, ensuring a fail-closed system. The backend uses FastAPI (Python 3.11+), SQLAlchemy, and SQLite, with a Next.js frontend, and supports LLM routing via Anthropic Claude, OpenRouter, or MiniMax.

Key takeaway

For AI Engineers or MLOps Engineers building agentic systems for high-stakes domains like finance, you should prioritize robust guardrails and adversarial review. This architecture demonstrates how to prevent common failure modes, such as unreviewed code execution or look-ahead bias in simulations, by implementing explicit state machines, sandboxing, and a critical review agent with veto power. Consider adopting a fail-closed default and multi-layered validation to enhance system trustworthiness and mitigate risks.

Key insights

A multi-agent LLM pipeline can rigorously vet trading strategies through sandboxing, adversarial review, and explicit guardrails.

Principles

Method

The pipeline processes market commentary through Intake, Researcher, Coder, Backtester, and Critic agents, using a one-retry loop and an explicit state machine to approve or reject strategies.

In practice

Topics

Code references

Best for: AI Engineer, MLOps Engineer, AI Architect

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Machine Learning on Medium.