Alpaca AI Trading Agents Hackathon

Devil's
Advocate

An AI trading agent that argues with itself before it trades. One AI role proposes. An adversarial role challenges. Code decides the final action.
Built with Alpaca · Python · LLM agents · GitHub Actions
Decision path
Market + portfolio statecontext
Candidate filtercode
ProposerAI
AdversaryAI
One revisionAI
Deterministic risk gatecode
Execute or No Tradefinal
How it works

Reasoning is flexible. Authority is not.

The AI can explore ideas and challenge itself. Deterministic code decides whether anything is actually allowed to happen.

01

Propose

The proposer role selects a trade from a filtered set of eligible options contracts.

02

Challenge

A second model attacks the reasoning, scores severity, and can trigger one revision.

03

Control

Hard rules check position size, collateral, exposure, daily limits, and fresh broker state before execution.

Proof it works

The interesting part is what the system refuses to do.

The project is built to preserve useful model reasoning without giving the model unlimited authority.

Deterministic intervention
4 contracts proposed
→ 2 contracts approved

The models did not fix the sizing issue themselves. The deterministic gate did. It generated a safer substitute and re-checked the trade before execution.

Stand down
0 eligible

No proposal reached the model. The system chose no trade.

Gate tests
28 / 28

Latest deterministic enforcement suite passing.

Core idea

Models make judgments. Code controls authority.

That boundary is the product.

“A bad model decision should not automatically become a bad action.”