Mental Model
Ed DonnerFive layers for the Trading Floor wake loop — Schedule through Observe — plus which Anthropic workflows the peer Traders use.
Scheduler · OpenAI Agents SDK · MCP · SQLite · Gradio
Overview
The desk is easiest to hold as five layers. AI sits in Research and Trade; Schedule, Brief, and Observe are timer, context load, and UI/infra. Anthropic names from Building effective agents (PDF).
Applied workflows
- Parallelization. Traders Warren, George, Ray, and Cathie run in the same tick via
asyncio.gather— independent peers, no supervisor handoff. - Orchestrator-Worker. Each trader owns the decision; a nested Researcher tool scrapes Brave/Fetch (and memory) and returns a brief — it does not place trades.
- Not used here (yet). Routing, Prompt Chaining, Evaluator-Optimizer.
Layers
- 1 Schedule. Floor checks
is_market_open()(unless override), then wakes all four traders. - 2 Brief. Each trader loads strategy and account resources, then builds a trade or rebalance message.
- 3 Research. Nested Researcher plans searches, hits Brave/Fetch, may write libsql memory, returns a brief.
- 4 Trade. Trader looks up prices (local market MCP or Polygon), then
buy_shares/sell_sharesor rebalance /change_strategyon accounts. - 5 Observe. Push via Pushover;
LogTracerwrites traces; Gradio polls SQLite for board, P&L, and logs.
Layer map
Layer stack for one scheduled tick. Diagram key: ✦ AI agent · second line = Anthropic workflow · purple = actor · white = service.
---
config:
theme: default
themeVariables:
background: "#ffffff"
fontSize: "14px"
---
flowchart TB
person[Person]
schedule["1 Schedule
wake when open"]
brief["2 Brief
strategy and account"]
research["✦ 3 Research
Orchestrator-Worker"]
trade["✦ 4 Trade
Parallelization"]
observe["5 Observe
push logs dashboard"]
schedule --> brief --> research --> trade --> observe
person -->|watch board| observe
classDef agent fill:#e8f0ee,stroke:#0f3d36,stroke-width:2px,color:#0d0d0d
classDef service fill:#fafaf8,stroke:#c8c8c2,stroke-width:1px,color:#0d0d0d
classDef actor fill:#f3eef8,stroke:#6b4f9a,stroke-width:2px,color:#0d0d0d
class research,trade agent
class schedule,brief,observe service
class person actor
Read layers top to bottom; drill into Traders for MCP belts and trade vs rebalance.