langgraph-fundamentals

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/flemx/salesforce-langgraph-agent --skill langgraph-fundamentals-flemx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langgraph-fundamentals
Source: https://github.com/flemx/salesforce-langgraph-agent/tree/main/.agents/skills/langgraph-fundamentals
Command: npx skills add https://github.com/flemx/salesforce-langgraph-agent --skill langgraph-fundamentals-flemx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing LangGraph applications involves many subtle pitfalls: forgotten reducers that silently overwrite state, uncompiled graphs, infinite loops, and incorrect node return patterns. This Skill provides correct, dual-language (Python and TypeScript) patterns for every core LangGraph concept so generated code works the first time. ## Core Features & Use Cases - State Management Patterns: Teaches state schemas with reducers (Annotated/operator.add in Python, StateSchema/ReducedValue in TypeScript) and prevents common overwrite bugs. - Graph Construction: Covers nodes, static and conditional edges, Command for combined state updates and routing, and the Send API for parallel fan-out orchestration. - Execution & Streaming: Explains invoke, stream modes (values, updates, messages, custom), and streaming LLM tokens for chat UIs. - Error Handling: Maps error types to strategies including RetryPolicy, ToolNode error recovery, and interrupt-based human escalation. - Use Case: When asked to build a multi-step agent workflow with branching and parallel workers, this Skill ensures the generated graph compiles, accumulates results correctly, and terminates properly. ## Quick Start Ask the AI to build a LangGraph workflow with conditional routing and parallel workers, and this Skill will guide it to produce correct Python or TypeScript code.

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 agent workflow in Python?

Define a TypedDict state schema, write node functions that return partial state updates, wire them with add_edge or add_conditional_edges on a StateGraph, then call compile() before invoking. The same pattern applies in TypeScript using StateSchema and addNode.

When should I use LangGraph instead of LangChain agents?

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

Why does my LangGraph state list get overwritten between nodes?

Without a reducer, returning a list from a node overwrites the previous value. Annotate the field with operator.add in Python or use ReducedValue with a concat reducer in TypeScript so updates accumulate instead of replacing.

How do I stream LLM tokens from a LangGraph graph?

Call graph.stream with stream_mode set to messages, then iterate over the chunks where each item contains a token and metadata. For custom progress updates, use stream_mode custom with a stream writer inside nodes.

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 from a conditional edge to spawn multiple parallel workers, each with its own input, and requires a reducer to aggregate their results.

Why does my LangGraph graph loop forever?

Static edges that point back to earlier nodes create infinite cycles. Add a conditional edge that returns END when a termination condition is met, such as a counter exceeding a threshold.