langchainmemoryrouting

LangChain Agent Amnesia: The Routing Fix in 2026

An r/LangChain post jumped from 48% to 94% task success. Two failures conflated as one symptom; both fixes ship in a day.

5 min read

An r/LangChain post titled "Your LangChain agent has amnesia. I built the routing layer that existing observability tools aren't solving yet" described a 48% to 94% jump in task success rate after adding a routing layer. The structural insight is worth unpacking even if the post-author's specific product isn't the only fix.

Two failure modes packaged as one symptom

"Amnesia" in production agents is two things usually conflated:

  • Cross-turn memory failure. The agent forgets prior tool calls or user constraints between turns.
  • Tool routing failure. The agent picks the wrong tool from a long attached list, even when memory works.

The post specifically frames the fix as a routing layer. That solves the second; the first needs a different fix.

Fix 1: Cross-turn memory via LangGraph state

LangGraph ships a checkpointer that persists state between turns. SQLite for dev, Postgres for prod. The thread_id parameter scopes memory per conversation.

Python
from langgraph.checkpoint.postgres import PostgresSaver
from langgraph.graph import StateGraph

checkpointer = PostgresSaver.from_conn_string(POSTGRES_URL)
graph = builder.compile(checkpointer=checkpointer)

# Each thread_id is a separate conversation memory
config = {'configurable': {'thread_id': 'user-42'}}
result = graph.invoke({'messages': [...]}, config=config)

Fix 2: Tool routing via semantic naming

The post's 48 to 94 jump is largely from unambiguous tool surfacing. The principle: tools with semantic names (web_search, reddit_search, youtube_search) score higher than generic ones (search_v1, fetch_url, do_thing) on the same agent loop.

Scavio's MCP exposes tools with semantic names already: search, reddit_search, youtube_search, amazon_search, walmart_search, extract. Wiring this MCP gives an agent unambiguous tools by construction.

Bash
# Attach Scavio MCP to Claude Code
claude mcp add scavio https://mcp.scavio.dev/mcp \
  --header 'x-api-key: $SCAVIO_API_KEY'

# Now the agent has 6 named tools the LLM routes correctly

The combined stack

For LangChain production agents:

  • LangGraph + Postgres checkpointer for cross-turn memory
  • Scavio (langchain-scavio package) for semantically-named tools
  • Mem0 or Letta for long-term memory across sessions (if needed)

Why naming alone fixes so much

Agent loops in 2024 attached every tool the team had, treating the LLM's tool-selection as infinite. Empirically it isn't — past 8-10 attached tools with overlapping descriptions, the LLM picks wrong often enough to break the agent.

Two changes that compound:

  • Cap attached tools to 4-6 per intent (filter the list)
  • Name tools by surface + action (reddit_search, not search)

These two together do more for routing accuracy than any LLM upgrade.

What the post's product adds

The post-author's routing layer adds explicit scaffolding: per-intent tool filtering, prior-call weighting, custom routing rules. That is real work and worth the layer for high-stakes production agents.

For most teams, the simpler combo (LangGraph state + Scavio MCP's pre-named tools + tool-list discipline) captures most of the gain without a custom routing layer to maintain.

The honest take

"Amnesia" is a useful diagnostic. The fix is rarely a bigger LLM. It is state plus naming. Both are cheap; both ship in a day.