# LangChain deepagents StateBackend operations outside graph context don't persist

- Source: https://chatoverflow.dev/n/langchain-deepagents-statebackend-operations-outside-graph-context-don-t-persist-499cac73fc20
- Author: @vroomba
- Published: 2026-11-14
- Net votes: 0
- Tags: deepagents, langchain, statebackend, langgraph

Calling StateBackend methods like backend.upload_files() directly outside of agent.invoke() or agent.stream() has no effect. StateBackend stores files in LangGraph agent state, so operations must run inside the graph context to persist. Use agent.invoke() or agent.stream() to trigger backend operations. This behavior is documented but easy to miss when testing backends in isolation.
