03 / 11 — Case study

KWealth

A multi-agent stock analysis system that runs an adversarial swarm of analyst personas and synthesises the disagreement into a balanced recommendation.

2026 · Python / Multi-agent LLM / yfinance / FastAPI
KWealth

A Python system that sends one ticker through four adversarial analyst agents and returns a recommendation whose confidence is derived from how much they disagreed. The disagreement is the output.

Problem

A single model asked "should I buy this stock" will tell you something confident and unfalsifiable. It has read the same handful of commentary about any large-cap name and regurgitates consensus with a straight face - which is the opposite of useful, because consensus is already in the price.

What it does

One shared evidence packet - price history, fundamentals, ratios - fans out to a value agent, a growth agent, a quant agent and a risk agent. Each returns a structured verdict: direction, conviction, the three facts carrying its argument, and the one thing that would change its mind. A synthesiser then aggregates the verdicts and computes the disagreement spread; when all four agree the output flags it as consensus, and when they split it shows both cases verbatim and refuses to pick.

How it's built

The first attempt was a sequential chain - bull, then rebuttal, then judge - and it produced the same answer as a single model with more tokens spent, because each agent anchored on the one before it. The fix was parallelism plus discipline constraints, so the agents disagree about the same numbers rather than about scope.

Everything downstream of the data layer is deterministic: low temperature, versioned prompts, and each agent's output cached by ticker, snapshot date and prompt version, which is what makes a re-run of last month's analysis comparable rather than merely different. There is no claim that this beats the market. It is a tool that forces me to write down why I think I am right, from four directions, before I am allowed to act.

FIG. 01 — A full run's output: four fixed-discipline verdicts and the synthesised recommendation whose confidence is their disagreement.

Status

Personal research tool: a CLI today, with an experimental FastAPI wrapper for comparison runs. Backtested hit rate and cost per analysis run are <!-- AUTHOR: replace with real numbers -->.

Credits

  • Charlie Munger and Warren Buffett, for the inversion habit this imitates badly
  • yfinance, for the data layer
  • The multi-agent debate literature (LangGraph, AutoGen), which is where attempt two came from

Copyright © 2026

Designed, Developed & Maintained by

Mohammed Khalid