Skip to main content

What This Example Shows

  • A GraphWorkflow shaped as fan-out → fan-in: thousands of per-fund parser nodes run in parallel, then converge into a cross-fund aggregator and a Theme Synthesizer
  • How to parse raw SEC EDGAR 13F-HR filings (CIK + accession number) into structured holdings, then diff against the prior quarter
  • The batch volume math for the quarterly burst: ~5,000 filings dropping in 48 hours, dispatched concurrently against /v1/graph-workflow/completions
  • Model diversification across the DAG: gpt-4.1-mini for mechanical parsing, gpt-4.1 for aggregation, claude-sonnet-5 for the synthesis layer
  • Journalist-grade output: ranked sector adds/cuts, new positions crossing $100M of cumulative flow, eliminated positions, and named emerging themes with the funds driving them
  • A reusable pattern for any high-volume regulatory-filing burst (Form 4, N-PORT, NPX)
This tutorial leans on the graph workflow endpoint (/v1/graph-workflow/completions), dispatched concurrently across the filing list for the burst — a premium-only endpoint (Pro, Ultra, Premium). Note that the API’s night-mode discount (see Night-Mode Pricing Strategy) applies only to /v1/swarm/completions and /v1/swarm/batch/completions — it does not apply to /v1/graph-workflow/completions, so running this burst overnight does not itself lower the bill. The reasons to fire it overnight here are operational: EDGAR’s after-hours filing pattern and your own concurrency/rate-limit headroom, not a pricing discount.

Why This Matters

Form 13F-HR filings publish on a 45-day lag — every institutional manager with over $100M AUM has to disclose their long US-equity positions within 45 days of quarter-end, and almost all of them file in the same 48-hour window right at the deadline. ~5,000 filings hit EDGAR essentially simultaneously, and that window is when the entire allocator and newsroom ecosystem scrambles: Bloomberg, the FT, Institutional Investor, fund-of-funds managers, sell-side strategists, and signal traders are all racing to surface “what did the smart money buy” before the next morning’s open. The traditional shape of that work is a junior analyst manually pulling a handful of “name brand” 13Fs (Pershing Square, Tiger, Coatue, Berkshire) and writing one-off blurbs — leaving 4,990 filings unread and the cross-fund themes invisible. A GraphWorkflow turns the firehose into a structured story automatically: every filing parsed, every position diffed, every theme ranked by cumulative dollar flow across all reporting managers. By 7am Pacific on day 2 of the window, you have a brief that took a newsroom team two weeks the old way.

The Architecture

Per-fund parsing happens in parallel inside each filing’s own GraphWorkflow. The batch dispatcher fans the workload out across the 5,000 filings. The synthesis is the cross-cutting layer that runs once across the batched outputs.

Step 1: Setup

Step 2: Define the Function Tools

Every tool the parser and aggregator nodes use is declared as an OpenAI-style function tool. The model calls them, the runtime resolves them on your side.

Step 3: Define the Graph Workflow Nodes

The shape is fan-out → fan-in. Each per-fund parser is a node that fetches the filing, parses the holdings table, looks up the fund profile, and diffs against the prior quarter. Multiple parsers run in parallel inside one GraphWorkflow when a filing covers multiple sub-funds under one umbrella manager. They converge into a Cross-Fund Aggregator, which feeds the Theme Synthesizer. Models are diversified across the DAG by the cognitive load of each node:
  • Per-fund parsers → gpt-4.1-mini — cheap, fast, mechanical. Most of the work is tool calling against structured XML.
  • Cross-fund aggregator → gpt-4.1 — needs to reason over many per-fund summaries and group them coherently.
  • Theme synthesizer → claude-sonnet-5 — produces the journalist-grade narrative the brief is built around.

Step 4: Run One Fund’s 13F

Smoke-test the shape against a single filing before you fire the burst. Pershing Square’s umbrella files include the main fund plus the SPARC vehicle, which makes for a clean multi-parser fan-in.
The ThemeSynthesizer output for a single filing is just that one manager’s contribution to the cross-fund picture. The real value emerges when you batch it across the full 5,000-fund universe in Step 5 — at that point the aggregator sees the entire flow and the themes pop.

Step 5: The Quarterly Burst — 5,000 Funds in One Night

Production shape: you have a feed (EDGAR’s RSS or a vendor like SEC-API.io) emitting accession numbers as they hit the system. You buffer them across the 48-hour deadline window, then fire one batch at 11pm Pacific on day 1 of the burst.
The math. A single 5-node GraphWorkflow per filing — three lean parsers on gpt-4.1-mini, one aggregator on gpt-4.1, one synthesizer on claude-sonnet-5 — comes out to roughly $0.04 per filing. Across the full quarterly burst: A takeout dinner gets you the entire quarter’s 13F coverage. Run four times a year and your annual budget for the program is roughly $800 in API cost.
/v1/graph-workflow/completions token costs do not get the night-mode discount (that applies only to /v1/swarm/completions and /v1/swarm/batch/completions — see Night-Mode Pricing Strategy). Firing the burst overnight is still worth doing here to stay clear of daytime rate-limit and concurrency contention on other production workloads — see Rate Limits if you need to chunk a larger batch across multiple windows.

Step 6: The Theme Synthesizer Output

A representative ThemeSynthesizer output for the cross-fund aggregate. This is the artifact your DB, Slack channel, and morning newsletter pull from.
The Slack post fires automatically via the post_theme_brief_to_slack tool. The structured per-manager output also writes to a Postgres table so the desk can query “every fund that added NVDA this quarter, ranked by dollar size.”

Real Cost vs. Newsroom 13F Team

The swarm isn’t replacing the senior editor — it’s replacing the two weeks of mechanical 13F-pulling that buries them. The editor now lands at their desk on day 2 of the window with the entire universe of 4,983 filings already parsed, diffed, and themed. Their job becomes choosing which three themes to lead with — the work that actually requires judgement.

Next Steps