Back to the work
AI/ML · Builder

CAG Deep Research.

A causal-adversarial deep-research engine: LangGraph plans a causal graph of a question, red and blue team agents investigate each causal edge in parallel, and a dialectical judge returns verdicts. Built on a hexagonal architecture with swappable search and LLM providers.

Role
Builder
When
2024
Stack
Python, LangGraph, LangChain, Pydantic
Scale
7 nodes in the graph
CAG Deep Research previewCausal-Adversarial · LangGraph
7 nodesin the graph
Red / Blueper causal edge
Hexagonalports + adapters
5+providers

The problem

Single-LLM research tends to confirm whatever it first believes. The goal was a system that actively tries to falsify its own claims: model a question as a causal graph, then attack each causal link with a dedicated adversary before trusting it.

What it does

  1. A LangGraph workflow (CAG, Causal-Adversarial Graph) that plans a causal DAG, then investigates each edge with a parallel red team (adversary) and blue team (supporter).
  2. A dialectical judge weighs the two sides on scientific criteria and returns a structured verdict: VERIFIED, FALSIFIED, or UNCLEAR, with a confidence score.
  3. Hexagonal architecture (ports + adapters) so search engines (DuckDuckGo, Tavily, Exa) and LLM providers (Ollama, Groq, GitHub Models) are swappable.

Impact

  • Falsification-first design: every causal claim faces a dedicated adversary before it is accepted, instead of one model synthesising unchecked.
  • Runs entirely on free backends (DuckDuckGo + Ollama or GitHub Models) or scales up to paid search and faster cloud LLMs, with no code changes.
  • Safety rails throughout: recursion-depth caps, per-edge investigation limits, loop detection via action hashes, and an auditor that decides loop-or-finish.