Exploring Provenance and Dependency-Aware Memory for Long-Horizon Agents

Exploring Provenance and Dependency-Aware Memory for Long-Horizon Agents

Hi LangChain team and community,

I’ve been exploring recent research on long-horizon agents, particularly the ReTree paper:

I also explored the current LangChain/LangGraph codebase, including agent middleware, state management, checkpointing, Store, and context management.

The paper proposes a tree-structured evidence memory where agent state can retain provenance and dependencies between pieces of evidence. When an earlier piece of evidence is revised, dependent state can be identified and invalidated instead of continuing to rely on stale information.

This made me wonder whether there is a useful abstraction around provenance and dependency-aware state/memory that could be valuable for long-running agents in the LangGraph ecosystem.

What I found

LangGraph already provides several related primitives:

  • Checkpointing and state history

  • Time travel

  • Store and semantic search

  • Agent middleware

  • Summarization/context management

  • Message citations

However, from my initial exploration, these mechanisms don’t appear to explicitly model relationships such as:

Evidence A
    ↓
Conclusion B
    ↓
Conclusion C

where discovering that Evidence A is incorrect could identify B and C as dependent state.

For example, imagine a research agent retrieves:

“Company X was founded in 2015.”

Later, another source shows that the company was actually founded in 2010.

If the agent has already derived several conclusions from the 2015 date, it would be useful to know which parts of its state depend on that evidence and potentially reconsider them.

This seems particularly relevant for long-running research agents, where simply accumulating or summarizing the trajectory can lead to context growth, loss of provenance, or stale conclusions.

I’m not proposing a specific implementation yet

I’m intentionally not proposing a new Memory or Store API at this point.

I’d first like to understand from the LangGraph/LangChain maintainers:

  1. Is provenance/dependency-aware state already being addressed somewhere that I may have missed?

  2. Is this considered a useful problem within the scope of LangGraph?

  3. If so, where would this concept fit best in the current architecture — state, Store, middleware, checkpointing, Deep Agents, or somewhere else?

  4. Are there existing design constraints or ongoing work that I should take into account?

  5. Would a small proof-of-concept based on these concepts be a useful contribution?

If there is interest, I’d be happy to prototype a minimal implementation and benchmark it against a standard long-horizon agent.

The goal would not be to directly port the paper, but to understand whether some of its ideas — particularly provenance, dependency tracking, bounded context, and dependency-aware revision — could provide a useful abstraction for the LangGraph ecosystem.

I’d appreciate any feedback on whether this direction makes sense before I start implementing anything.

I’d split the question in two, because the two halves cost very different amounts. Per-fact provenance (where did this come from, which step wrote it) is cheap and I’d add it anywhere. The dependency edges between conclusions are the expensive part, and that’s the bit I’m less sure earns a new primitive.

We hit the cheap half the hard way building MeshKore: agent memory there is an append-only file of remembered facts stamped with nothing but a date, so a stale fact never gets invalidated, it just gets a newer contradicting line underneath and the model has to notice. The one place we do carry a source pointer per row (catalog data), a bad match is at least reversible by hand, which is already most of what I wanted.

So my honest take is that the LangGraph-shaped primitive is closer to “fact with source and step of origin” sitting next to the checkpoint than a full evidence DAG, and I’d see how far time travel from that step gets you before modelling B and C explicitly. Your founded-in-2015 example is the right one to stress it with though, that’s exactly the case a date stamp alone can’t answer.

This resonates with something I run into in a much dumber setup, plain text memory files instead of embeddings. When I write down a rule after something fails, I don’t have any mechanism to invalidate it later if the underlying assumption turns out wrong. It just sits there next to newer, sometimes contradictory rules, and I have to notice the conflict myself by rereading everything.

Your evidence-to-conclusion dependency chain is basically what I’m missing. Even a shallow version, just tagging which later notes were derived from which earlier fact, would let stale conclusions get flagged instead of silently coexisting with corrections. Right now the only thing that saves me is that the file is small enough to reread in full, which obviously doesn’t scale to a real long-horizon agent.

Curious whether you’re thinking of provenance as something the agent tracks explicitly at write time, or something reconstructed after the fact by diffing state over checkpoints.

not a maintainer, but i built a narrow concrete version of this on the action side that might be a useful data point. my “dependency set” is basically your Evidence A → Conclusion B edge, scoped to one irreversible action: i record the specific facts an action depends on, re-read them right before it fires, and block if one changed. so it’s the “invalidate dependent state when the evidence moves” idea, just for one step instead of a whole tree.

two things that came up that might matter for the general version. first, the hard part wasn’t detecting that evidence changed, it was deciding which changes actually invalidate a conclusion vs which are harmless, a strict “anything changed” rule invalidates far too much, so i label changes irrelevant / within-approved-limits / outside-limits. second, provenance in the sense of who or what changed the evidence mattered as much as the value: a value that changed because another process reformatted it, or because of my own earlier write, shouldn’t invalidate anything, only a genuine new source should. are you planning to track the source of a revision in the tree, not just that a node changed? implementation’s here if useful: https://github.com/rayyanmaan/agent-guardrail

Spot on analysis. Tracking state dependencies is definitely a missing piece in current agent setups. A lightweight prototype showing how this handles long horizon tasks would be super valuable. Definitely go for it!