# How does persistence layer handle changes to state over time?

**URL:** <https://forum.langchain.com/t/how-does-persistence-layer-handle-changes-to-state-over-time/2012>\
**Category:** LangGraph\
**Tags:** python-help\
**Created:** [October 29, 2025, 10:45pm UTC](https://forum.langchain.com/t/how-does-persistence-layer-handle-changes-to-state-over-time/2012 "2025-10-29T22:45:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryce-cc-dunn](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/bryce-cc-dunn/32/1436_2.png) [@bryce-cc-dunn](https://forum.langchain.com/u/bryce-cc-dunn)\
**Post date:** [October 29, 2025, 10:45pm UTC](https://forum.langchain.com/t/how-does-persistence-layer-handle-changes-to-state-over-time/2012/1 "2025-10-29T22:45:30Z")

</div>

Hi looking for some guidance to see if there are any established patterns for solving an issue we’re having building an agent. (this is a simplified example).

**Agent Setup**  
We have an agent that has a state\_schema of:

```python
class AgentState(AgentState):
    item_color: str
    item_size: str

```

And that agent is created with an `AsyncPostgresSaver` from `langgraph.checkpoint.postgres.aio`

```python
# pseudocode
checkpointer = AsyncPostgresSaver(db_connection_here)

agent = create_agent(
  prompt...
  tools...
  state_schema=AgentState
).compile(checkpointer=checkpointer)

```

Our agent can reference and update these the item\_color and item\_size through various tools.

**Agent Use**

So a conversation might start out and the agent might save item details as:

```python
item_color = 'blue'
item_size = 'large'

```

A user could resume that conversation (thread) at a later date and ask about the item, and the agent could look at the state, and let the user know what the item details are. All is well.

**Agent Modification**

But down the line, we decide as a dev team that the AgentState isn’t sufficient as is, we need to expand it like so:

```python
class Item():
    item_color: str
    item_size: str
    item_type: str

class AgentState(AgentState):
    items: List[Item]

```

Now our system is built to support tracking of multiple items, and our state is updated to reflect that. The agent now has tools that can reason about two items, comparing them and such.

If we start a new conversation with this updated agent, it works as expected.

**Previous Conversations with New State**

But how do we handle old conversations? We don’t want to break all chats that are saved for users currently. But if a user tries to resume a chat that existed with the old `item_color, item_size` state, then our tools won’t properly be able to get item information because they are expected a `items` key with an array of item details.

* * *

This is a contrived example above but the principle is how are state/graph changes handled over time for existing threads/checkpoints? We are using the provided AsyncPostgresSaver and one idea we had was to run a custom db migration to update all the `item_color, item_size` info to the update state object (`items`). But the checkpointer library stores things across tables in blobs… I think we’re nervous about the risk of trying to accomplish that.

Anyone else run into this or know of documentation or solutions to this problem? This isn’t a one-time concern either, maybe in the future we update the state to be a higher level `products` which might include `items` as one type, and then we run into the same issue.

Thanks in advance!
