Official agent skill

Deep Agents Memory

by langchain-ai in langchain-ai/langchain-skills

INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access.

OfficialMITAuto-check passedAgent Workflows

Install Deep Agents Memory

skills CLI
$ npx skills add langchain-ai/langchain-skills --skill deep-agents-memory -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install langchain-ai/langchain-skills deep-agents-memory --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/langchain-ai/langchain-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/config/skills/deep-agents-memory .claude/skills/deep-agents-memory && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
deep-agents-memory
GitHub stars
1.3k
Used in
1 other repo
Token cost
~2.5k tokens
SKILL.md length
362 words
Files
1
Skills in repo
22
Repo updated
First seen
Licence
MIT

At a glance

INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access.

  • Agent Workflows work in your project
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Deep Agents Memory is an agent skill from langchain-ai/langchain-skills, published by the product's own GitHub organization. INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows. It works with Python and TypeScript. The licence is MIT.

When your agent uses it

  • Agent Workflows work in your project

Example prompts

  • “/deep-agents-memory”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 16a992f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Deep Agents Memory loads about 2.5k tokens when it runs. Until then it costs about 56 tokens; SKILL.md has 362 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from langchain-ai/langchain-skills at commit 16a992f, republished under its MIT licence (© langchain-ai). 362 words, ~2,490 tokens.

