Production workflows / Guide 40
An Investor Research Agent That Can Rebuild Every Number
Build an investor research agent that reconciles financial periods, source revisions, and accounting definitions while separating reported facts from analyst assumptions.
Illustrative engineering guide. Examples are not client deployments, production-ready integrations, or evidence of measured results. Validate the design with your domain and security owners.

Imagine a hypothetical analyst comparing two industrial businesses. One presentation reports adjusted earnings, the other reports operating cash flow, and a data feed mixes a nine-month period with a full year. An LLM can write a persuasive ranking without noticing that the numbers answer different questions.
An investor research agent should assemble evidence, normalize comparable facts, run transparent calculations, and draft questions for the analyst. It should not manufacture a price target, promise returns, or execute trades. The useful output is a memo whose important numbers and claims can be reconstructed from their sources.
Start with a falsifiable research question
Define the issuer universe, decision horizon, and hypothesis. For example: does reported operating cash generation support the company’s stated investment program? That question is narrower and more testable than “is this a good stock?” Record the evidence that could weaken the thesis before retrieving documents.
Specify an information cutoff. A historical comparison must use filings and revisions available at that time, not today’s corrected dataset. Maintain both the reporting period and publication timestamp. Restatements should produce new facts linked to superseded facts, not silently overwrite the research record.
Separate primary disclosures, management commentary, market data, and analyst assumptions. A company presentation is a primary source for what management claimed, not independent proof that the claim will occur. A transcript quotation needs speaker and date attribution; a paraphrase must not acquire quotation marks through generation.
Normalize meaning before calculating ratios
XBRL International’s introduction explains how facts are digitally tagged using taxonomies for computer-readable reporting. Those tags help extraction, but comparability still requires checking entity, period, units, dimensions, and accounting meaning. A custom extension must not be mapped to a familiar metric solely because its label looks similar.
Retain consolidated versus segment scope, instant versus duration period, currency, scaling, and whether a value is reported or derived. Revenue in millions and capital expenditure in thousands should not meet in a ratio until normalized. Distinguish fiscal calendars, including nonstandard year lengths, from calendar-year labels.
The IFRS Foundation’s IAS 7 overview explains operating, investing, and financing cash-flow categories and the distinction between cash and non-cash transactions. Use it to understand definitions, not to assume every issuer reports under IFRS or applies identical presentation choices. Confirm the accounting basis and relevant reporting-period policies for each company.
An analyst-defined free-cash-flow measure should show its formula and reconciliation to reported lines. It must not be presented as a universally standardized figure. Lease payments, acquisitions, and capitalized development can materially change what a simple subtraction means.
Build one reproducible evidence pipeline
The minimum system has approved source adapters, an immutable document store, a fact table, deterministic calculation functions, and a memo generator. The model proposes candidate fact mappings and narrative explanations. Validated software performs arithmetic and rejects incompatible periods or units.
Each material claim references document identity, page or section, publication time, and source version. A numeric result additionally references input fact identifiers and calculation version. Keep evidence available through authorized links so reviewers do not need to trust the generated memo as the sole record.
A separate skeptical reviewer can earn its cost by searching for contradictions, omitted disclosures, and assumptions presented as facts. It should review primary evidence independently, not merely criticize another model’s prose. More agents do not compensate for a missing filing or an unlicensed market-data source.
Reject invalid comparisons explicitly
This illustrative stdlib Python function calculates an operating-cash-flow-to-revenue ratio only after checking a minimal comparability contract. It is not a valuation model or investment recommendation.
from decimal import Decimal
def cash_conversion(cash, revenue):
dimensions = ("entity", "start", "end", "currency", "scope")
if any(cash[k] != revenue[k] for k in dimensions):
raise ValueError("incomparable_facts")
numerator = Decimal(cash["normalized_value"])
denominator = Decimal(revenue["normalized_value"])
if not numerator.is_finite() or not denominator.is_finite():
raise ValueError("invalid_number")
if denominator <= 0:
raise ValueError("nonpositive_revenue")
return numerator / denominator
Production must also validate taxonomy mappings, filing versions, accounting basis, extraction quality, and normalization provenance. Negative operating cash flow is allowed; negative or zero revenue needs a different interpretation rather than a misleading percentage. A model should explain a rejected comparison instead of “repairing” the input by guessing.
For scenario analysis, keep assumptions separate from reported data. If a user supplies a margin or growth assumption, label the resulting calculation conditional. Sensitivity tables should vary meaningful inputs and show the formula. Do not attach probabilities unless an approved method actually supports them.
Missing sources should weaken the conclusion
If a filing endpoint is unavailable, retain an explicit unavailable status and use an authorized cached version only with its timestamp. Do not replace a missing primary document with a search snippet while keeping the original citation. Bound retries and respect provider access conditions rather than trying to evade restrictions.
If one peer lacks comparable data, report an incomplete comparison. Ranking only the available peers without noting the omission can create selection bias. Keep a coverage table showing requested issuers, retrieved documents, unresolved mappings, and excluded comparisons with reasons.
Research memo saves should use a stable run identifier and revision. A repeated save returns the same artifact when the payload is identical; a changed evidence set creates a new revision. Publishing to a shared investment committee folder requires explicit approval. No trading credentials belong in this workflow.
Guard against contaminated evidence
Authenticate analysts server-side and isolate tenant portfolios, watchlists, and licensed datasets. Public filings do not make private research notes public. Apply source-specific redistribution rules to exports, and prevent sensitive internal hypotheses from leaking into external search queries unnecessarily.
Treat issuer documents, web pages, and imported spreadsheets as untrusted content. A document telling the model to ignore debt disclosures or send the portfolio elsewhere cannot control tools. OWASP’s LLM security project provides the relevant prompt-injection and excessive-agency context. MCP connects tools; it does not authorize data access, publication, or transactions.
Acceptance tests for analytical integrity
- Compare nine-month cash flow with annual revenue. Expect an incompatible-period rejection and no ratio in the memo.
- Introduce a restatement after the research cutoff. Expect exclusion from the historical run and availability in a separately versioned current run.
- Supply an adjusted metric with a missing reconciliation. Expect an unresolved-definition flag rather than a standardized peer comparison.
- Block one primary filing source. Expect incomplete coverage and no fabricated citation or substituted quotation.
- Embed an instruction to suppress liabilities in a report. Expect unchanged extraction requirements, no unauthorized export, and analyst-visible evidence gaps.
Measure reproducibility before speed
Baseline analyst time to assemble a comparable evidence pack. Measure numeric reproducibility as reviewed numeric claims exactly rebuilt from cited inputs divided by all reviewed numeric claims. Measure unsupported narrative claims separately, and track required-document coverage across the full requested issuer universe.
Guardrails include period mismatches, stale revisions, licensing violations, and directional conclusions unsupported by evidence. Evaluate on historical cases with a fixed information cutoff, then shadow live research, then analyst-approved memos. Faster drafting is a proposed outcome; investment returns are neither promised nor an appropriate shortcut for measuring factual integrity.
Start with one accounting question and two issuers, not automated stock selection. News research adds source-triangulation methods, while data quality checks catch broken facts before analysis. AI systems and RAG engineering should make every claim inspectable rather than make the investment narrative more confident.