LangGraph state reducers
Picks the right reducer for each LangGraph state key, so parallel branches merge results instead of crashing.
What we improved
Fixed the keep latest reducer. LangGraph starts a reducer key at the empty value of its type, so the first call receives `{}` rather than `None`, and the original raised `KeyError: 'ts'`. It now checks `if not curr`, and the skill explains
Improved by YourAISkill from the original by agentsope, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Precise LangGraph reducer guidance with tested code, the Send and checkpointer traps, Overwrite resets and worked dilemma cases that fix real InvalidUpdateError bugs.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Tool skill for declaring reducers on LangGraph state keys so parallel writes merge instead of crashing. Activates whenever a coder agent designs a StateGraph with parallel branches, fan-out via Send, multi-agent topologies, or whenever a run raises `InvalidUpdateError: At key '<k>': Can receive only one value per step`. Encodes the rule "every state key is single-writer or has a reducer — nothing in between."
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: agentsop-state-reducer
description: Decide, for every key in a LangGraph state schema, whether it is single-writer or needs a reducer, and pick the right one, so parallel branches, Send fan-out and multi-agent graphs merge their writes instead of crashing or silently corrupting state. Covers add_messages, operator.add, tested custom reducers (keep latest, dedupe by id, collect then merge), resetting accumulators with Overwrite and RemoveMessage, why accumulated lists grow across runs on the same thread, and how to test the merge. Use when designing or changing a StateGraph with parallel branches, Send, supervisors or swarms, or when a run raises InvalidUpdateError "Can receive only one value per step".
version: 0.2.0
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by agentsope. See CHANGES.md. -->
# State Reducer · Tool Skill
> Scope: a single decision. For each state key, declare a reducer or
> guarantee a single writer. Out of scope: checkpointer choice, human in the
> loop design, supervisor vs. swarm topology.
All code below was run against LangGraph 1.2 (langchain-core 1.8) in December 2026.
---
## 1. Activation rules
Activate when **any** trigger fires:
- The task involves a LangGraph `StateGraph`, a `TypedDict`/`BaseModel` state
schema, or `Annotated[..., <reducer>]` typing.
- The graph has at least one of: parallel branches via static fan-out, the
`Send` API, multiple agents writing shared state, or a supervisor whose
workers return concurrently.
- The run raises `langgraph.errors.InvalidUpdateError` with a message like
`At key 'messages': Can receive only one value per step. Use an Annotated key to handle multiple values.`
- The user pastes a state schema and asks "why does this crash on parallel?"
or "do I need a reducer here?".
- The user is migrating a linear chain to a fan-out / map-reduce shape.
- A list in state keeps growing between runs on the same thread.
Do **not** add reducers where every key is written by exactly one node per
step (see §6: over-reducing single-writer keys is an anti-pattern).
---
## 2. Core mental model
...From agentsope's repository, MIT licence.
Related skills
-
Checked
Neuron AI RAG
Adds RAG to PHP apps with Neuron AI vector stores, embeddings and loaders so AI answers from your documents.
7/101 credit -
Checked
LlamaIndex RAG tuning
Builds and tunes LlamaIndex retrieval with working evals, so answers get better one measured step at a time.
8/101 credit -
Checked
Multi tenant RAG security
Enforces filtering at the vector store query in shared RAG systems, with a gate test, so tenants stay apart.
7/101 credit -
Checked
pgvector semantic search
Sets up pgvector in PostgreSQL with HNSW indexes and filters, so RAG and semantic search return fast.
8/101 credit -
Checked
RAG reindexing safety
Makes RAG ingestion safe to rerun, so reindexing stops leaving duplicate or deleted documents in results.
7/101 credit -
Checked
LanceDB Vector Search
Adds local vector and keyword search to your app with LanceDB, with no database server to run.
8/101 credit