How to Send a Split Test Email from an AI Agent
This how-to guide walks through sending a split test email from an AI agent end to end — generating subject line variants, launching the test, and reading the lift. Everything runs through marginal, the hosted email MCP server, so your agent calls a few tools instead of wiring up send infrastructure.
Before you start
To send a split test email from an AI agent you need marginal connected as an MCP server in your client of choice — Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, Zed, or OpenAI Codex. marginal is hosted, so there's nothing to deploy; you just point your client at the endpoint and authenticate.
- Endpoint: https://marginal.sh/mcp
- Auth: a Bearer API key in the form marg_live_...
- A recipient list and the email body you want to test
- Free tier covers 100 experiments/month for trying this out
Step 1 — Generate subject line variants
Start by asking your agent to call generate_variants with the core message of your email. This produces candidate subject lines for the subject line A/B test. You can prompt for a specific angle — urgency, curiosity, plain-spoken — and the agent will return several options to choose between.
A typical instruction to the agent: "Generate three subject line variants for our spring restock announcement, keeping them under 50 characters." Review the output and trim it to the two or three you actually want to compete.
- Tool: generate_variants
- Feed it the email's purpose and tone
- Keep variants meaningfully different so results are interpretable
Step 2 — Launch the split test
Once you've picked your variants, have the agent call launch_test with the subject lines, the email body, and the recipient list. marginal handles the managed send and splits delivery across the variants automatically. This is the moment you actually send a split test email from an AI agent — no separate ESP credentials required, since the send is managed for you.
marginal tracks opens and clicks per variant from this point forward, which is what powers the within-test lift metrics in the next step.
- Tool: launch_test
- Provide subject variants, body content, and audience
- Sends are managed by marginal with open/click tracking built in
Step 3 — Read results and decide what's next
After the test has run, ask the agent to call get_results to pull open rates, click rates, and within-test lift for each subject line. Then call recommend_next to get a suggested follow-up — for example, sending the winning subject to the remaining audience or designing the next subject line A/B test.
This closes the loop on AI agent email marketing: your agent generated the variants, launched the send, measured the lift, and proposed the next move, all inside one conversation. For deeper details on each tool, see the marginal MCP tutorial and reference at https://marginal.sh/docs/, or connect the server from https://marginal.sh/mcp.
- get_results — open/click metrics and within-test lift per variant
- recommend_next — suggested follow-up action based on the winner
- Repeat to keep iterating subject lines over time
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