Research assistant architecture

A research assistant is a small pipeline. You take a question, find pages that might answer it, read the pages, write a cited answer, and polish the result. Each step is a node. The glue between them is state.

The four-node research pipeline

Each node reads from shared state and writes its result back.

LangGraph works by passing a single state dict through every node. A node reads what it needs, does its work, and writes the results back. This is easier to reason about than a tangle of function calls because every node has the same interface: state in, state out.

mini-perplexity.ipynb
python
# A sketch of the state we will flow through the graph
from typing import TypedDict, List, Dict, Any

class ResearchState(TypedDict):
    question: str
    search_results: List[Dict[str, Any]]
    extracted_content: List[Dict[str, Any]]
    synthesized_answer: str
    final_answer: str
    sources: List[Dict[str, str]]
    current_step: str

The TypedDict gives us autocomplete and type checking while staying a plain dict at runtime. Every node mutates this same shape.

Today the pipeline is linear. Tomorrow you will want to add a judge that decides whether to search again, or a reranker that runs in parallel, or retries on failure. A graph makes those changes trivial because the edges are data, not control flow. Start simple, grow without rewrites.

Matching exercise: Match each node to its job

Loading practice…