Agentic Research & Decision Intelligence Assistant
Developed a LangGraph-powered multi-step research and decision-support system that decomposes complex queries into research dimensions, gathers external evidence with deterministic fallback and circuit breaking, validates findings, and escalates low-confidence runs to human review before synthesizing structured recommendations.
- Role: AI Engineer & Solo Developer
- Timeline: 2026
- Team: Solo Developer
- Technologies: LangGraph, Gemini 2.5, Python, Streamlit, FastAPI, SQLite
- Link: https://researchagent-langchain-reasoning.streamlit.app/
Problem
Open-ended market and technical queries require multi-faceted investigation, gathering evidence across diverse sources, detecting conflicting data, and generating reliable, structured decision support without hallucinating confidence or getting stuck in endless search loops.
Solution
Built a stateful multi-step agent system using LangGraph with 100% deterministic graph edges for control flow. The graph executes 6 stages: classify_and_plan (Planner LLM decomposes query into orthogonal dimensions), plan_gate (deterministic clamp and deduplication), research_dimension (Research LLM with tool execution loop), validate (deterministic conflict, coverage, and confidence scoring), human_review (interrupt/resume gate for low-confidence or conflicting runs), and synthesize (Synthesis LLM producing structured multi-part projections). State is persisted step-by-step using SQLite SqliteSaver for seamless human-in-the-loop workflows.
Impact
- Deterministic control flow edges and bounded tool loops guarantee 100% execution termination with zero risk of infinite LLM search loops
- Deterministic validation layer removes LLM hallucination from confidence scoring, conflict detection, and human escalation decisions
- SQLite-backed tool caching (24h TTL) and per-tool circuit breakers (3 consecutive failures → OPEN) ensure system resilience under severe API rate limits and source downtime
- LangGraph SqliteSaver checkpointing enables pause, human guidance, and resume capabilities across process restarts via thread_id
Key features
- Planner Agent decomposes complex NL questions into 3–6 orthogonal investigation dimensions with strict JSON schema outputs
- Research Agent executes sequentially over a 5-tool registry (DuckDuckGo, Wikipedia, HackerNews Algolia, arXiv, GitHub REST) with exponential backoff and circuit breaking
- Deterministic Validator scores runs using a weighted confidence formula (45% finding conf, 35% coverage, 20% conflict ratio)
- Confidence-gated Human Review trigger (escalates if confidence < 0.70, conflicts > 0, or degraded dimensions ≥ 2) with interrupt and resume state mechanics
- Synthesis Agent aggregates validated evidence into structured FinalReport projections (Part 1: Findings, Part 2: Recommendation, Part 3: Validation)
- Tool Executor layer features 24h TTL SQLite caching, in-run deduplication, tenacity retry logic with backoff + jitter, and 10s execution timeouts
- Client-side token-bucket rate limiter (8 RPM) strictly prevents 429 quota errors under Gemini free-tier limits
- Dual UI/API availability: Interactive Streamlit interface streaming internal execution traces alongside a FastAPI backend
Tech stack
- Ai: LangGraph, Gemini 2.5 Flash, google-genai (structured output)
- Backend: Python 3.12, FastAPI, Streamlit, Tenacity
- Data: SQLite (SqliteSaver & Tool Cache), Pydantic v2
- Viz: Mermaid.js, Streamlit UI
System architecture
Trust boundary — LangGraph Multi-Step Decision Intelligence Assistant. Control flow is 100% deterministic graph edges; no LLM decides routing. State is checkpointed at every super-step using SQLite SqliteSaver.
01 · Plan & Gate — Decompose question into dimensions
- Planner Agent — LLM · Structured Output. Decomposes open-ended user questions into 3 to 6 orthogonal investigation dimensions with explicit scope and justification.
- plan_gate — Deterministic clamp & dedupe. Clamps dimension counts strictly between min/max bounds and removes duplicate investigation angles prior to research execution.
↓ NL Query → Clamped ResearchPlan
02 · Research Dimensions — Tool loop per dimension
- Research Agent — LLM + Tool Loop. Invoked per dimension to select search tools, process noisy web responses, and extract finding-level confidence scores.
- Tool Executor — 5 Free Tools · Circuit Breaker. Executes calls across DuckDuckGo, Wikipedia, HackerNews, arXiv, and GitHub APIs with exponential backoff, circuit breaking (3 failures → OPEN), and 10s timeouts.
- Tool Cache & Dedup — SQLite · 24h TTL. In-run deduplication and local SQLite persistence cache tool responses for 24 hours to minimize network traffic and API quota hits.
↓ Dimensions → Validated per-finding evidence
03 · Deterministic Validation — Conflict, coverage & confidence scoring
- Validator Node — Deterministic Math (Token-free). Calculates total confidence = 0.45·finding_conf + 0.35·coverage + 0.20·(1 - conflict_ratio). Detects contradictory evidence and marks degraded dimensions.
↓ Findings → Confidence metric & Escalation signal
04 · Human Review Gate — Confidence threshold check (default 0.70)
- Escalation Router — confidence < τ OR conflicts > 0. If confidence falls below 0.70, conflicts exist, or ≥2 dimensions are degraded, execution triggers a LangGraph interrupt.
- human_review — Interrupt → Guidance / Resume. Pauses execution graph via SqliteSaver. The operator can approve, provide guidance, or trigger a targeted dimension re-research loop.
↓ Approved state → Synthesis node
05 · Synthesis & Projections — Structured decision synthesis
- Synthesis Agent — LLM · Final Report. Weighs evidence and generates structured recommendations with cross-referenced finding citations and reasoning trails.
- Report Projections — Part 1 / Part 2 / Part 3 UI & API. Exposes final report artifacts into REST endpoints and downloadable UI projections (Summary, Recommendations, Validation Report).
↓ Validated state → Multi-part FinalReport
Deliberately out of scope / Future Work
- Parallel Fan-Out (LangGraph Send) — Paid API Tier feature. Parallel dimension research via LangGraph Send is designed for paid API keys; sequential execution is enforced by default to respect free-tier rate limits.
- Vector DB / Semantic Cache — Vector Store Integration. Exact-key SQLite caching with 24h TTL is implemented; semantic vector caching is documented in architecture specs as a production upgrade.
Control loops
- Human re-research loop — Operators reviewing flagged runs can send individual degraded dimensions back to the Research Agent with specific instructions (capped at max 1 loop).
- Dimension iteration loop — The research stage iterates sequentially across all planned dimensions while respecting client-side rate limits.
- Pause & Resume persistence — LangGraph SqliteSaver checkpoints state at every super-step, allowing runs to pause indefinitely on interrupt and resume across process restarts by thread_id.
Architecture highlights
- 100% deterministic graph routing: classify_and_plan → plan_gate → research_dimension* → validate → [human_review] → synthesize
- Clear separation of concerns: Semantic judgment delegated to LLMs, while control flow, validation math, and escalation thresholds remain token-free and reproducible
- Resilient ToolExecutor wrapper that never raises unhandled exceptions—errors degrade findings into data that feed the confidence scoring engine
- Full thread-level SQLite checkpointing allowing seamless execution pause on `interrupt()` and resume on human feedback
What K Laxman learned
- Restricting LLMs strictly to semantic tasks (planning, extraction, synthesis) while using deterministic code for control flow and validation math dramatically improves system reliability
- Implementing tool-level circuit breakers and local caching prevents external API downtime from cascading into full pipeline failure
- Stateful graph checkpointing (SqliteSaver) is essential for production human-in-the-loop applications, allowing tasks to pause and resume without losing context
- Counter-bounding loop conditions (max tool calls per dimension, capped review loops) guarantees deterministic execution termination and cost predictability
Explore more
- Home — overview, skills and a built-in AI assistant
- Experience — roles at Think360 AI (CAMS), CAMS Mutual Funds and IIT Delhi
- Projects — GenAI, LLM, RAG and full-stack builds
- Education — IIT Delhi, M.Tech & B.Tech Computer Science
- GitHub Activity — open-source contributions
- Contact / Hire me