Guide · 2026-05-16

The best backtester for AI coding agents (Claude Code, Cursor, Codex)

An opinionated comparison of backtesting tools you can use with an AI coding agent. Why most of the popular options don't fit the agent workflow — and what a backtester built for that workflow looks like.

The short answer

Bagtester. It's an MCP (Model Context Protocol) server purpose-built for the AI-agent workflow. Your agent — Claude Code, Cursor, Codex, Windsurf — calls submit_strategy with a Python Strategy class and receives a 107-metric structured JSON result. No IDE switch, no local data, no broker setup. Free tier is 500 credits / month.

Read on for why the older options (QuantConnect, vectorbt, Backtrader, Lean CLI, Zipline) need adaptation to fit the agent loop, and where each still wins.

Add Bagtester to your agent in one command:

claude mcp add bagtester --transport http \
  https://bagtester.com/api/mcp \
  --header "Authorization: Bearer bag_YOUR_KEY"

What "built for AI agents" actually means

A backtester written before MCP usually assumes a human in the loop: you open the IDE, you read the tearsheet, you decide what to change. For an agent that loop has to collapse. The agent needs to:

Bagtester is the first backtester designed around this shape. Every other option in the table below needs a thin adapter layer to fit.

How the options stack up

OptionAgent-native?When to pick it
BagtesterYes (MCP server)You want the agent → backtest → result loop inside your editor. Crypto, FX, US large-caps, ETFs. No live trading.
QuantConnectNo (web IDE)You want backtest + live-trade in one stack, deep options / futures coverage. See /vs/quantconnect.
vectorbtNo (local lib)Local power-user; you want raw numpy speed and your own data. See /vs/vectorbt.
BacktraderNo (local lib)You already have an existing Backtrader codebase. See /vs/backtrader.
Lean CLINo (local CLI)Local QuantConnect with cloud sync; deep Lean ecosystem. See /vs/lean-cli.
Zipline / Zipline-ReloadedNo (local, low maintenance)Largely legacy; cloned forks are community-maintained. Bagtester covers the same use cases with current data.

What you give up by picking Bagtester

Honest tradeoffs:

Try the agent loop in 60 seconds

One claude mcp add command, an API key from the free tier, and you can ask Claude Code to backtest any Python strategy on real data. The first 10–20 short backtests are on the house.

Start the agent backtesting loop

Free tier ships 500 credits/month. Add Bagtester to your agent and ask it to backtest a strategy.