
Deep Agents Memory
Choose and wire the right Deep Agents file/memory backend so your agent can keep drafts, notes, and workspace files across a thread or across sessions.
Overview
deep-agents-memory is an agent skill for the Build phase that configures Deep Agents pluggable backends and FilesystemMiddleware for ephemeral, disk, and cross-session file memory.
Install
npx skills add https://github.com/langchain-ai/langchain-skills --skill deep-agents-memoryWhat is this skill?
- Backend selection table: StateBackend, FilesystemBackend, StoreBackend, CompositeBackend
- StateBackend for ephemeral thread-scoped files with thread_id
- StoreBackend for memory that survives across threads and sessions
- CompositeBackend to route paths between ephemeral and persistent stores
- FilesystemMiddleware tools: ls, read_file, write_file, edit_file, glob, grep
- 4 backend options in the selection table: State, Filesystem, Store, Composite
Adoption & trust: 9.3k installs on skills.sh; 782 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Deep Agent needs to read and write files, but you are unsure whether context should die with the thread, live on disk, or persist across sessions—and how to mix those modes safely.
Who is it for?
Indie builders shipping LangChain or LangGraph Deep Agents that manage multi-file context, working drafts, or session-spanning memory.
Skip if: One-shot create_agent chatbots with no file tools and no need to persist artifacts beyond a single prompt.
When should I use this skill?
INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access.
What do I get? / Deliverables
You implement the correct backend (State, Store, Filesystem, or Composite) so file tools work predictably and durable paths survive the handoffs your agent workflow requires.
- Chosen backend configuration (State, Store, Filesystem, or Composite)
- Working FilesystemMiddleware file tools on configured paths
Recommended Skills
Journey fit
Persistence and filesystem middleware are configured while you are implementing the agent harness, not during idea research or launch distribution. Agent-tooling is where LangGraph Deep Agents get FilesystemMiddleware, Store routing, and CompositeBackend path rules.
How it compares
Deep Agents storage-routing skill—not a generic vector-database RAG or document-ingestion pipeline.
Common Questions / FAQ
Who is deep-agents-memory for?
Solo and indie developers building Deep Agents who need thread-local scratch space, cross-session Store memory, or hybrid path routing without custom filesystem code.
When should I use deep-agents-memory?
Use it in Build while wiring agent-tooling whenever the agent must ls/read/write/edit/grep files, keep /draft.txt for one thread only, or retain notes after the thread ends.
Is deep-agents-memory safe to install?
Treat it like any agent skill that enables filesystem access: review the Security Audits panel on this Prism page and scope paths before pointing Store or disk backends at sensitive directories.
Workflow Chain
Requires first: deep agents core
SKILL.md
READMESKILL.md - Deep Agents Memory
<overview> Deep Agents use pluggable backends for file operations and memory: **Short-term (StateBackend)**: Persists within a single thread, lost when thread ends **Long-term (StoreBackend)**: Persists across threads and sessions **Hybrid (CompositeBackend)**: Route different paths to different backends FilesystemMiddleware provides tools: `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep` </overview> <backend-selection> | Use Case | Backend | Why | |----------|---------|-----| | Temporary working files | StateBackend | Default, no setup | | Local development CLI | FilesystemBackend | Direct disk access | | Cross-session memory | StoreBackend | Persists across threads | | Hybrid storage | CompositeBackend | Mix ephemeral + persistent | </backend-selection> <ex-default-state-backend> <python> Default StateBackend stores files ephemerally within a thread. ```python from deepagents import create_deep_agent agent = create_deep_agent() # Default: StateBackend result = agent.invoke({ "messages": [{"role": "user", "content": "Write notes to /draft.txt"}] }, config={"configurable": {"thread_id": "thread-1"}}) # /draft.txt is lost when thread ends ``` </python> <typescript> Default StateBackend stores files ephemerally within a thread. ```typescript import { createDeepAgent } from "deepagents"; const agent = await createDeepAgent(); // Default: StateBackend const result = await agent.invoke({ messages: [{ role: "user", content: "Write notes to /draft.txt" }] }, { configurable: { thread_id: "thread-1" } }); // /draft.txt is lost when thread ends ``` </typescript> </ex-default-state-backend> <ex-composite-backend-for-hybrid> <python> Configure CompositeBackend to route paths to different storage backends. ```python from deepagents import create_deep_agent from deepagents.backends import CompositeBackend, StateBackend, StoreBackend from langgraph.store.memory import InMemoryStore store = InMemoryStore() composite_backend = lambda rt: CompositeBackend( default=StateBackend(rt), routes={"/memories/": StoreBackend(rt)} ) agent = create_deep_agent(backend=composite_backend, store=store) # /draft.txt -> ephemeral (StateBackend) # /memories/user-prefs.txt -> persistent (StoreBackend) ``` </python> <typescript> Configure CompositeBackend to route paths to different storage backends. ```typescript import { createDeepAgent, CompositeBackend, StateBackend, StoreBackend } from "deepagents"; import { InMemoryStore } from "@langchain/langgraph"; const store = new InMemoryStore(); const agent = await createDeepAgent({ backend: (config) => new CompositeBackend( new StateBackend(config), { "/memories/": new StoreBackend(config) } ), store }); // /draft.txt -> ephemeral (StateBackend) // /memories/user-prefs.txt -> persistent (StoreBackend) ``` </typescript> </ex-composite-backend-for-hybrid> <ex-cross-session-memory> <python> Files in /memories/ persist across threads via StoreBackend routing. ```python # Using CompositeBackend from previous example config1 = {"configurable": {"thread_id": "thread-1"}} agent.invoke({"messages": [{"role": "user", "content": "Save to /memories/style.txt"}]}, config=config1) config2 = {"configurable": {"thread_id": "thread-2"}} agent.invoke({"messages": [{"role": "user", "content": "Read /memories/style.txt"}]}, config=config2) # Thread 2 can read file saved by Thread 1 ``` </python> <typescript> Files in /memories/ persist across threads via StoreBackend routing. ```typescript // Using CompositeBackend from previous example const config1 = { configurable: { thread_id: "thread-1" } }; await agent.invoke({ messages: [{ role: "user", content: "Save to /memories/style.txt" }] }, config1); const config2 = { configu