What This Example Shows
- A
HierarchicalSwarmwhose built-in director hands orders to four workers — a Research Director plus Rating Tracker, Price Target Tracker, and Key Driver Extractor — running in parallel against a single PDF note - OpenAI-format function tool schemas for PDF parsing, ratings/target regex extraction, consensus lookup, and Slack delivery, returned as tool calls that your code executes (the API doesn’t run them)
- A mixed-provider agent team: Claude Sonnet 4.5 directing, GPT-4.1 / GPT-4.1-mini for surgical extraction, Gemini 2.5 Pro for long-document grounding
- A consensus-check step that flags every new target as above, in line with, or below the street
- End-of-day batch processing across 150+ notes via
/v1/swarm/batch/completions, scheduled at 4:30pm ET, output is a ranked delta sheet - The structured signal payload your OMS, EMS, or research database actually wants — not free-form text
This pipeline processes a high volume of PDF documents per day.
/v1/swarm/batch/completions (Step 5) is a premium-only endpoint (Pro, Ultra, Premium): a free-tier key gets 403 on it. That, not the rate limit, is what blocks the Free tier here — 150 notes is well under the Free tier’s 1,200 completions per day, and a swarm batch counts as one completion however many swarms it holds. Every paid plan has the same limits. Read the Cost Optimization Playbook before turning the cron on, and upgrade at https://swarms.world/platform/account.Why This Matters
Every PM in the firm wakes up to a ranked sheet of rating + target deltas — already cross-referenced against consensus — for the price of one Bloomberg lunch. A multi-strategy PM gets roughly 150 sell-side notes hitting their inbox between 5am and 9am ET on any given trading day. Reading every page is physically impossible and almost entirely a waste — 95% of any sell-side note is restated boilerplate and an unchanged thesis. The actionable content is in the deltas: a Goldman analyst going from Buy to Hold, JPM lifting their target by 18%, Morgan Stanley swapping in a new bear case on China data center demand. Those three things move books. This pipeline does nothing except find those deltas, score them against street consensus, and put a structured signal in front of the PM before the bell.The Architecture
Step 1: Setup
Install dependencies and configure credentials. The pipeline needs your Swarms API key plus either IMAP credentials for an inbox sweep or an S3 bucket where your prime broker drops PDFs.Step 2: Define the Function Tools
Every worker agent gets the tools it actually needs — nothing more. Tools are OpenAI-format function schemas. 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 Four Agents
The Research Director is the agent that emits the final signal payload. The three workers each get exactly the tools their job requires.The model mix is deliberate. Rating extraction is a small classification problem —
gpt-4.1-mini is plenty and roughly 5x cheaper. Target extraction needs careful number handling — gpt-4.1 earns its keep. Driver extraction is the only step that reads the full multi-page document end to end, and Gemini 2.5 Pro is empirically the strongest on long-document grounding. The Research Director uses Claude Sonnet 4.5 because structured output + tool calling is what it was built for.Step 4: Process One Note End-to-End
Start with a single note. This is the loop you scale.Step 5: End-of-Day Batch Across All Notes
The real value shows up when you sweep the entire inbox in one shot. Build a payload list keyed by the day’s PDF drops and hand the whole thing to/v1/swarm/batch/completions.
Schedule this script as a cron job for 4:30pm ET on weekdays. The post-close window means every note that hit the inbox during regular trading hours is captured, the consensus service has finished its end-of-day refresh, and the PM sees the ranked delta sheet on Slack before they leave the desk — not in their pre-market inbox the next morning.
Step 6: The Output Schema
The Research Director is constrained to emit signals in this exact shape. This is the contract your OMS, EMS, research database, and PM Slack channel all consume.audit_trail block is what makes this defensible in a compliance review — every field in the signal traces back to a specific worker output, which traces back to a specific line in the PDF.
Real Cost vs. Junior Analyst Reading Notes
The swarm is not reading notes for fun — it is producing a structured, ranked signal sheet that ties every delta back to the underlying quote. Your humans stop being PDF janitors and start spending their time on the names where the signal is actually interesting.
Next Steps
- Build an AI Hedge Fund Research Pipeline — the upstream watchlist research note that the signal sheet feeds into
- SEC Filing Triage Pipeline — same pattern applied to 10-K/10-Q/8-K dumps from EDGAR
- Earnings Call Analysis Swarm — extend the pipeline to live transcript ingestion during earnings season