COLLABORATIVE AGENTIC REASONING • VERIFICATION ENGINE

FactLens Multi-Agent Verification Prototype

An autonomous fact-checking pipeline built on LangChain and LangGraph. Decomposes multimodal claims into atomic propositions, executes parallel tri-channel evidence retrieval across institutional archives, runs deterministic credibility scoring, and arbitrates verdicts with an adversarial skeptic loop.

Orchestrator: LangGraph StateGraph Parallelism: LangChain RunnableParallel LLM Inference: Gemini 2.5 Flash + Grounding Backend: FastAPI ASGI (Async Pipeline) Memory & Cache: SQLite Drift Tracking
LANGGRAPH STATEGRAPH ARCHITECTURE
CLICK ANY AGENT TO INSPECT CODE & PROMPTS
PHASE 01 INTAKE & ROUTING
01
Intake Agent
Sanitizes & Normalizes
02
Domain Router
Semantic Route Classifier
➔
PHASE 02 PARALLEL RETRIEVAL TRIO
03
Web Scout Agent
Multi-Provider Cascade
04
Archive Hunter
Gov/Edu Institutional Scrape
05
Data Extractor
World Bank & Deep Scrape
➔
PHASE 03 CONSISTENCY & FUSION
06
Tri-Consistency
Jaccard Coherence Metric
07
Evidence Aggregator
Deduplication & MMR Re-rank
➔
PHASE 04 ADVERSARIAL AUDIT
08
Skeptic Agent
Contradiction Gap Finder
09
Evidence Auditor
7-Tier Credibility Scoring
10
Stat Comparator
Numeric & Rank Guardrail
➔
PHASE 05 ARBITRATION & REBUTTAL
11
Consensus Moderator
Final Explainable Verdict
12
Rebuttal & Memory Tail
Contradiction Feedback Loop
↺ CYCLIC REBUTTAL CONDITIONAL EDGE: If Skeptic flags contradiction & confidence < gate ➔ re-fetch archive evidence and re-audit
CONTRADICTED CONFIDENCE: 94.6%
JACCARD CONSISTENCY: 0.84 AUDIT SCORE (T): 92.4/100 EXECUTION: 2.78s

EXPLAINABLE ARBITRATION RATIONALE:

Claim asserts India is the 4th largest global economy by nominal GDP in 2026. While official IMF and World Bank datasets project India reaching the 4th rank in nominal terms between late 2026 and 2027 ($4.18T), Japan and Germany currently occupy ranks 4 and 3 respectively as of latest verified quarterly statistics. Counter-evidence from IMF World Economic Outlook (October 2025 release) confirms rank 5 status with active transition velocity.

AUDITED EVIDENCE CORROBORATION (7-TIER QUALITY AUDITED):
3 Sources Corroborated
TIER DOMAIN RETRIEVAL CHANNEL SNIPPET / ASSERTION WEIGHT
T1 (1.00) imf.org Archive Hunter (Official) IMF World Economic Outlook: India nominal GDP projected at $4.187T, maintaining Rank 5 behind Japan ($4.31T). 0.96
T1 (1.00) worldbank.org Data Extractor API World Development Indicators: NY.GDP.MKTP.CD series confirms $3.94T baseline for previous fiscal year. 0.94
T3 (0.85) reuters.com Web Scout Cascade Analysis: India on trajectory to overtake Japan by fiscal 2027; currently verified at fifth spot. 0.81
ENGINEERING SPECIFICATION

Deterministic Quality Scoring & LangGraph Primitives

FactLens eliminates hallucinations by decoupling reasoning into an auditable directed graph with deterministic mathematical scoring.

01

Deterministic Evidence Auditor Formula

Evidence quality is never left to subjective LLM opinion. Every extracted item passes through the mathematical scoring equation:

