[ Case Study · AI System ]
Four analysts that finish before the coffee brews
01[ Context ]
Smart Money Nigeria serves a professional investor community that depends on timely, accurate market intelligence. I designed and built an end-to-end AI-powered pipeline that runs four specialist agents in parallel, synthesises their outputs into a structured financial intelligence report, and delivers it across three channels automatically every morning, in under 5 minutes.
02[ Business Problem ]
The existing process was entirely manual: a researcher would spend several hours searching, reading, and writing a report before it reached the audience. The approach did not scale, coverage was inconsistent, and there was no way to verify what had been analysed or when.
- 4 to 6 hours per report with linear scaling cost as the audience grew
- Inconsistent quality and coverage gaps across research dimensions
- No audit trail for what data was sourced or when each report ran
- Manual process blocked same-day delivery of time-sensitive market intelligence
03[ Constraints ]
- Morning delivery, every dayThe report has to be in inboxes by early morning Lagos time, which rules out anything that needs a human in the loop between trigger and delivery.
- Autonomous means accountableA pipeline with nobody watching needs its own referee: a quality gate on every report, an admin alert channel for failures, and an error log with the run's full context.
- Consistency is the productThe value over the manual process is that every report covers the same four dimensions in the same structure. Free-form generation was not acceptable; every agent had to return structured JSON.
- Idempotent runsEach run carries its own run_id, topic, and report_date so reruns and failures never produce ambiguous or duplicated output in the archive.
04[ Stakeholders ]
Three audiences shaped the design: the Smart Money Nigeria team, whose researcher hours the system replaces; the subscriber community, who receive the full HTML report by email and a 1,000-character summary on Telegram; and the admin, who only hears from the system when something fails, via Telegram alert backed by the Airtable error log.
05[ Research ]
The design started by decomposing what the human researcher actually did across those 4 to 6 hours. The work separated cleanly into four independent dimensions, each with its own sources and freshness window: market trends and competitor activity over 30 days, news sentiment over 7, and the macro and regulatory picture over 30. That decomposition is the system's core insight; the four dimensions became four specialist agents.
Trend Agent
Google News via Serper, last 30 days
Top 3 market trends, growth statistics, risk flags
Competitor Agent
Serper web search, last 30 days
Key players, strategic moves, new entrants, moats and weaknesses
Sentiment Agent
Serper News API, last 7 days
BULLISH/NEUTRAL/BEARISH verdict with a 0-100 confidence score and narrative summary
Macro Agent
Serper web search, last 30 days
CBN/regulatory updates, economic indicators (MPR, CPI, FX), investment climate score 0-10
06[ Strategy ]
An orchestrator-worker architecture with the right model in each seat. Claude Sonnet handles the two jobs that need judgment: decomposing the research topic into four non-overlapping search queries at the start, and synthesising four structured JSON payloads into a coherent analyst report at the end. The four Gemini analyst agents handle the parallel middle, each processing its own search results into structured output with a confidence score.
Everything between the models is deterministic n8n: fan-out, merge, validation with fallbacks, the quality gate, and three-channel delivery. The agents never talk to each other; they only talk to the pipeline.
07[ Options Considered ]
- option 01One big promptA single LLM call asked to research and write everything. Simplest to build, but coverage becomes whatever the model happens to attend to that day, exactly the inconsistency the manual process already suffered from.
- option 02A sequential agent chainTrend feeds competitor feeds sentiment feeds macro. Errors compound down the chain, the run time is the sum of all stages, and one slow or failed step delays the entire morning report.
- option 03Parallel specialists behind an orchestratorThe chosen path. Four independent agents fire simultaneously against their own scoped searches, a merge waits for all of them, and one writer synthesises. Coverage is structural, speed is the slowest single agent, and a weak result in one dimension cannot contaminate the others.
08[ Trade-offs ]
- Two model providers over oneClaude for judgment, Gemini for parallel analysis means two APIs, two failure modes, and two bills. The payoff is fitting cost and capability to each role instead of paying flagship rates for fan-out work.
- Structured contracts over expressive freedomForcing every agent into a JSON schema with confidence scores costs some nuance an essay-style answer might carry. In exchange, the merge step, the fallbacks, and the report writer all operate on predictable inputs, which is what makes the pipeline debuggable.
- A blunt quality gate over no gateThe 2,000-character minimum is a crude proxy for report quality, and deliberately so: it is cheap, deterministic, and catches the catastrophic failure mode (an empty or truncated report) while alerting a human for everything subtler.
09[ The Daily Run ]
The pipeline executes as ten n8n nodes, end to end without human touch:
- Step 1Trigger fires at 7AM Africa/Lagos on a daily schedule
- Step 2Set Defaults node assigns run_id, default topic, and report_date for idempotency
- Step 3Orchestrator node calls Claude Sonnet to generate 4 non-overlapping search queries
- Step 4Parse and Validate node strips markdown, parses JSON, and throws on malformed output
- Step 5Fan Out: 4 Serper API calls fire simultaneously across Trend (30d), Competitors (30d), Sentiment News (7d), and Macro (30d)
- Step 6Parallel Analysis: 4 Gemini agents process their respective search results simultaneously
- Step 7Merge and Combine: n8n Merge node waits for all 4 agents; Code node assembles the combined payload
- Step 8Report Writer: Claude Sonnet receives all 4 structured JSONs and writes the full dark-theme HTML report
- Step 9Quality Gate: report length checked; failures routed to admin Telegram alert and Airtable error log
- Step 10Parallel Delivery: Gmail (full HTML), Telegram (1,000-char summary), Airtable (archive per run)
10[ Technical Architecture ]
Layer 1: Trigger
7AM daily schedule (Africa/Lagos timezone) initiates a new research run
Layer 2: Orchestrator
Claude Sonnet decomposes the research topic into 4 non-overlapping, targeted search queries
Layer 3: Parallel Agents
4 Serper searches fire simultaneously; 4 Gemini analyst agents process results in parallel, each returning structured JSON with a confidence score
Layer 4: Synthesis Engine
n8n Merge node waits for all 4 agents; a Code node maps outputs by agent field with fallbacks; Claude Sonnet writes the final dark-theme HTML report targeting 4,000+ characters
Layer 5: Quality Gate
Report length checked against a 2,000-character minimum. Failures trigger an admin Telegram alert and an Airtable error log entry
Layer 6: Delivery
Full HTML report sent via Gmail, a 1,000-character Markdown summary sent via Telegram, and the full report archived in Airtable per run
n8n Workflow: Full Pipeline Architecture
Report Output: Nigeria Financial Intelligence Report
Telegram Delivery: HTML Reports Sent to Subscribers
n8n
Workflow orchestration, parallel agent fan-out, merge, quality gate, and multi-channel delivery
Claude Sonnet
Query decomposition (Orchestrator) and final report synthesis (Report Writer)
Gemini
4 specialist analysis agents processing structured search results in parallel
Serper API
Google News and web search across 4 research dimensions
Gmail
Full HTML report delivery per run
Telegram
Real-time 1,000-character Markdown summary and error alerting
Airtable
Per-run archive of HTML reports, agent scores, and error logs
11[ Outcomes ]
A research cycle that took a person 4 to 6 hours now completes in under 5 minutes, every morning, with zero marginal cost per additional run. Every report covers all four dimensions in the same structure, every run is archived in Airtable with its agent scores, and failures announce themselves instead of being discovered by a subscriber.
Report structure, every run
12[ Metrics ]
13[ Lessons Learned ]
- Decompose the human's job before automating it. The four-dimension split came from studying what the researcher actually did; the architecture only works because the decomposition was right first.
- Put determinism between the models. Parsing, validation, merging, and gating live in code, not prompts, so when a run misbehaves the failure point is a named node with logs, not a vibe inside a long prompt.
- An autonomous system needs a failure story, not just a happy path. The quality gate, Telegram alerting, and per-run error log are what make it safe to let the pipeline run unattended every morning.