agentsop-state-reducer

Resolve LangGraph InvalidUpdateError by defining per-key reducer semantics.

287|16|Updated May 20, 2026
One-click install
npx skills add https://github.com/agentsope/SkillAlchemy --skill agentsop-state-reducer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agentsop-state-reducer
Source: https://github.com/agentsope/SkillAlchemy/tree/main/skills/agentsop-state-reducer
Command: npx skills add https://github.com/agentsope/SkillAlchemy --skill agentsop-state-reducer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents LangGraph from crashing when multiple parallel branches (or multi-agent writes) update the same state key in a single step.

Core Features & Use Cases

  • State-key merge contracts: Teaches how to declare per-key reducer semantics so parallel writes merge instead of throwing InvalidUpdateError.
  • Reducer selection playbook: Maps common key types (messages, counters, lists) to the right reducer patterns like add_messages and operator.add.
  • Test-and-document workflow: Guides you to enumerate writers per key, pick a reducer, validate with a probe test, and document the contract in your state schema.

Quick Start

Ask the Skill for the correct reducer to apply after you paste your LangGraph state schema and describe which nodes write to the same key in parallel.

Frequently Asked Questions about agentsop-state-reducer

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

FAQPage Schema
Why does LangGraph throw an InvalidUpdateError during parallel state writes?

LangGraph raises an InvalidUpdateError when multiple parallel branches or multi-agent workers attempt to update the same state key concurrently in a single step without a defined merge strategy.

How do I fix concurrent state update conflicts in a LangGraph multi-agent topology?

To fix concurrent state update conflicts in LangGraph, define per-key reducer semantics in your StateGraph schema so parallel writes merge deterministically instead of crashing the graph.

What is the correct reducer for merging message lists in LangGraph?

For merging message lists in LangGraph, the add_messages reducer is the standard pattern, while operator.add is typically selected for appending counters or standard list types.

How do I prevent state crashes when using Send-based map reduce patterns in LangGraph?

To prevent state crashes with Send-based map reduce patterns in LangGraph, enumerate which writer nodes update each shared key and assign a pure reducer to that key in your TypedDict schema.

Does every shared state key in a LangGraph StateGraph need a custom reducer?

Only shared state keys targeted by concurrent parallel writes require a custom reducer. Keys updated sequentially or by a single writer node do not need explicit reducer semantics to avoid InvalidUpdateError.