Back to portfolio

Research agent · LangGraph

AI Research Agent

Perplexity-style research with five explicit pipeline stages, citation-backed synthesis, and a self-reflection retry loop.

Demo limits

  • ·5 searches per session, 15 per IP per hour, 10 second cooldown
  • ·250 searches per UTC day, across everyone
  • ·Kill switch that stops paid calls without a redeploy

A public AI demo is a spending endpoint. Cost control is part of what I ship.

AI Research Agent

Problem

A useful research agent has to do five different things well: plan the search, fetch the right sources, weigh contradictory evidence, write the answer, and know when to give up. Most "Perplexity clones" collapse the whole thing into one LLM call and inherit all of its blind spots: they hallucinate citations, ignore conflict between sources, and never re-plan when results are weak.

Approach

  • Five-stage LangGraph pipeline: (1) chain-of-thought planning that decomposes the question into 3-5 search queries, (2) parallel Tavily fetches, (3) source-by-source extraction + relevance scoring, (4) synthesis with mandatory inline citations, (5) self-reflection that decides whether to ship the answer or trigger a focused retry loop with new queries.
  • Citations are hard-required: the synthesis step refuses to emit a sentence without a numbered source, and the UI surfaces them as clickable footnotes.
  • Streaming UX: Server-Sent Events push each stage transition to the client so the user sees "Planning…", "Fetching 4 sources…", "Synthesizing…", "Reflecting…" instead of staring at a spinner.
  • Multi-provider LLM routing behind one interface: production runs DeepSeek through OpenRouter, and Groq or Anthropic native are a single env var away, with a fallback chain for when a model is over capacity.

Stack

Next.js 16FastAPILangGraphTavilyDeepSeek via OpenRouterSSEDocker