Skip to main content

πŸ“ LangChain

Description​

< What is it? >​

  • Definition: LangChain is a framework for building applications and agents around language models. It provides interfaces and integrations for models, tools, and agent behavior. The application supplies its model, instructions, tools, and data; LangChain is not itself a language model. See the LangChain overview.
  • Example: a support assistant can retrieve a return policy, include it in a model request, and produce an answer with a source reference.

Key points​

< LangChain, LangGraph, and LangSmith working together >​

  • Workflow overview: the diagram separates execution control, application components, and tracing. It is redrawn from the supplied ByteMonk image.

    A user request enters a LangGraph workflow whose nodes use LangChain prompt, retrieval, model, and tool components; dashed lines send tracing events to LangSmith
  • LangGraph: controls workflow state, node execution, and branches. A node may call a language model, retrieve documents, execute a tool, or run ordinary application code.

  • LangChain: supplies model and tool abstractions and higher-level agent construction. Components such as prompt formatting and retrieval can be used inside workflow nodes. Its high-level agents use LangGraph underneath.

  • LangSmith: records instrumented runs for inspection and supports evaluation. The diagram's β€œTrace logger,” β€œOutput recorder,” and β€œDecision tracker” labels describe recorded information, not three required standalone services. A trace exposes recorded actions and outputs, not a model's unobservable internal reasoning.

  • Reading the arrows: solid lines represent execution or data flow; dashed lines represent tracing events. The figure illustrates responsibilities rather than a mandatory deployment topology. LangGraph can be used without LangChain, and LangSmith can instrument applications built with other frameworks. See the LangGraph overview and LangSmith observability documentation.

Comparison​

< LangChain vs. LangGraph vs. LangSmith >​

  • Choose by responsibility: these tools address complementary application concerns.

    ToolMain responsibilityUse it when
    LangChainModel and tool integration; higher-level agent constructionThe application needs reusable integrations and an agent loop
    LangGraphStateful orchestration with explicit transitions and branchesThe workflow needs custom control flow, persistence, or human review
    LangSmithTracing, debugging, datasets, and evaluationDevelopers need to inspect execution and compare application quality

    LangSmith also supports prompt management and deployment; this diagram focuses on its observability role. See the official ecosystem overview.

Examples​

< A support question through the ecosystem >​

  • Illustrative input and output: the following is a designed workflow, not a recorded model run.

    StepConcrete data or action
    User requestβ€œHow long do I have to return headphones?”
    RetrievalDocument D17: β€œHeadphones may be returned within 30 days.”
    Workflow decisionEvidence is available, so continue to answer generation
    Model inputThe question, document D17, and an instruction to cite evidence
    Expected answerβ€œHeadphones can be returned within 30 days. [D17]”
    TraceRetrieval result, selected route, model request and response, duration, and errors if any

Reference​