T = ( Σ(w_i × R_i) / n ) × (1 - ρ) × 100
  • w_i: Domain credibility weight from the 7-tier hierarchy (T1 Government: 1.00 to T7 Social Media: 0.05).
  • R_i: Semantic relevance token overlap score (0 to 1).
  • ρ: Duplicate penalty ratio discounting single-domain concentration.
  • Temporal Decay: Multiplier penalizing stale data (1.0 for current year down to 0.4 for 10+ years).
02

Why LangGraph vs. Linear Chains?

Standard LangChain sequential chains fail when verification requires cyclic feedback. LangGraph provides:

  • StateGraph Typed State: VerificationState carries normalized propositions, evidence pools, and skeptic notes across nodes.
  • RunnableParallel Fan-Out: Web Scout, Archive Hunter, and Data Extractor execute simultaneously across threads, reducing latency from 7.2s to 2.8s.
  • Conditional Cyclic Edge: The Rebuttal Loop re-triggers evidence retrieval if the Skeptic Agent detects contradictions and the confidence gate is breached.
  • Deterministic Memory Tail: Persists run states and evaluates historical drift in local SQLite.
03

7-Tier Source Credibility Taxonomy

T1 • 1.00 Government & Official Records (.gov, .edu, WHO, NASA, RBI)
T2 • 0.95 International Bodies & Scientific Journals (UN, IMF, World Bank, Nature, Lancet)
T3 • 0.85 Global Wire Services & Major Financials (Reuters, AP News, Bloomberg, BBC, WSJ)
T4 • 0.75 Reputable National Broadsheets (The Hindu, NDTV, Economic Times)
T5 • 0.65 Dedicated Fact-Checking Organizations (Snopes, PolitiFact, BoomLive)
T6 • 0.15 Clickbait, Tabloids & Satire Outlets
T7 • 0.05 Social Media & Messaging (X, Facebook, TikTok, Reddit - Excluded)
REPO: /f/fact-lens-lablab
# factlens_crew/orchestrator.py
from langgraph.graph import StateGraph, END
from langchain_core.runnables import RunnableParallel
from factlens_crew.schemas import VerificationState

def build_factlens_graph():
    workflow = StateGraph(VerificationState)

    # Register the 12 Stage Nodes
    workflow.add_node("intake", intake_agent)
    workflow.add_node("router", domain_router_agent)
    workflow.add_node("retrieval_trio", RunnableParallel({
        "web": web_scout_agent,
        "archive": archive_hunter_agent,
        "extractor": data_extractor_agent
    }))
    workflow.add_node("tri_consistency", tri_consistency_agent)
    workflow.add_node("aggregator", evidence_aggregator_agent)
    workflow.add_node("skeptic", skeptic_agent)
    workflow.add_node("auditor", evidence_auditor_agent)
    workflow.add_node("stat_comparator", stat_comparator_agent)
    workflow.add_node("moderator", consensus_moderator_agent)
    workflow.add_node("rebuttal_loop", rebuttal_agent)
    workflow.add_node("memory_tail", memory_tail_node)

    # Edge Sequence
    workflow.set_entry_point("intake")
    workflow.add_edge("intake", "router")
    workflow.add_edge("router", "retrieval_trio")
    workflow.add_edge("retrieval_trio", "tri_consistency")
    workflow.add_edge("tri_consistency", "aggregator")
    workflow.add_edge("aggregator", "skeptic")
    workflow.add_edge("skeptic", "auditor")
    workflow.add_edge("auditor", "stat_comparator")
    workflow.add_edge("stat_comparator", "moderator")

    # Conditional Rebuttal Edge: If Skeptic flags contradiction & confidence < 80%
    workflow.add_conditional_edges(
        "moderator",
        should_rebut,
        {
            "rebuttal": "rebuttal_loop",
            "finalize": "memory_tail"
        }
    )
    workflow.add_edge("rebuttal_loop", "auditor")
    workflow.add_edge("memory_tail", END)

    return workflow.compile()