I built a trading agent that had to earn its own bet size. It didn't place.

Carson Rodrigues

Carson Rodrigues / November 21, 2026

6 min read • ––– views

hackathonsai-agentstrading
The Underwrite dashboard: equity of $99,696.50, 10 of 10 claims confirmed, 0 silent failures, and a table comparing what the agent said with what the account showed

An AI that trades money can fail in a quiet way: it says an order went through, and the account says otherwise.

HackathonAlpaca AI Trading Agents Hackathon
Organiserlablab.ai, with Alpaca
WhenSubmitted 4 September 2026, about 15 minutes before the 20:30 IST close (my sources don't give the start date)
FieldNot published in my sources
Result and rankNot among the winners or finalists, so no rank. 1st Autobelay (RazorsEdge), 2nd Should-AI Buy?, 3rd Killswitch Capital
Built inNot recorded; the code history covers 3 to 4 September
TeamSolo
Money spentNot tracked. The trading account was a free practice account with fake money. I did not record what the AI model calls cost
Codegithub.com/rodriguescarson/underwrite

That was the worry behind Underwrite, my entry for the Alpaca AI Trading Agents Hackathon on lablab.ai. Alpaca is a broker with an API for trading. The hackathon asked for agents that trade through Alpaca's tools, either its MCP server (a standard plug that lets an AI call outside tools) or its command line program. I submitted on 4 September 2026, about fifteen minutes before the deadline.

Everything I did was paper trading. That means a practice account with fake money, so no real money was ever at risk. This post is not investment advice.

What I built

Underwrite is an options desk with several parts that don't trust each other.

A strategist, an AI model, looks at one stock at a time and proposes one trade. It can only read market data. In practice every trade was a bull put spread, which is a bet that a stock stays above a certain price, where the most you can lose is fixed in advance.

Next comes a gate, which is plain code with no AI in it. It gets its own prices, works out the worst-case loss itself, and rejects anything too big, too thinly traded, or outside the rules I set. In session two, a second AI model also had to agree with each trade, and it vetoed several.

An executor then places the order through Alpaca's MCP server. Whatever the server says back is recorded as a claim, not a fact.

Last, an auditor asks Alpaca's command line program, which is a separate tool, what the account really holds. If a claim doesn't match, that is a silent failure, and the desk drops to its smallest bet size.

That last part is the idea. The agent starts with a tiny budget per trade, 0.25% of the account. It only moves up to 1% after it has predicted ten trades' outcomes well, with the numbers to prove it. Size is earned, not asked for.

Diagram of Underwrite: a strategist AI proposes a trade, a second AI model must agree, a plain-code gate checks the risk, an executor places the order through Alpaca's MCP server, an auditor checks the account through Alpaca's command line program, and bet size stays small until predictions are proven

How I tested it

The gate has fixed rules, and I wrote tests for them: 10 automated tests covering the gate, the calibration maths and the check of orders against the account. None of them use an AI model. I also had a rehearsal mode that runs a full cycle without placing an order.

The live sessions were the real test. The gate refused one trade in writing: an Apple trade where the open interest (how many contracts exist, a sign of how easy it is to trade) was 77 and 70 against a minimum of 100. In session two, the second AI model vetoed several trades, for reasons like "too far from expiry" and "too thinly traded."

The pass mark for earning a bigger bet is set in the code: at least ten finished trades, a calibration error of 0.15 or less, a Brier score of 0.25 or less (both measure how well stated odds match results), and 99% of claims confirmed.

What I measured: all 10 orders were matched against the account, with zero mismatches. What I did not measure: whether the agent's odds were any good, because no trade had finished. There was no control either, such as a random trader to compare against.

Research

Primary research. Everything first-hand came from two live paper sessions on 3 and 4 September, on a fresh $100,000 practice account. My notes record no interviews with traders.

Secondary research. I read Alpaca's documentation for its MCP server and its command line program, since the hackathon was built around them. The scoring maths is the standard Brier score and calibration error, and I reused the metric code from my earlier Attest Fleet project. My notes record no study of other entries or past winners for this one.

What happened

I ran two sessions over 3 and 4 September. Ten orders went through the MCP server, and the command line audit matched all ten, with zero silent failures. The practice account went from $100,000 to $99,696.50 on paper, from the open trades.

But no trade had finished by the deadline. So the desk stayed at the smallest size the whole time, and the part of the idea about earning your bet never got tested. That is the honest summary.

The field size wasn't published where I looked, so I can't give a rank. Underwrite was not among the winners or finalists. First place went to Autobelay (RazorsEdge), second to Should-AI Buy?, and third to Killswitch Capital. lablab sent me a participation certificate.

What I learned

The first live session found a bug. My check on how many trades were open only counted filled orders. So it accepted a second Tesla trade while the first was still waiting to fill. The auditor caught it and flagged it, and I fixed the check to count waiting orders too. A rule that looks right on paper is not the same as a rule that's been through the market.

I also set the limits too tight at first. With the smallest bet size and four trades allowed, 98.5% of the account was sitting idle after session one. I raised the cap to six.

And I lost time to a plain mistake. I started the trading loop before the market opened, and it quit the moment it saw the market was closed. I now use a rehearsal mode for tests, and I never start the real loop before the open.

One more thing went wrong. Midway through the first session, my Gemini key ran out of quota. I rerouted the strategist to another model without stopping. Free quotas run out exactly when you need them.

The big lesson is about the idea, not the code. A week is too short to show whether an agent can predict its own outcomes, because trades need time to resolve. I built a test that couldn't pass in the time I had. Next time I would pick a claim that can be proved inside the window.

Links

Available · London / UK · senior AI, AI FDE, contract

Building something with AI?

Voice agents, MCP servers, LLM pipelines, agentic workflows — pick a slot, drop a message, or send your email and I'll reply within a day.

or leave your email

Replies within ~24 hours · London, UK · on-site, hybrid or remote