What This Example Shows
- A scheduled engine fired exactly at the release minute (CPI 8:30 AM ET, NFP 8:30 AM ET, FOMC 2:00 PM ET) that parses the print within 5 seconds
- A single hypothesis reasoning agent on
claude-opus-4-8withreasoning_effort: "high"to compute surprise vs. consensus and articulate the regime hypothesis - A
GraphWorkflowthat branches by regime into four asset-class workers — Rates, FX, Equities, Commodities — with diversified models per desk - Function tool schemas for BLS, FRED, consensus, historical reaction tables and live market snapshots. The API returns the tool calls without running them, so your code fetches the data and puts it in the task
- A full sub-60-second end-to-end budget from release timestamp to a Slack-ready trade brief
- Roughly eight dollars per event, ~50 high-stakes events per year — the kind of capability a macro desk pays a strategist $400k for
This pipeline needs a Premium account for two independent reasons:
claude-opus-4-8 is a Premium-only model, and POST /v1/graph-workflow/completions is a Premium-only endpoint. reasoning_effort itself is a plain AgentSpec field available on any tier — it is the model choice and the endpoint that gate this example. See the Reasoning Agents tutorial for the full primer on reasoning-effort tuning, and upgrade your account before running this in production.Why This Matters
The first ninety seconds after a macro print is where the alpha lives. CPI crosses at 8:30:00.000 ET and by 8:30:30 the front-end of the curve has already moved twenty basis points. No human can physically read the release, decompose the surprise versus consensus across headline / core / shelter / services-ex-shelter, model the regime impact across rates / FX / equities / commodities, and route a tradeable thesis to four desks inside that window — and the desks that try are paying a senior strategist mid-six-figures to be wrong half the time on adrenaline. This engine collapses the whole loop into a deterministic, scheduled call: a reasoning agent computes the surprise and the regime hypothesis with deliberate chains of thought, then a graph fans the hypothesis into asset-specific theses in parallel. By the time CPI prints, your Slack already has a regime-tagged FX/rates/equities/commodities trade brief — and you spent eight dollars to get it.The Architecture
job_id, one replayable artifact for the compliance log.
Step 1: Setup
Premium API key, a calendar source for release timestamps, and the standard Python stack.RELEASE_CALENDAR is a list of {"release_id": "CPI", "ts_et": "2026-06-12T08:30:00"} records.
Step 2: Define the Function Tools
Seven tools cover the entire pipeline: four data fetchers, two lookups, one notifier. All in OpenAI function format so any agent in the swarm can return calls to them. The API sends these schemas to the model and returns the model’s tool calls in the output; it does not execute them, and there is no way to feed a tool result back in the middle of a run. Fetch the data the agents need in your own code and put it in the task, and execute the returned calls after the run.Step 3: Define the Hypothesis Reasoning Agent
This is the only place in the pipeline that thinks slowly. Its job is narrow and load-bearing: compute the surprise versus consensus on every relevant sub-component, anchor it in the prevailing regime (hiking/cutting/pause, risk-on/off), and produce a single regime-tagged hypothesis the four downstream desks can branch off.reasoning_effort: "high" is the lever that buys the deliberate chain — the agent will internally consider multiple regime narratives before committing.
reasoning_effort: "high" is the difference between a strategist who blurts out a number and one who sits with the release for ten seconds and says “the headline is hot but services-ex-shelter is decelerating — this is a Fed-friendly miss dressed as a hawkish print.” That second read is what the downstream desks branch on. You do not want that on a fast model.Step 4: Define the Graph Workflow
Four asset-class strategists fan out from the hypothesis, then a synthesizer collapses their theses into a single Slack-ready brief. Model selection per desk is deliberate:max(desk_latency) + synth, not their sum.
Step 5: Schedule Around the Economic Calendar
The scheduler reads a forward calendar of release timestamps and arms a fire-exactly-on-the-minute trigger. The release is parsed within five seconds of the print; the swarm runs and posts to Slack inside thirty.Step 6: Latency Budget
The hard ceiling is the reasoning step — that is where the deliberation budget goes, and the only knob to tighten it further is dropping
reasoning_effort to "medium" (~6s) at the cost of regime hypothesis quality. For CPI and FOMC, do not drop it. For lower-stakes prints (Empire Manufacturing, consumer confidence) the medium setting is fine.
Real Cost vs. Macro Desk
The math is the giveaway. A single macro strategist costs roughly a thousand times what this engine costs to run for the same ~50 events per year. The strategist still has the job — but their work is now reviewing the engine’s brief and overriding it on judgement calls, instead of trying to compute four asset reactions from scratch in 90 seconds. That is the right division of labor.
Next Steps
- Reasoning Agents for Hard Analytical Problems — the full primer on
reasoning_effort,self-consistency, and when each shape is the right one - Build an AI Hedge Fund Research Pipeline — the slower, scheduled overnight cousin of this engine for the watchlist
- Graph Workflows for Production Pipelines — the production DAG patterns this engine is built on (fan-out, fan-in, retries, conditional gating)