nyami.fr

/ en / work / alphapilot

AlphaPilot — Autonomous trading stack

18 AI agents + a deterministic Risk Engine — paper validation before real capital

→ Business impact: Split architecture agents / risk engine — hard kill switch · paper validation before real capital.

Client
Personal project — in development
Role
Architect & lead engineer
Period
2025 → today
Status
paper-trading

Context

AlphaPilot is an autonomous trading stack: a multi-agent architecture that mirrors the structure of a trading desk — analysts, risk management, execution, oversight — but driven by LLMs and deterministic rules instead of humans.

V1 runs in paper-trading (simulated orders, no real capital). The point of the project isn’t to promise returns: it’s to prove that an agentic system can decide and execute under strict risk constraints, in an auditable, reproducible way.

Technical challenge

Agentic systems are probabilistic; a trading desk can’t be, not on the risk side. The core challenge: let the agents reason freely while keeping execution and guardrails 100 % deterministic and testable.

  • Stop a hallucinating agent from placing an out-of-bounds order.
  • Guarantee an instant emergency stop that overrides any decision.
  • Make every decision traceable — which agent, which signal, which constraint.

Solution

A clean split between the reasoning layer (LLM agents, non-deterministic) and the execution + risk layer (deterministic, fully tested code). No order clears the Risk Engine without validation.

  Market data ─▶ Analyst agents (LangGraph) ─▶ signals

                            ┌──────────────────────▼──────────────────────┐
                            │  RISK ENGINE  (deterministic, 95 % coverage) │
                            │  limits · exposure · drawdown · veto         │
                            └──────────────────────┬──────────────────────┘
                                                   │  (approved only)
                        KILL SWITCH ◀──────────────┤

                                         Execution + audit log
  • 18 specialized agents orchestrated as a graph (LangGraph), shared state.
  • Deterministic Risk Engine: exposure limits, drawdown, position sizing — pure code, 95 % covered, able to veto any agent.
  • Priority Kill Switch: cuts all execution in a single call, regardless of agent state.
  • 608 tests (unit + integration) on the risk and execution logic.
  • Unified broker contract: BrokerAdapter port + on_fill hook + .fills history. Alpaca paper-broker in sandbox; PaperBroker fallback for offline tests and the CLI demo.

Outcome

  • v1.5.0 shipped — full pipeline from data → decision → paper execution → audit.
  • 608 tests, 95 % coverage on the critical paths.
  • Kill switch and Risk Engine verified: no order slips past the limits.
  • Next.js dashboard to watch decisions and simulated P&L in real time.

Learnings & trade-offs

  • The deterministic boundary is the product. The value isn’t in “smart” agents — it’s in the tested barrier that contains them.
  • Paper-trading first, and owned as such: no inflated backtest passed off as real.
  • Roadmap V2→V4: Redis + LLM agents; ephemeral agents + self-improvement; Fund Mode with real capital after review.

Limits — said publicly

  • · Paper-trading only — no real capital at stake in V1.
  • · Alpaca sandbox broker only; the unified broker contract is wired but the real-capital review lands in V4.
  • · No per-strategy performance attribution yet — V2.