Deep AgentsDeep Agents 0.7 · Python 3.11+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
28 small wins to finish your pathNext lesson →

StoreBackend: files shared across threads

StoreBackend is a backend that keeps the agent's files in a LangGraph store under a namespace, so a file written on one thread can be read on any other thread that uses the same store.

Last updated: 29 Sep, 2026 · Deep Agents 0.7

StoreBackend: one file, two threads · from the Complete Deep Agents Course With LangChain · 74:54 to 79:05

The video's two-thread test

The third backend creates a persistent key-value store. The video builds an InMemoryStore, passes it as store=, and gives StoreBackend a namespace, a function that returns ("demo-user",). On thread one it writes /notes/todo.txt; on a second thread, with a new id, it asks for the file back and gets it. With an InMemoryStore the file is not on disk at all: it lives in memory, inside the store object, as an entry under the namespace. The video's code follows, run on Groq with the model line swapped, plus a loop that lists the store's keys:

ExampleAPI keyFrom the video, run on Groq
import uuid

from deepagents import create_deep_agent
from deepagents.backends import StoreBackend
from langchain.chat_models import init_chat_model
from langgraph.store.memory import InMemoryStore

store = InMemoryStore()
agent = create_deep_agent(
    model=init_chat_model("groq:openai/gpt-oss-120b", max_retries=6),
    backend=StoreBackend(namespace=lambda rt: ("demo-user",)),
    store=store,
)

thread_1 = {"configurable": {"thread_id": str(uuid.uuid4())}}
result = agent.invoke({"messages": [{"role": "user", "content": (
    "Create a file at /notes/todo.txt with exactly this content:\n"
    "1. Record video\n2. Edit video\n3. Upload video\n"
    "Then tell me you've done it.")}]}, config=thread_1)
print("--- Agent reply (thread 1) ---")
print(result["messages"][-1].content)

thread_2 = {"configurable": {"thread_id": str(uuid.uuid4())}}
followup = agent.invoke({"messages": [{"role": "user", "content": "Read /notes/todo.txt back to me verbatim."}]}, config=thread_2)
print("--- Read-back on a different thread ---")
print(followup["messages"][-1].content)

print("--- In the store ---")
for item in store.search(("demo-user",)):
    print(item.key)

What the two threads and the store show

  • Thread one wrote the file.
  • Thread two started with an empty conversation, yet read_file found the file: the store is outside any one thread.
  • The store's key is the file's path, under the demo-user namespace.

The StoreBackend call

python
from deepagents.backends import StoreBackend
from langgraph.store.memory import InMemoryStore

agent = create_deep_agent(
    model=model,
    backend=StoreBackend(namespace=lambda rt: ("demo-user",)),   # where in the store
    store=InMemoryStore(),                                       # the store itself
)

The namespace function receives the run's runtime, so in a real app it can return the user's id and keep each user's files apart.

The three backends compared

BackendLives inOther threads see itSurvives a restart
StateBackendThe thread's stateNoWith a saved checkpointer
FilesystemBackendYour diskYesYes
StoreBackendA LangGraph storeYesWith a persistent store, such as Postgres

Where StoreBackend fits

  • Per-user files that must follow a user into every new conversation.
  • Agents deployed on LangSmith, where a store is provided for you.
  • Shared notes several agents read and write.
Watch out. InMemoryStore is in memory: a restart empties it, and the "long-term" files are gone. Use a persistent store in production.
Try it yourself
  • Change the namespace to ("asha",) for a second agent on the same store and try to read the file.
  • Print item.value for the stored file to see how the content is kept.
  • Write a second file on thread two and list the store's keys again.

You understood something today that you didn't yesterday.