Download SKILL.mdSave it as .claude/skills/deep-agents-memory/SKILL.md (or your agent's skills folder).
name
deep-agents-memory
description
INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.
<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 CaseBackendWhy
Temporary working filesStateBackendDefault, no setup
Local development CLIFilesystemBackendDirect disk access
Cross-session memoryStoreBackendPersists across threads
Hybrid storageCompositeBackendMix 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 = { configurable: { thread_id: "thread-2" } };
await agent.invoke({ messages: [{ role: "user", content: "Read /memories/style.txt" }] }, config2);
// Thread 2 can read file saved by Thread 1
</typescript>
</ex-cross-session-memory>
<ex-filesystem-backend-local-dev>
<python>
Use FilesystemBackend for local development with real disk access and human-in-the-loop.
python
from deepagents import create_deep_agent
from deepagents.backends import FilesystemBackend
from langgraph.checkpoint.memory import MemorySaver

agent = create_deep_agent(
    backend=FilesystemBackend(root_dir=".", virtual_mode=True),  # Restrict access
    interrupt_on={"write_file": True, "edit_file": True},
    checkpointer=MemorySaver()
)

# Agent can read/write actual files on disk
</python>
<typescript>
Use FilesystemBackend for local development with real disk access and human-in-the-loop.
typescript
import { createDeepAgent, FilesystemBackend } from "deepagents";
import { MemorySaver } from "@langchain/langgraph";

const agent = await createDeepAgent({
  backend: new FilesystemBackend({ rootDir: ".", virtualMode: true }),
  interruptOn: { write_file: true, edit_file: true },
  checkpointer: new MemorySaver()
});
</typescript>

Security: Never use FilesystemBackend in web servers - use StateBackend or sandbox instead. </ex-filesystem-backend-local-dev>

<ex-store-in-custom-tools>
<python>
Access the store directly in custom tools for long-term memory operations.
python
from langchain.tools import tool, ToolRuntime
from langchain.agents import create_agent
from langgraph.store.memory import InMemoryStore

@tool
def get_user_preference(key: str, runtime: ToolRuntime) -> str:
    """Get a user preference from long-term storage."""
    store = runtime.store
    result = store.get(("user_prefs",), key)
    return str(result.value) if result else "Not found"

@tool
def save_user_preference(key: str, value: str, runtime: ToolRuntime) -> str:
    """Save a user preference to long-term storage."""
    store = runtime.store
    store.put(("user_prefs",), key, {"value": value})
    return f"Saved {key}={value}"

store = InMemoryStore()

agent = create_agent(
    model="gpt-4.1",
    tools=[get_user_preference, save_user_preference],
    store=store
)
</python>
</ex-store-in-custom-tools>
<boundaries>
### What Agents CAN Configure
  • Backend type and configuration
  • Routing rules for CompositeBackend
  • Root directory for FilesystemBackend
  • Human-in-the-loop for file operations
Show full SKILL.md (137 more words)Show less
What Agents CANNOT Configure
  • Tool names (ls, read_file, write_file, edit_file, glob, grep)
  • Access files outside virtual_mode restrictions
  • Cross-thread file access without proper backend setup
    </boundaries>
<fix-storebackend-requires-store>
<python>
StoreBackend requires a store instance.
python
# WRONG
agent = create_deep_agent(backend=lambda rt: StoreBackend(rt))

# CORRECT
agent = create_deep_agent(backend=lambda rt: StoreBackend(rt), store=InMemoryStore())
</python>
<typescript>
StoreBackend requires a store instance.
typescript
// WRONG
const agent = await createDeepAgent({ backend: (c) => new StoreBackend(c) });

// CORRECT
const agent = await createDeepAgent({ backend: (c) => new StoreBackend(c), store: new InMemoryStore() });
</typescript>
</fix-storebackend-requires-store>
<fix-statebackend-files-dont-persist>
<python>
StateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.
python
# WRONG: thread-2 can't read file from thread-1
agent.invoke({"messages": [...]}, config={"configurable": {"thread_id": "thread-1"}})  # Write
agent.invoke({"messages": [...]}, config={"configurable": {"thread_id": "thread-2"}})  # File not found!
</python>
<typescript>
StateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.
typescript
// WRONG: thread-2 can't read file from thread-1
await agent.invoke({ messages: [...] }, { configurable: { thread_id: "thread-1" } });  // Write
await agent.invoke({ messages: [...] }, { configurable: { thread_id: "thread-2" } });  // File not found!
</typescript>
</fix-statebackend-files-dont-persist>
<fix-path-prefix-for-persistence>
<python>
Path must match CompositeBackend route prefix for persistence.
python
# With routes={"/memories/": StoreBackend(rt)}:
agent.invoke(...)  # /prefs.txt -> ephemeral (no match)
agent.invoke(...)  # /memories/prefs.txt -> persistent (matches route)
</python>
<typescript>
Path must match CompositeBackend route prefix for persistence.
typescript
// With routes: { "/memories/": StoreBackend }:
await agent.invoke(...);  // /prefs.txt -> ephemeral (no match)
await agent.invoke(...);  // /memories/prefs.txt -> persistent (matches route)
</typescript>
</fix-path-prefix-for-persistence>
<fix-production-store>
<python>
Use PostgresStore for production (InMemoryStore lost on restart).
python
# WRONG                              # CORRECT
store = InMemoryStore()              store = PostgresStore(connection_string="postgresql://...")
</python>
<typescript>
Use PostgresStore for production (InMemoryStore lost on restart).
typescript
// WRONG                                    // CORRECT
const store = new InMemoryStore();          const store = new PostgresStore({ connectionString: "..." });
</typescript>
</fix-production-store>
<fix-filesystem-backend-needs-virtual-mode>
<python>
Enable virtual_mode=True to restrict path access (prevents ../ and ~/ escapes).
python
backend = FilesystemBackend(root_dir="/project", virtual_mode=True)  # Secure
</python>
</fix-filesystem-backend-needs-virtual-mode>
<fix-longest-prefix-match>
<python>
CompositeBackend matches longest prefix first.
python
routes = {"/mem/": StoreBackend(rt), "/mem/temp/": StateBackend(rt)}
# /mem/file.txt -> StoreBackend, /mem/temp/file.txt -> StateBackend (longer match)
</python>
</fix-longest-prefix-match>

© langchain-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in config/skills/deep-agents-memory of langchain-ai/langchain-skills.

Open the folder on GitHubat commit 16a992f

Used in 2 other repositories

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in langchain-ai/langchain-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Deep Agents Memory next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Deep Agents Memory compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Deep Agents Memory this skilllangchain-ai/langchain-skills1.3k1 repos~2.5kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k64 repos~2.3kAutomated safety check: PassApache-2.0
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
Create MCP Serversglittercowboy/taches-cc-resources2k—~1.5kAutomated safety check: PassMIT
MCP BuilderLeastBit/Claude_skills_zh-CN588—~1.2kAutomated safety check: PassApache-2.0
Build MCP Serverbobmatnyc/claude-mpm155—~2kAutomated safety check: PassApache-2.0

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 64 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Create MCP Servers

    glittercowboy/taches-cc-resources

    Create Model Context Protocol (MCP) servers that expose tools, resources, and prompts to Claude.

    2k GitHub stars~1.5k tokensUpdated 6 mo ago
    Agent WorkflowsAuto-check passed
  • MCP Builder

    LeastBit/Claude_skills_zh-CN

    构建高质量 MCP(模型上下文协议)服务器的指南,使 LLM 能够通过精心设计的工具与外部服务交互。在使用 Python (FastMCP) 或 Node/TypeScript (MCP SDK) 构建 MCP 服务器以集成外部 API 或服务时使用。

    588 GitHub stars~1.2k tokensUpdated 8 mo ago
    Agent WorkflowsAuto-check passed
  • Build MCP Server

    bobmatnyc/claude-mpm

    Create high-quality MCP servers that enable LLMs to effectively interact with external services.

    155 GitHub stars~2k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/Kode-CLI

    Guide to designing and building MCP servers: tool, resource and prompt design for agent usability, with TypeScript or Python implementation workflows.

    5.2k GitHub stars~1.9k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed

More from langchain-ai/langchain-skills

All 22 skills in this repo
  • Agent Eval Engineering

    langchain-ai/langchain-skills

    Official

    Builds agent evaluations in stages: inspect the repository and traces, agree a Task Spec with you, then build, audit and run a Harbor task with an independent verifier.

    1.3k GitHub stars~4k tokensUpdated 2 days ago
    Auto-check passed
  • Langgraph Human In The Loop

    langchain-ai/langchain-skills

    Official

    INVOKE THIS SKILL when implementing human-in-the-loop patterns, pausing for approval, or handling errors in LangGraph.

    1.3k GitHub starsUsed in 2 repos~4.1k tokens
    Auto-check passed
  • Swarm Parallel Dispatch

    langchain-ai/langchain-skills

    Official

    Fans a list of independent items out to subagents in parallel, merges the results back into a table and supports retrying only the rows that failed.

    1.3k GitHub stars~3k tokensUpdated 2 days ago
    Auto-check passed
  • LangGraph Decision Models

    langchain-ai/langchain-skills

    Official

    Routes LangGraph agents with typed decision models that return probabilities, and finds LLM calls that only exist to produce a routing decision.

    1.3k GitHub stars~2.3k tokensUpdated 2 days ago
    Auto-check passed
  • Deep Agents Core

    langchain-ai/langchain-skills

    Official

    Explains how to build agents with the Deep Agents framework: create_deep_agent, the built-in middleware, the harness, SKILL.md format and configuration options.

    1.3k GitHub starsUsed in 1 repo~3.1k tokens
    Auto-check passed
  • Langchain Dependencies

    langchain-ai/langchain-skills

    Official

    INVOKE THIS SKILL when setting up a new project or when asked about package versions, installation, or dependency management for LangChain, LangGraph, LangSmith, or Deep Agents.

    1.3k GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check passed

Categories

Questions about Deep Agents Memory

What does Deep Agents Memory do?

INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Deep Agents Memory is an agent skill from langchain-ai/langchain-skills, published by the product's own GitHub organization. INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access.

When should I use Deep Agents Memory?

Deep Agents Memory fits situations like: agent Workflows work in your project.

How do I install Deep Agents Memory in Claude Code?

Run `npx skills add langchain-ai/langchain-skills --skill deep-agents-memory -a claude-code`. Or copy the skill folder (config/skills/deep-agents-memory in langchain-ai/langchain-skills) into .claude/skills/deep-agents-memory in your project. Claude Code loads it when a task matches its description.

How do I install Deep Agents Memory in Codex?

Run `npx skills add langchain-ai/langchain-skills --skill deep-agents-memory -a codex`. Or copy the skill folder (config/skills/deep-agents-memory in langchain-ai/langchain-skills) into .agents/skills/deep-agents-memory in your project. Codex loads it when a task matches its description.

Can I use Deep Agents Memory in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add langchain-ai/langchain-skills --skill deep-agents-memory -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/deep-agents-memory, .gemini/skills/deep-agents-memory, .github/skills/deep-agents-memory and .opencode/skills/deep-agents-memory in your project.

What does Deep Agents Memory need to run?

SKILL.md names no scripts, command-line tools or credentials: Deep Agents Memory is instructions for the agent only. Our summary lists: Python 3.

Does Deep Agents Memory access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Deep Agents Memory safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Deep Agents Memory use?

Deep Agents Memory is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Deep Agents Memory use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Deep Agents Memory?

Skills that share tags, products or a category with Deep Agents Memory: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), Create MCP Servers (glittercowboy/taches-cc-resources, 2k stars) and MCP Builder (LeastBit/Claude_skills_zh-CN, 588 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Deep Agents Memory?

langchain-ai (a GitHub organization, an official publisher) maintains it in langchain-ai/langchain-skills, which has 1,270 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on October 5, 2026.

Source: langchain-ai/langchain-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.