langgraph-fundamentals

द्वारा langchain-ai

We need to translate the given English text to Hindi. The text describes a directed graph framework for agent workflows. We must preserve the name "langgraph-fundamentals" but it's not in the source text, so we ignore. No extra labels. Translate accurately, keeping technical terms like "StateGraph", "reducers", "Send API", "Invoke", etc. as is or with appropriate Hindi transliteration? The instruction says preserve technical terms, so likely keep them in English. But we can translate the surrounding words. For example, "Directed graph framework" -> "निर्देशित ग्राफ ढांचा". "stateful, multi-step agent workflows" -> "स्टेटफुल, बहु-चरण एजेंट वर्कफ़्लो". "fine-grained control" -> "सूक्ष्म नियंत्रण". "StateGraph with typed state schemas" -> "टाइप किए गए स्टेट स्कीमा के साथ StateGraph".

npx skills add https://github.com/langchain-ai/langchain-skills --skill langgraph-fundamentals
LangGraph models agent workflows as **directed graphs**:
  • StateGraph: Main class for building stateful graphs
  • Nodes: Functions that perform work and update state
  • Edges: Define execution order (static or conditional)
  • START/END: Special nodes marking entry and exit points
  • State with Reducers: Control how state updates are merged

Graphs must be compile()d before execution.

Designing a LangGraph application

Follow these 5 steps when building a new graph:

  1. Map out discrete steps — sketch a flowchart of your workflow. Each step becomes a node.
  2. Identify what each step does — categorize nodes: LLM step, data step, action step, or user input step. For each, determine static context (prompt), dynamic context (from state), retry strategy, and desired outcome.
  3. Design your state — state is shared memory for all nodes. Store raw data, format prompts on-demand inside nodes.
  4. Build your nodes — implement each step as a function that takes state and returns partial updates.
  5. Wire it together — connect nodes with edges, add conditional routing, compile with a checkpointer if needed.
Use LangGraph WhenUse Alternatives When
Need fine-grained control over agent orchestrationQuick prototyping → LangChain agents
Building complex workflows with branching/loopsSimple stateless workflows → LangChain direct
Require human-in-the-loop, persistenceBatteries-included features → Deep Agents

State Management

NeedSolutionExample
Overwrite valueNo reducer (default)Simple fields like counters
Append to listReducer (operator.add / concat)Message history, logs
Custom logicCustom reducer functionComplex merging

Nodes

Node functions return partial state updates. Signatures for configuration and runtime access differ by language; use the applicable implementation reference.


Edges

NeedEdge TypeWhen to Use
Always go to same nodeadd_edge()Fixed, deterministic flow
Route based on stateadd_conditional_edges()Dynamic branching
Update state AND routeCommandCombine logic in single node
Fan-out to multiple nodesSendParallel processing with dynamic inputs

Command

Command combines state updates and routing in a single return value. Fields:

  • update: State updates to apply (like returning a dict from a node)
  • goto: Node name(s) to navigate to next
  • resume: Value to resume after interrupt() — see human-in-the-loop skill

Python: Use Command[Literal["node_a", "node_b"]] as the return type annotation to declare valid goto destinations.

TypeScript: Pass { ends: ["node_a", "node_b"] } as the third argument to addNode to declare valid goto destinations.

Warning: Command only adds dynamic edges — static edges defined with add_edge / addEdge still execute. If node_a returns Command(goto="node_c") and you also have graph.add_edge("node_a", "node_b"), both node_b and node_c will run.


Send API

Fan-out with Send: return [Send("worker", {...})] from a conditional edge to spawn parallel workers. Requires a reducer on the results field.


Running Graphs: Invoke and Stream

Call graph.invoke(input, config) to run a graph to completion and return the final state.

ModeWhat it StreamsUse Case
valuesFull state after each stepMonitor complete state
updatesState deltasTrack incremental updates
messagesLLM tokens + metadataChat UIs
customUser-defined dataProgress indicators

Error Handling

Match the error type to the right handler:

Error TypeWho FixesStrategyExample
Transient (network, rate limits)SystemRetryPolicy(max_attempts=3)add_node(..., retry_policy=...)
LLM-recoverable (tool failures)LLMToolNode(tools, handle_tool_errors=True)Error returned as ToolMessage
User-fixable (missing info)Humaninterrupt({"message": ...})Collect missing data (see HITL skill)
UnexpectedDeveloperLet bubble upraise

Core boundaries

  • Return partial state updates from nodes instead of mutating state directly.
  • Route loops through a named node; START is entry-only.
  • Define reducers for accumulated list fields; otherwise, the last write wins.
  • Account for static edges when using Command with goto, because both routes execute.

Implementation references

If writing, modifying, or debugging LangGraph code, determine the project's language from its existing files, then read the applicable reference before implementing:

Read both only when the task covers both languages. For conceptual questions that require no code, do not load either reference.

langchain-ai की और Skills

deepagents-thread-inspector
langchain-ai
स्थानीय Deep Agents Code SQLite सत्र भंडार में वार्तालापों का निरीक्षण और व्याख्या करें। LangSmith ट्रेस टूलिंग अनुपलब्ध होने पर फ़ॉलबैक के रूप में उपयोग करें, इसके लिए…
deepagents-python-quickstart
langchain-ai
आधिकारिक क्विकस्टार्ट का पालन करके पायथन में एक न्यूनतम स्थानीय डीप एजेंट तैयार करें, टैविली के बजाय प्रदाता-मूल वेब खोज का उपयोग करें। उपयोग करें जब उपयोगकर्ता चाहता है…
deepagents-typescript-quickstart
langchain-ai
आधिकारिक क्विकस्टार्ट का पालन करके TypeScript में एक न्यूनतम स्थानीय Deep Agent तैयार करें, Tavily के बजाय प्रोवाइडर-नेटिव वेब खोज का उपयोग करें। उपयोग करें जब उपयोगकर्ता…
eval-engineering
langchain-ai
किसी एजेंट रिपॉजिटरी और वैकल्पिक उपयोगकर्ता-प्रदत्त ट्रेस का पुनरावृत्त रूप से निरीक्षण करें, उपयोगकर्ता का साक्षात्कार लें, और एक-एक करके Harbor मूल्यांकन बनाएं, चलाएं, और ऑडिट करें। इसके लिए उपयोग करें…
LangChain RAG Pipeline
langchain-ai
इस कौशल का उपयोग किसी भी पुनर्प्राप्ति-संवर्धित पीढ़ी (RAG) प्रणाली के निर्माण में करें। इसमें दस्तावेज़ लोडर, RecursiveCharacterTextSplitter, एम्बेडिंग (OpenAI),… शामिल हैं।
LangChain Structured Output & HITL
langchain-ai
langchain-structured-output-&-hitl — AI एजेंटों के लिए एक इंस्टॉल करने योग्य कौशल, जो langchain-ai/langchain-skills द्वारा प्रकाशित है।
LangSmith Datasets
langchain-ai
इस कौशल का उपयोग करें जब ट्रेस से मूल्यांकन डेटासेट बनाना हो या LangSmith पर डेटासेट अपलोड करना हो या डेटासेट क्वेरी करना हो। इसमें डेटासेट प्रकार शामिल हैं (final_response,…
langsmith-evaluator
langchain-ai
लैंगस्मिथ के लिए मूल्यांकन पाइपलाइन बनाते समय इस कौशल का आह्वान करें। इसमें तीन मुख्य घटक शामिल हैं: (1) मूल्यांकनकर्ता बनाना - LLM-एक-न्यायाधीश, कस्टम कोड; (2)…