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 stores files in a LangSmith Hub agent repo (persistent).
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 stores files in a LangSmith Hub agent repo (persistent).
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.
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 a frozen HarnessProfile from user-provided options.
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.
Look up the HarnessProfile for a model spec string.
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 an untrusted JSON/YAML object into a validated
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Register a harness profile for a provider or specific model.
Serialize a HarnessProfile to a JSON-compatible object.
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.
Native transformer that correlates task tool calls into
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.
Evaluate permission rules against an operation + path and return the
Test whether path matches a glob pattern.
Canonicalize and validate an absolute path before permission checking.
Validate permission rule paths at setup time. Throws if any path is
Apply a profile's prompt overlay to a base prompt string.
Merge two harness profiles, layering override on top of base.
Normalize and validate a profile registry key.
Create a frozen HarnessProfile from user-provided options.
Look up the HarnessProfile for a model spec string.
Parse an untrusted JSON/YAML object into a validated
Register a harness profile for a provider or specific model.
Serialize a HarnessProfile to a JSON-compatible object.
Type guard: is this a fully-constructed HarnessProfile (frozen with
Apply a profile's prompt overlay to a base prompt string.
Create a frozen HarnessProfile from user-provided options.
Look up the HarnessProfile for a model spec string.
Merge two harness profiles, layering override on top of base.
Parse an untrusted JSON/YAML object into a validated
Register a harness profile for a provider or specific model.
Serialize a HarnessProfile to a JSON-compatible object.
List skills from user and/or project directories.
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Native transformer that correlates task tool calls into
Detect whether a model is an Anthropic model.
Create middleware for loading agent-specific long-term memory.
Updated protocol for pluggable memory backends.
Result from backend edit operations.
Result of code execution.
Result of a single file download operation.
Structured file listing info.
Result of a single file upload operation.
Structured result from backend glob operations.
Structured grep match entry.
Structured result from grep/search operations.
Options for capturing a snapshot from a running sandbox.
Options for the LangSmithSandbox.create() static factory.
Options for constructing a LangSmithSandbox from an existing Sandbox instance.
Represents a sandbox snapshot.
Options for starting a stopped sandbox.
Options for creating a LocalShellBackend instance.
Structured result from backend ls operations.
Structured result from backend readRaw operations.
Structured result from backend read operations.
Protocol for sandboxed backends with isolated runtime.
Options for deleting a sandbox.
Options for getting or creating a sandbox.
Metadata for a single sandbox instance.
Options for listing sandboxes.
Paginated response from a sandbox list operation.
Context provided to dynamic namespace factory functions.
Options for StoreBackend constructor.
Result from backend write operations.
Settings interface for project detection and path management.
Options for creating a Settings instance.
Options for the agent memory middleware.
Specification for an async subagent running on a remote Agent Protocol
Options for creating async subagent middleware.
A tracked async subagent task persisted in agent state.
Updated protocol for pluggable memory backends.
Type definitions for pre-compiled agents.
Options for creating the completion callback middleware.
Result from backend edit operations.
Result of code execution.
Result of a single file download operation.
Structured file listing info.
Options for creating filesystem middleware.
A single filesystem permission rule.
Result of a single file upload operation.
Configuration for the auto-added general-purpose subagent.
Structured result from backend glob operations.
Structured grep match entry.
Structured result from grep/search operations.
Frozen runtime harness profile that shapes agent behavior at
User-facing options for creating a HarnessProfile.
Options for the LangSmithSandbox.create() static factory.
Options for constructing a LangSmithSandbox from an existing Sandbox instance.
Options for listing skills.
Metadata for a skill per Agent Skills spec.
Options for creating a LocalShellBackend instance.
Structured result from backend ls operations.
Options for the memory middleware.
Structured result from backend readRaw operations.
Structured result from backend read operations.
Protocol for sandboxed backends with isolated runtime.
Options for deleting a sandbox.
Options for getting or creating a sandbox.
Metadata for a single sandbox instance.
Options for listing sandboxes.
Paginated response from a sandbox list operation.
Metadata for a skill per Agent Skills specification.
Options for the skills middleware.
Context provided to dynamic namespace factory functions.
Options for StoreBackend constructor.
Specification for a subagent that can be dynamically created.
Options for creating subagent middleware
Result from backend write operations.
Configuration parameters for creating a Deep Agent
DeepAgent extends ReactAgent with additional subagent type information.
Type bag that extends AgentTypeConfig with subagent type information.
Default type configuration for deep agents.
Settings interface for project detection and path management.
Options for creating a Settings instance.
Represents a single subagent invocation observed during a deep agent run.
Context size specification for summarization triggers and retention policies.
Options for the summarization middleware.
Settings for truncating large tool arguments in old messages.
Specification for an async subagent running on a remote Agent Protocol
Options for creating async subagent middleware.
A tracked async subagent task persisted in agent state.
Type definitions for pre-compiled agents.
Options for creating the completion callback middleware.
Options for creating filesystem middleware.
Options for the memory middleware.
Metadata for a skill per Agent Skills specification.
Options for the skills middleware.
Specification for a subagent that can be dynamically created.
Options for creating subagent middleware
A single filesystem permission rule.
Configuration for the auto-added general-purpose subagent.
Frozen runtime harness profile that shapes agent behavior at
User-facing options for creating a HarnessProfile.
Options for resolving a harness profile from model metadata.
Configuration for the auto-added general-purpose subagent.
Frozen runtime harness profile that shapes agent behavior at
User-facing options for creating a HarnessProfile.
Options for listing skills.
Metadata for a skill per Agent Skills spec.
Represents a single subagent invocation observed during a deep agent run.
Configuration parameters for creating a Deep Agent
DeepAgent extends ReactAgent with additional subagent type information.
Type bag that extends AgentTypeConfig with subagent type information.
Default type configuration for deep agents.
Protocol for pluggable memory backends (single, unified).
Agent Runtime with state
Protocol for sandboxed backends with isolated runtime.
State and store container for backend initialization.
Protocol for pluggable memory backends (single, unified).
Agent Runtime with state
Protocol for sandboxed backends with isolated runtime.
State and store container for backend initialization.
Union of v1 and v2 backend protocols.
Union of v1 and v2 file data formats.
Standardized error codes for file upload/download operations.
Common error codes shared across all sandbox provider implementations.
Error codes for ConfigurationError.
Union of v1 and v2 backend protocols.
Possible statuses for an async subagent task.
Union of v1 and v2 file data formats.
Standardized error codes for file upload/download operations.
The filesystem operations a permission rule can govern.
TypeScript type inferred from the Zod config schema.
Whether a matched rule permits or blocks the operation.
Common error codes shared across all sandbox provider implementations.
Any subagent specification — sync, compiled, or async.
Error codes for ConfigurationError.
An AgentRunStream with native deep-agent projections assigned
Helper type to extract middleware from a SubAgent definition
Helper type to flatten and merge middleware from all subagents
Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.
Utility type to extract the parsed response type from a ResponseFormat strategy.
Helper type to extract a subagent by name from a DeepAgent.
Helper type to merge states from subagent middleware
Helper type to extract the ReactAgent type from a subagent definition.
Combined state type including custom middleware and subagent middleware states
Helper type to resolve a DeepAgentTypeConfig from either:
Union of all response format types accepted by createDeepAgent.
Represents a summarization event that tracks what was summarized and where the cutoff is.
Possible statuses for an async subagent task.
The filesystem operations a permission rule can govern.
Whether a matched rule permits or blocks the operation.
TypeScript type inferred from the Zod config schema.
TypeScript type inferred from the Zod config schema.
An AgentRunStream with native deep-agent projections assigned
A typed SubagentRunStream variant for a single subagent spec.
Extract the output state type from a subagent spec.
Discriminated union of SubagentRunStream variants, one per
Extract the tools tuple from a subagent spec.
Any subagent specification — sync, compiled, or async.
Helper type to extract middleware from a SubAgent definition
Helper type to flatten and merge middleware from all subagents
Helper type to extract CompiledSubAgent (subagents with runnable) from a DeepAgent.
Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract SubAgent (subagents with middleware) from a DeepAgent.
Utility type to extract the parsed response type from a ResponseFormat strategy.
Helper type to extract a subagent by name from a DeepAgent.
Helper type to merge states from subagent middleware
Helper type to extract the ReactAgent type from a subagent definition.
Combined state type including custom middleware and subagent middleware states
Helper type to resolve a DeepAgentTypeConfig from either:
Union of all response format types accepted by createDeepAgent.
Factory function type for creating backend instances.
Factory function type for creating backend instances.