langgraph-fundamentals

Guides writing LangGraph code covering StateGraph, nodes, edges, Command, Send, streaming, and error handling.

Updated May 1, 2026
One-click install
npx skills add https://github.com/ricardoo022/4dill --skill langgraph-fundamentals-ricardoo022
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: langgraph-fundamentals
Source: https://github.com/ricardoo022/4dill/tree/main/.gemini/skills/langgraph-fundamentals
Command: npx skills add https://github.com/ricardoo022/4dill --skill langgraph-fundamentals-ricardoo022

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing LangGraph agent workflows involves many subtle pitfalls: forgotten reducers silently overwrite state, uncompiled graphs throw errors, and mixing static edges with Command routing causes unexpected parallel execution. This Skill provides correct patterns and common fixes for building stateful agent graphs in Python and TypeScript. ## Core Features & Use Cases - State Management: Defines state schemas with reducers (Annotated with operator.add in Python, ReducedValue in TypeScript) so list fields accumulate instead of being overwritten. - Graph Construction: Covers nodes, static and conditional edges, Command for combined state updates and routing, and the Send API for parallel fan-out worker patterns. - Execution & Error Handling: Explains invoke, streaming modes (values, updates, messages, custom), RetryPolicy for transient failures, and ToolNode error recovery. - Use Case: When building a multi-agent orchestration workflow, invoke this Skill to get correct reducer definitions, conditional routing, and parallel worker fan-out without falling into the common traps of lost state or infinite loops. ## Quick Start Use the langgraph-fundamentals skill to help me build a StateGraph with conditional routing and parallel workers that aggregate results with a reducer.

Frequently Asked Questions about langgraph-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a LangGraph StateGraph with nodes and edges?▼

Define a state schema as a TypedDict, add node functions that return partial state updates, connect them with add_edge or add_conditional_edges, then call compile() before invoking. The graph must be compiled to produce an executable object.

Why is my LangGraph state list being overwritten between nodes?▼

List fields without a reducer are overwritten by each node update, so earlier values are lost. Fix it by annotating the field with a reducer, such as Annotated[list, operator.add] in Python or ReducedValue in TypeScript, so updates accumulate.

What is the difference between Command and Send in LangGraph?▼

Command combines a state update and a single routing decision in one node return value. Send fans out to multiple parallel workers from a conditional edge, and requires a reducer on the results field to aggregate worker outputs.

When should I use LangGraph instead of plain LangChain agents?▼

Use LangGraph when you need fine-grained control over orchestration, complex branching or loops, human-in-the-loop, or persistence. For quick prototyping or simple stateless workflows, LangChain agents or direct calls are a better fit.

How do I handle errors and retries in LangGraph nodes?▼

Attach a RetryPolicy with max_attempts to nodes for transient failures like network errors. For tool failures, use ToolNode with handle_tool_errors enabled so errors return as ToolMessages the LLM can recover from.

Why does my LangGraph workflow loop forever?▼

Static edges that point back between two nodes create an infinite cycle. Add a conditional edge that returns END once a termination condition is met, such as a counter exceeding a threshold.