Multi-Armed Bandit Testing for Email Subject Lines
A multi-armed bandit email subject test keeps sending across variants while continuously routing more traffic to the best performer. Instead of waiting for a fixed A/B test to finish, you let early signal compound. marginal exposes this as MCP tools so an AI agent can run the whole loop.
Bandit vs. classic A/B subject line testing
A standard subject line A/B test splits your audience evenly, waits for significance, then picks a winner. The cost is exploration: half your sends keep going to the losing variant until the test concludes. A multi-armed bandit reduces that regret by reallocating sends toward variants that show stronger open and click rates as data arrives.
For email specifically, this matters because most lift comes from the subject line, and sends are finite. Spending fewer impressions on weak variants means more of your list sees the line that actually converts.
- A/B test: fixed split, decide at the end — simple but wasteful.
- Bandit: adaptive split, exploit early winners while still exploring.
- Best when you care about total opens/clicks across the whole send, not just the final verdict.
Running it through marginal's email MCP server
marginal is a hosted email MCP server. Your AI agent connects over MCP and calls a small set of tools to generate, launch, and evaluate subject line experiments. Because it's hosted at https://marginal.sh/mcp, there's no self-hosted infrastructure to operate — you authenticate with a Bearer API key and start testing.
The four MCP tools map cleanly onto the bandit loop: draft candidate subjects, send, measure, and decide what to send next.
- generate_variants — produce several subject line candidates to seed the test.
- launch_test — send variants and begin open/click tracking.
- get_results — read within-test lift metrics as data accumulates.
- recommend_next — get the next best variant to favor for remaining sends.
A practical bandit workflow with an AI agent
AI agent email marketing works well here because the loop is repetitive and data-driven. The agent generates subject candidates, launches the test on a slice of your list, polls results, then leans into the leading variant for the rest of the send — exactly the explore-then-exploit behavior a bandit prescribes.
A typical sequence inside Cursor, Claude Desktop, or Claude Code looks like this:
- Ask the agent to draft 3–5 subject variants for the campaign.
- Launch the test against an initial audience segment.
- Pull open and click lift after the first wave of sends.
- Send the rest of the list weighted toward the top performer.
- Log the winning line so future generations learn from it.
Getting started and what's included
marginal works with the MCP clients you already use — Cursor, OpenAI Codex, Claude Desktop, Claude Code, Windsurf, Cline, Continue, and Zed. The free tier covers 100 experiments per month, which is enough to validate a multi-armed bandit email subject workflow before scaling up.
Read the tool reference and connection details in the docs at https://marginal.sh/docs/ to wire your agent to the endpoint and run your first adaptive subject test.
- Hosted endpoint: https://marginal.sh/mcp
- Auth: Bearer API key (marg_live_...)
- Includes managed sends and open/click tracking out of the box.
- Free tier: 100 experiments/month.
Get started with marginal
marginal is a hosted email marketing MCP server at marginal.sh. Sign up free, create an API key, and connect https://marginal.sh/mcp from Cursor, Codex, or Claude Desktop.
- 100 experiments/month on the free tier
- Four MCP tools: generate_variants, launch_test, get_results, recommend_next
- Listed in the MCP Registry as sh.marginal/mcp