Deep Agents is an agent harness. An opinionated, ready-to-run agent out of the box. Instead of wiring prompts, tools, and context management yourself, you get a working agent immediately and customize what you need.
What's included:
write_todos for task breakdown and progress trackingread_file, write_file, edit_file, ls, glob, grep for working memorytask for delegating work with isolated context windows[!NOTE] Looking for the Python package? See langchain-ai/deepagents.
npm install deepagents
# or
pnpm add deepagents
# or
yarn add deepagents
import { createDeepAgent } from "deepagents";
const agent = createDeepAgent();
const result = await agent.invoke({
messages: [
{
role: "user",
content: "Research LangGraph and write a summary in summary.md",
},
],
});
The agent can plan, read/write files, and manage longer tasks with sub-agents and filesystem tools.
[!TIP] For developing, debugging, and deploying AI agents and LLM applications, see LangSmith.
Add tools, swap models, and customize prompts as needed:
import { ChatOpenAI } from "@langchain/openai";
import { createDeepAgent } from "deepagents";
const agent = createDeepAgent({
model: new ChatOpenAI({ model: "gpt-5", temperature: 0 }),
tools: [myCustomTool],
systemPrompt: "You are a research assistant.",
});
See the JavaScript Deep Agents docs for full configuration options.
createDeepAgent returns a compiled LangGraph graph, so you can use streaming, Studio, checkpointers, and other LangGraph features.
Deep Agents follows a "trust the LLM" model. The agent can do anything its tools allow. Enforce boundaries at the tool/sandbox level, not by expecting the model to self-police. See the security policy for more information.
Base sandbox implementation with execute() as the only abstract method.
Backend that routes file operations to different backends based on path prefix.
Backend that reads and writes files directly from the filesystem.
LangSmith Sandbox backend for deepagents.
Filesystem backend with unrestricted local shell command execution.
Custom error class for sandbox operations.
Backend that stores files in agent state (ephemeral).
Backend that stores files in LangGraph's BaseStore (persistent).
Thrown when createDeepAgent receives invalid configuration.
Base sandbox implementation with execute() as the only abstract method.
Backend that routes file operations to different backends based on path prefix.
Backend that reads and writes files directly from the filesystem.
LangSmith Sandbox backend for deepagents.
Filesystem backend with unrestricted local shell command execution.
Custom error class for sandbox operations.
Backend that stores files in agent state (ephemeral).
Backend that stores files in LangGraph's BaseStore (persistent).
Thrown when createDeepAgent receives invalid configuration.
Create a Deep Agent.
Detect whether a model is an Anthropic model.
Adapt a v1 BackendProtocol to BackendProtocolV2.
Adapt a sandbox backend from v1 to v2 interface.
Group structured matches into the legacy dict form used by formatters.
Check if content is empty and return warning message.
Create a FileData object.
Convert FileData to plain string content.
Format file content with line numbers (cat -n style).
Format structured grep matches using existing formatting logic.
Format grep search results based on output mode.
Format file data for read response with line numbers.
Determine MIME type from a file path's extension.
Search files dict for paths matching glob pattern.
Return structured grep matches from an in-memory files mapping.
Search file contents for literal text pattern.
Type guard to check if FileData contains binary content (Uint8Array).
Type guard to check if FileData is v1 format (content as line array).
Check whether a MIME type represents text content.
Convert FileData to v2 format, joining v1 line arrays into a single string.
Perform string replacement with occurrence validation.
Sanitize tool_call_id to prevent path traversal and separator issues.
Truncate list or string result if it exceeds token limit (rough estimate: 4 chars/token).
Update FileData with new content, preserving creation timestamp.
Validate and normalize a file path for security.
Validate and normalize a directory path.
Type guard to check if a backend supports execution.
Type guard to check if a backend is a sandbox protocol (v1 or v2).
Create a Settings instance with detected environment.
Find the project root by looking for .git directory.
Compute summarization defaults based on model profile.
Create a completion callback middleware for async subagents.
Create filesystem middleware with all tools and features.
Create middleware for loading agent memory from AGENTS.md files.
Create middleware that enforces strict tool call / tool response parity in
Create backend-agnostic middleware for loading and exposing agent skills.
Create subagent middleware with task tool
Create summarization middleware with backend support for conversation history offloading.
Type guard to distinguish async SubAgents from sync SubAgents/CompiledSubAgents.
Type guard to check if a backend supports execution.
Type guard to check if a backend is a sandbox protocol (v1 or v2).
List skills from user and/or project directories.
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Adapt a v1 BackendProtocol to BackendProtocolV2.
Adapt a sandbox backend from v1 to v2 interface.
Create a Deep Agent.
Create a Settings instance with detected environment.
Find the project root by looking for .git directory.
Append text to a system message.
Create a preview of content showing head and tail with truncation marker.
Patch tool call / tool response parity in a messages array.
Prepend text to a system message.
Compute summarization defaults based on model profile.
Create a completion callback middleware for async subagents.
Create filesystem middleware with all tools and features.
Create middleware for loading agent memory from AGENTS.md files.
Create middleware that enforces strict tool call / tool response parity in
Create backend-agnostic middleware for loading and exposing agent skills.
Create subagent middleware with task tool
Create summarization middleware with backend support for conversation history offloading.
Type guard to distinguish async SubAgents from sync SubAgents/CompiledSubAgents.
List skills from user and/or project directories.
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Create middleware for loading agent-specific long-term memory.