Agent architecture

Anatomy of an Autonomous Trading Agent

Projects like MAHORAGA run LLM-powered trading loops 24/7 on serverless platforms such as Cloudflare Workers. Strip away the hype and you find a clean, teachable pipeline: signals in, judgment in the middle, guarded execution out. Here is how that loop works — and where it breaks.

The Loop in Three Dimensions

Pulses are social signals flowing around the pipeline. Green pulses survive each gate; pink ones get rejected. Drag to rotate. Tighten the confidence threshold and watch throughput — and the simulated stats — change.

Drag to rotate accepted signal
rejected signal
Trades executed / day
Rejection rate
Est. daily fees @ 0.1%
Worst-case daily loss

Five Stations, One Cycle

STAGE 1

Signal ingestion

Streams of posts, prices and volume arrive via webhooks and scheduled fetches. Serverless cron triggers replace the "laptop that must never sleep."

STAGE 2

Sentiment scoring

An LLM classifies each batch: bullish/bearish, confidence, novelty. Crucially, it also detects sarcasm, bots and recycled rumors — the noise that keyword systems swallow whole.

STAGE 3

Strategy decision

Scores meet rules: only act above a confidence threshold, only on liquid assets, only within budget. This is where the slider above lives in real systems.

STAGE 4

Risk gate

Hard-coded, non-LLM checks: max position size, max daily loss, cooldowns, kill switch. The one stage that should never be "intelligent" — it must be boringly deterministic.

STAGE 5

Execution & ledger

Orders go to an exchange API; every decision and outcome is logged. The ledger feeds evaluation: without it you cannot tell luck from skill.

Why Serverless Instead of Your Laptop

Uptime is alpha

Sentiment moves at 3 a.m. A Workers cron fires every minute globally; a laptop loses Wi-Fi, sleeps, or updates itself at the worst moment.

Cost scales with events, not hours

Serverless bills per invocation. A bot that evaluates 400 signals/day uses seconds of compute — pennies, versus a $20+/month idle VPS.

State needs care

Workers are stateless; positions and cooldowns must live in durable storage (KV, D1, Durable Objects). Designing that state model is 80% of the real engineering.

Worked example

400 signals/day at a 70% confidence bar with a base 15% pass rate ≈ 18 trades. At $250/trade and 0.1% taker fees, that is $4.50/day in fees — your strategy must clear ~1.8% monthly just to pay the exchange. Fees quietly decide which strategies can exist.

The Part the Threads Skip

Most sentiment bots lose money. Social signals are crowded, latency-sensitive and adversarial — accounts exist specifically to bait bots into pumps. LLMs add judgment but also new failure modes: prompt drift, hallucinated tickers, stale context.

Treat projects like this as what the builders say they are: a learning harness for the full loop — paper-trade it, log everything, and study your own decision quality. Never connect real funds you cannot afford to lose, and remember nothing here is financial advice.

Enjoy this tool? Build your own with Super