deepagents
LangChain Deep Agents framework for building autonomous coding agents. Use for agent harness, backends, subagents, human-in-the-loop, long-term memory, middleware, and CLI-based agent development.
What this skill does
# Deepagents Skill
Langchain deep agents framework for building autonomous coding agents. use for agent harness, backends, subagents, human-in-the-loop, long-term memory, middleware, and cli-based agent development., generated from official documentation.
## When to Use This Skill
This skill should be triggered when:
- Working with deepagents
- Asking about deepagents features or APIs
- Implementing deepagents solutions
- Debugging deepagents code
- Learning deepagents best practices
## Quick Reference
### Common Patterns
**Pattern 1:** Docs by LangChain home pageLangChain + LangGraphSearch...⌘KSupportGitHubTry LangSmithTry LangSmithSearch...NavigationCore capabilitiesBackendsLangChainLangGraphDeep AgentsIntegrationsLearnReferenceContributePythonOverviewGet startedQuickstartCustomizationCore capabilitiesAgent harnessBackendsSubagentsHuman-in-the-loopLong-term memoryMiddlewareCommand line interfaceUse the CLIOn this pageQuickstartBuilt-in backendsStateBackend (ephemeral)FilesystemBackend (local disk)StoreBackend (LangGraph store)CompositeBackend (router)Specify a backendRoute to different backendsUse a virtual filesystemAdd policy hooksProtocol referenceCore capabilitiesBackendsCopy pageChoose and configure filesystem backends for deep agents. You can specify routes to different backends, implement virtual filesystems, and enforce policies.Copy pageDeep agents expose a filesystem surface to the agent via tools like ls, read_file, write_file, edit_file, glob, and grep. These tools operate through a pluggable backend. This page explains how to choose a backend, route different paths to different backends, implement your own virtual filesystem (e.g., S3 or Postgres), add policy hooks, and comply with the backend protocol. Quickstart Here are a few pre-built filesystem backends that you can quickly use with your deep agent: Built-in backendDescriptionDefaultagent = create_deep_agent() Ephemeral in state. The default filesystem backend for an agent is stored in langgraph state. Note that this filesystem only persists for a single thread.Local filesystem persistenceagent = create_deep_agent(backend=FilesystemBackend(root_dir="/Users/nh/Desktop/")) This gives the deep agent access to your local machine’s filesystem. You can specify the root directory that the agent has access to. Note that any provided root_dir must be an absolute path.Durable store (LangGraph store)agent = create_deep_agent(backend=lambda rt: StoreBackend(rt)) This gives the agent access to long-term storage that is persisted across threads. This is great for storing longer term memories or instructions that are applicable to the agent over multiple executions.CompositeEphemeral by default, /memories/ persisted. The Composite backend is maximally flexible. You can specify different routes in the filesystem to point towards different backends. See Composite routing below for a ready-to-paste example. Built-in backends StateBackend (ephemeral) Copy# By default we provide a StateBackend agent = create_deep_agent() # Under the hood, it looks like from deepagents.backends import StateBackend agent = create_deep_agent( backend=(lambda rt: StateBackend(rt)) # Note that the tools access State through the runtime.state ) How it works: Stores files in LangGraph agent state for the current thread. Persists across multiple agent turns on the same thread via checkpoints. Best for: A scratch pad for the agent to write intermediate results. Automatic eviction of large tool outputs which the agent can then read back in piece by piece. FilesystemBackend (local disk) Copyfrom deepagents.backends import FilesystemBackend agent = create_deep_agent( backend=FilesystemBackend(root_dir=".", virtual_mode=True) ) How it works: Reads/writes real files under a configurable root_dir. You can optionally set virtual_mode=True to sandbox and normalize paths under root_dir. Uses secure path resolution, prevents unsafe symlink traversal when possible, can use ripgrep for fast grep. Best for: Local projects on your machine CI sandboxes Mounted persistent volumes StoreBackend (LangGraph store) Copyfrom langgraph.store.memory import InMemoryStore from deepagents.backends import StoreBackend agent = create_deep_agent( backend=(lambda rt: StoreBackend(rt)), # Note that the tools access Store through the runtime.store store=InMemoryStore() ) How it works: Stores files in a LangGraph BaseStore provided by the runtime, enabling cross‑thread durable storage. Best for: When you already run with a configured LangGraph store (for example, Redis, Postgres, or cloud implementations behind BaseStore). When you’re deploying your agent through LangSmith Deployment (a store is automatically provisioned for your agent). CompositeBackend (router) Copyfrom deepagents import create_deep_agent from deepagents.backends import CompositeBackend, StateBackend, StoreBackend from langgraph.store.memory import InMemoryStore composite_backend = lambda rt: CompositeBackend( default=StateBackend(rt), routes={ "/memories/": StoreBackend(rt), } ) agent = create_deep_agent( backend=composite_backend, store=InMemoryStore() # Store passed to create_deep_agent, not backend ) How it works: Routes file operations to different backends based on path prefix. Preserves the original path prefixes in listings and search results. Best for: When you want to give your agent both ephemeral and cross-thread storage, a CompositeBackend allows you provide both a StateBackend and StoreBackend When you have multiple sources of information that you want to provide to your agent as part of a single filesystem. e.g. You have long-term memories stored under /memories/ in one Store and you also have a custom backend that has documentation accessible at /docs/. Specify a backend Pass a backend to create_deep_agent(backend=...). The filesystem middleware uses it for all tooling. You can pass either: An instance implementing BackendProtocol (for example, FilesystemBackend(root_dir=".")), or A factory BackendFactory = Callable[[ToolRuntime], BackendProtocol] (for backends that need runtime like StateBackend or StoreBackend). If omitted, the default is lambda rt: StateBackend(rt). Route to different backends Route parts of the namespace to different backends. Commonly used to persist /memories/* and keep everything else ephemeral. Copyfrom deepagents import create_deep_agent from deepagents.backends import CompositeBackend, StateBackend, FilesystemBackend composite_backend = lambda rt: CompositeBackend( default=StateBackend(rt), routes={ "/memories/": FilesystemBackend(root_dir="/deepagents/myagent", virtual_mode=True), }, ) agent = create_deep_agent(backend=composite_backend) Behavior: /workspace/plan.md → StateBackend (ephemeral) /memories/agent.md → FilesystemBackend under /deepagents/myagent ls, glob, grep aggregate results and show original path prefixes. Notes: Longer prefixes win (for example, route "/memories/projects/" can override "/memories/"). For StoreBackend routing, ensure the agent runtime provides a store (runtime.store). Use a virtual filesystem Build a custom backend to project a remote or database filesystem (e.g., S3 or Postgres) into the tools namespace. Design guidelines: Paths are absolute (/x/y.txt). Decide how to map them to your storage keys/rows. Implement ls_info and glob_info efficiently (server-side listing where available, otherwise local filter). Return user-readable error strings for missing files or invalid regex patterns. For external persistence, set files_update=None in results; only in-state backends should return a files_update dict. S3-style outline: Copyfrom deepagents.backends.protocol import BackendProtocol, WriteResult, EditResult from deepagents.backends.utils import FileInfo, GrepMatch class S3Backend(BackendProtocol): def __init__(self, bucket: str, prefix: str = ""): self.bucket = bucket self.prefix = prefix.rstrip("/") def _key(self, path: str) -> str: return f"{self.prefix}{path}" def ls_info(self, path: str) -> list[FRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.