langgraph-fundamentals
Skill2 starsChanged 38 days agoMITView on GitHub
INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.
9 other projects use a version of this, 5 of them edited; 5 of 5 edited versions we compared changed its rules.
How people change it
5 of 5 edited versions changed its rules, and some changes recur.
Of the 5 edited versions we compared: 5 made changes of their own.
Rules people drop
- A rule we can't quote: its licence doesn't allow itdropped by 5 of 5
- A rule we can't quote: its licence doesn't allow itdropped by 5 of 5
Rules people add
- Use StateSchema with ReducedValue for accumulating arrays.added by 5 of 5
- Use a reducer to accumulate parallel worker results (otherwise last worker overwrites).added by 5 of 5
- Use ReducedValue to accumulate parallel worker results.added by 5 of 5
- Use RetryPolicy for transient errors (network issues, rate limits).added by 5 of 5
- Use retryPolicy for transient errors.added by 5 of 5
- Use ToolNode from langgraph.prebuilt to handle tool execution and errors. When handle_tool_errors=True, errors are returned as ToolMessages so the LLM can recover.added by 5 of 5
- Must compile() to get executable graph.added by 5 of 5
- Use conditional edges with END return to break loops.added by 5 of 5
We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.
Adopted by
Most recently taken up by
- langchain-ai/langchain-skillstheir own version, first seen Nov 29, 2026
- noahwins-ng/equity-data-agentedited, first seen Oct 13, 2026
- willlee1995/skillsedited, first seen Oct 13, 2026
- gerald-donkor/poli-inteledited, first seen Oct 11, 2026
- workatustadarshajay/CareLoop-AIword for word, first seen Oct 9, 2026
- zoujindouGithub/agent-skillstheir own version, first seen Sep 2, 2026
Other versions9 projects use a version of this.
Word for word · 1
- workatustadarshajay/CareLoop-AI★ 0100% same
Edited · 5
- langchain-ai/skills-benchmarks★ 11627% same
- buduan/soul-graph★ 227% same
- gerald-donkor/poli-intel★ 127% same
- noahwins-ng/equity-data-agent★ 127% same
- willlee1995/skills★ 127% same
Wrote their own version · 3
- langchain-ai/langchain-skills★ 1.4ksame name
- HarambeeAI/bayes-ship★ 1same name
- zoujindouGithub/agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- client/AGENTS.mdAGENTS.md
- core-guidelinesSkill
- hairline-adoptSkill
- hairline-createSkill
- higgsfield-brandkitSkill
- higgsfield-faceless-videoSkill
- higgsfield-generateSkill
- higgsfield-marketplace-cardsSkill
- higgsfield-product-photoshootSkill
- higgsfield-soul-idSkill
- higgsfield-video-explainerSkill
- higgsfield-websitesSkill
- higgsfield-youtube-thumbnailSkill
- temporal-cloudSkill
- temporal-developerSkill
- deep-agents-coreSkill
- deep-agents-memorySkill
- deep-agents-orchestrationSkill
- deepagents-python-quickstartSkill
- deepagents-typescript-quickstartSkill
- ecosystem-primerSkill
- eval-engineeringSkill
- higgsfield-brandkitSkill
- higgsfield-faceless-videoSkill
- higgsfield-generateSkill
- higgsfield-marketplace-cardsSkill
- higgsfield-product-photoshootSkill
- higgsfield-soul-idSkill
- higgsfield-video-explainerSkill
- higgsfield-websitesSkill
- higgsfield-youtube-thumbnailSkill
- langchain-dependenciesSkill
- langchain-fundamentalsSkill
- langchain-middlewareSkill
- langchain-python-quickstartSkill
- langchain-ragSkill
- langchain-typescript-quickstartSkill
- langgraph-cliSkill
- langgraph-decision-modelsSkill
- langgraph-human-in-the-loopSkill
- langgraph-persistenceSkill
- langgraph-python-quickstartSkill
- langgraph-typescript-quickstartSkill
- managed-deep-agentsSkill
- swarmSkill
- temporal-cloudSkill
The file
We split this skill into the rules it gives an agent
5 rules. 1 is common, 2 are distinctive, and 2 are very specific to this project.
1
Common
Most of the 7 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 22
Follow these 5 steps when building a new graph:
- Very specific: line 92
Python: Use Command[Literal["node_a", "node_b"]] as the return type annotation to declare valid goto destinations.
- Very specific: line 116
Call graph.invoke(input, config) to run a graph to completion and return the final state.
- Distinctive: line 159
If writing, modifying, or debugging LangGraph code, determine the project's language from its existing files, then read the applicable …
- Distinctive: line 164
Read both only when the task covers both languages.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<overview>
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.
</overview>
<design-methodology>Designing a LangGraph application
Follow these 5 steps when building a new graph:
- Map out discrete steps — sketch a flowchart of your workflow. Each step becomes a node.
- 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.
- Design your state — state is shared memory for all nodes. Store raw data, format prompts on-demand inside nodes.
- Build your nodes — implement each step as a function that takes state and returns partial updates.
- Wire it together — connect nodes with edges, add conditional routing, compile with a checkpointer if needed.
</design-methodology><when-to-use-langgraph>| Use LangGraph When | Use Alternatives When |
| Need fine-grained control over agent orchestration | Quick prototyping → LangChain agents |
| Building complex workflows with branching/loops | Simple stateless workflows → LangChain direct |
| Require human-in-the-loop, persistence | Batteries-included features → Deep Agents |
</when-to-use-langgraph>State Management
<state-update-strategies>| Need | Solution | Example |
| Overwrite value | No reducer (default) | Simple fields like counters |
| Append to list | Reducer (operator.add / concat) | Message history, logs |
| Custom logic | Custom reducer function | Complex merging |
</state-update-strategies>Nodes
<node-function-signatures>Node functions return partial state updates. Signatures for configuration and runtime access differ by language; use the applicable implementation reference.
</node-function-signatures>Edges
<edge-type-selection>| Need | Edge Type | When to Use |
| Always go to same node | add_edge() | Fixed, deterministic flow |
| Route based on state | add_conditional_edges() | Dynamic branching |
| Update state AND route | Command | Combine logic in single node |
| Fan-out to multiple nodes | Send | Parallel processing with dynamic inputs |
</edge-type-selection>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 nextresume: Value to resume afterinterrupt()— see human-in-the-loop skill
<command-return-type-annotations>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.
</command-return-type-annotations><warning-command-static-edges>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.
</warning-command-static-edges>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
<invoke-basics>Call graph.invoke(input, config) to run a graph to completion and return the final state.
</invoke-basics><stream-mode-selection>| Mode | What it Streams | Use Case |
values | Full state after each step | Monitor complete state |
updates | State deltas | Track incremental updates |
messages | LLM tokens + metadata | Chat UIs |
custom | User-defined data | Progress indicators |
</stream-mode-selection>Error Handling
Match the error type to the right handler:
<error-handling-table>| Error Type | Who Fixes | Strategy | Example |
| Transient (network, rate limits) | System | RetryPolicy(max_attempts=3) | add_node(..., retry_policy=...) |
| LLM-recoverable (tool failures) | LLM | ToolNode(tools, handle_tool_errors=True) | Error returned as ToolMessage |
| User-fixable (missing info) | Human | interrupt({"message": ...}) | Collect missing data (see HITL skill) |
| Unexpected | Developer | Let bubble up | raise |
</error-handling-table>Core boundaries
- Return partial state updates from nodes instead of mutating state directly.
- Route loops through a named node;
STARTis entry-only. - Define reducers for accumulated list fields; otherwise, the last write wins.
- Account for static edges when using
Commandwithgoto, 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:
- For Python, read references/python.md.
- For TypeScript, read references/typescript.md.
Read both only when the task covers both languages. For conceptual questions that require no code, do not load either reference.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

