Financial Market Brief Generator
The problem
Section titled “The problem”Tracking specific sectors of the financial markets is a daily grind — scanning SEC filings, reading earnings reports, monitoring news feeds, then synthesizing everything into a coherent summary. Most existing tools give you everything; what you need is a focused brief on the sectors you actually care about, with evidence you can trace back to the source.
The harder problem: how do you trust that an AI-generated brief is grounded in real data and not hallucinated? Generating text is easy. Ensuring every claim is backed by a cited source, checked by a second agent, and revised when it fails review — that is the actual engineering challenge. An AI brief that cites a number the filing doesn’t contain is worse than no brief at all.
What the system does
Section titled “What the system does”Every run produces one audited brief per watched sector:
- Gather — collect everything new since the last run: SEC filings (10-K, 10-Q, 8-K) and market news for every company in the sector. Only what’s new — the system remembers what it has already processed.
- Select — rank the items by importance and recency into a bounded evidence set, so the brief stays focused on what matters today.
- Draft — a Researcher agent turns the evidence into structured claims, each citing its source.
- Check — a Critic agent receives the same evidence plus the draft, verifies every claim against the sources, and returns a verdict: approve, or revise with specific issues.
- Publish or flag — approved briefs ship with their full audit trail. If the draft fails review after the allowed revision cycles, it is flagged for a human — never silently passed off as approved.
The deliverable is a brief where every claim can be traced to a real filing or news item — or the brief doesn’t ship.
How trust is engineered
Section titled “How trust is engineered”The core design separates three responsibilities that are usually blurred together in “AI summarizer” products:
Gathering is deterministic; models never touch it. The data layer collects, deduplicates and ranks evidence with plain code — no LLM calls. It is cheap, repeatable and testable, and it can be re-run without spending a cent on model APIs. The agents receive a versioned evidence bundle: the single artifact that defines what the brief may talk about.
Drafting and checking are two separate agents, deliberately. The Researcher writes; the Critic reads the same evidence and adversarially checks the draft against it. A single model asked to “summarize and verify yourself” tends to rubber-stamp its own output. Here the reviewer is structurally independent, sees the raw evidence the writer worked from, and returns a structured verdict — approve or revise, each issue tied to the specific claim it concerns.
Control flow belongs to code, not to a model. A deterministic controller decides when to cycle: if the Critic says revise, the Researcher gets the issues and tries again — up to a hard cap of two revision cycles. The Critic can never approve-and-publish by itself, and it can never mark a brief as failed either; only the controller assigns final status, when the cap is hit or a draft fails validation. Every cycle, every critique and every verdict is persisted as an audit trail a person can read.
flowchart LR
SEC[SEC filings] --> GATHER[Gather what's new<br/>deterministic, no LLM]
NEWS[Market news] --> GATHER
GATHER --> BUNDLE[Versioned evidence bundle<br/>defines what the brief may claim]
BUNDLE --> RESEARCHER[Researcher agent<br/>drafts claims, each citing a source]
RESEARCHER --> CRITIC[Critic agent<br/>checks every claim against the evidence]
CRITIC --> VERDICT{Verdict}
VERDICT -- approve --> PUBLISH([Audited brief<br/>claims traceable to sources])
VERDICT -- revise --> RESEARCHER
VERDICT -- cap reached --> FLAG([Flagged for human review<br/>never silently shipped])
style FLAG fill:#fde8d7,stroke:#d9822b
Design decisions
Section titled “Design decisions”- Data first, models second. The evidence bundle is the handoff artifact between the deterministic and agentic layers. This keeps the expensive, non-deterministic part of the system small and inspectable, and the cheap part re-runnable.
- The model can’t freelance. Both agents emit their output in a fixed, validated structure — the Researcher’s claims and the Critic’s verdicts arrive as typed data, never free text to be parsed and hoped at. A malformed response fails loudly instead of corrupting the pipeline silently.
- Every citation must resolve. Validation checks that each cited source actually exists in the bundle before a brief can proceed. Claims about evidence the system never collected don’t survive.
- A brief is approved or flagged — never fudged. On cap exhaustion, the last draft is kept and marked with the reason. No silent approval, no quiet downgrade of a failed brief.
- Delta-only state keeps cost bounded. The system tracks what it has already seen per sector, so a re-run processes only new items. Watching a sector costs proportionally to how much is actually happening in it, not to how much data exists.
- Any sector, by configuration. Currently configured for Software & Services and Semiconductors; adding a sector is a config change, not a code change.
Cost, scale and audit
Section titled “Cost, scale and audit”- Per-run cost is bounded by design — the evidence set is capped, revisions are capped, and nothing runs when there is nothing new.
- Sources are accessed respectfully — rate-limited, with backoff when a feed pushes back.
- Every run is versioned and fully audited — each draft, each Critic verdict with its issue detail, the revision count and the final status are all persisted, so any published brief can be reconstructed after the fact.
Tech stack
Section titled “Tech stack”Python · Anthropic API for the two agents (structured, forced output — never free text) · SEC EDGAR and news feeds as sources · Pydantic schemas validating every agent response · versioned per-sector state · pytest unit tests with no network plus integration tests against the real APIs.
What this delivers
Section titled “What this delivers”| Business outcome | How the system achieves it |
|---|---|
| AI output a business can trust | Every claim cites a real filing or news item, and an independent second agent checks each claim against that evidence before publication |
| Bounded, predictable AI spend | The model layer runs only on a capped evidence set, revises at most twice, and doesn’t run at all when there is nothing new |
| Audit-ready by design | Every draft, critique and verdict is persisted — any published brief can be reconstructed after the fact |
| Failure that fails safe | A brief that can’t pass review is flagged for a human, with the reason — never silently shipped as approved |
| Coverage that scales by configuration | Watching a new sector is a config change, not a code change — the system adapts to new business priorities |
| No silent data corruption | Every agent response arrives as validated structured data; malformed output fails loudly instead of poisoning the pipeline |
Why this matters
Section titled “Why this matters”The barrier to adopting generative AI in most businesses is not the quality of the writing — it is whether the output can be trusted, costed, audited and safely failed. In a domain where one wrong number can be expensive, “the model said so” is not an answer. “This claim traces to that filing, and here is the review that approved it” is.
This project is a working demonstration of the pattern that closes that gap: models handle the language — drafting claims, critiquing drafts — while code gathers the evidence, controls the loop, and owns the final verdict. Generation becomes powerful but bounded, autonomy becomes capped, and the audit trail becomes something a human can actually read. That is what turns an AI demo into a system a business can deploy.
The pattern transfers directly to any high-stakes document process — regulatory summaries, compliance reviews, competitor intelligence, customer communications — anywhere an organization wants AI’s leverage without accepting AI’s failure modes as the price.