deep-agents

$npx mdskill add langchain-ai/docs/deep-agents

Build agents with planning, context, subagents, and sandboxed execution.

  • Handles complex multi-step tasks with automatic planning and subagent delegation.
  • Built on LangChain and LangGraph for core agent capabilities.
  • Uses a virtual filesystem for context management and task planning.
  • Delivers results via sandboxed code execution and terminal agent interfaces.

SKILL.md

.github/skills/deep-agentsView on GitHub ↗
---
name: deep-agents
description: Build batteries-included agents with planning, context management, subagent delegation, and sandboxed execution. Use for complex, multi-step tasks that need built-in capabilities.
license: MIT
compatibility: Python 3.10+, Node.js 22+. Requires a model that supports tool calling.
metadata:
  author: langchain-ai
  version: "1.0"
---

# Deep Agents

Deep Agents is the easiest way to start building agents powered by LLMs—with built-in capabilities for task planning, file systems for context management, subagent delegation, and long-term memory. It is an "agent harness" built on [LangChain](https://docs.langchain.com/oss/langchain/overview) core building blocks and the [LangGraph](https://docs.langchain.com/oss/langgraph/overview) runtime.

## When to use

Use Deep Agents when you need to:
- **Build agents fast** with sensible defaults and minimal configuration
- **Handle complex, multi-step tasks** that benefit from automatic planning
- **Manage context** with a built-in virtual filesystem for large inputs
- **Delegate subtasks** to specialized subagents
- **Run code safely** in sandboxed execution environments
- **Use a terminal agent** via Deep Agents Code

## When NOT to use

- For simple tool-calling agents without planning or subagents, use [LangChain](https://docs.langchain.com/oss/langchain/overview) agents instead—lighter weight
- For custom graph-based orchestration with explicit control flow, use [LangGraph](https://docs.langchain.com/oss/langgraph/overview) directly
- Deep Agents is the **highest-level abstraction**—it trades flexibility for convenience

## Install

```bash
# Python
pip install deepagents

# JavaScript/TypeScript
npm install deepagents langchain @langchain/core
```

## Quick reference

### Create a deep agent

```python
# pip install deepagents langchain-anthropic
from deepagents import create_deep_agent

def get_weather(city: str) -> str:
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

agent = create_deep_agent(
    model="anthropic:claude-sonnet-4-6",
    tools=[get_weather],
    system_prompt="You are a helpful assistant",
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What is the weather in SF?"}]}
)
```

### Use Deep Agents Code

```bash
# Install Deep Agents Code
pip install deepagents-code

# Run an interactive terminal agent
deepagents
```

### Built-in capabilities

| Capability | Description |
|-----------|-------------|
| Planning | Automatic task decomposition for complex requests |
| File system | Virtual filesystem for reading, writing, and managing context |
| Subagents | Spawn child agents for parallel subtask execution |
| Context management | Automatic context compression for long conversations |
| Sandboxed execution | Run code in isolated environments (Modal, Runloop, Daytona) |
| Protocols | ACP, MCP, and A2A support for interoperability |

## Key documentation

- [Overview](https://docs.langchain.com/oss/python/deepagents/overview)—What Deep Agents is and how it compares to LangChain and LangGraph
- [Quickstart](https://docs.langchain.com/oss/python/deepagents/quickstart)—Build your first deep agent
- [Customization](https://docs.langchain.com/oss/python/deepagents/customization)—Configure models, tools, and behavior
- [Context engineering](https://docs.langchain.com/oss/python/deepagents/context-engineering)—Manage context for complex tasks
- [Subagents](https://docs.langchain.com/oss/python/deepagents/subagents)—Delegate work to child agents
- [Sandboxes](https://docs.langchain.com/oss/python/deepagents/sandboxes)—Run code in isolated environments
- [Code](https://docs.langchain.com/oss/deepagents/code/overview)—Deep Agents Code, the terminal agent interface
- [Deploy](https://docs.langchain.com/langsmith/managed-deep-agents-overview)—Deploy to production

## API reference

For SDK class and method details, use the [LangChain API Reference](https://reference.langchain.com) site:
- MCP server: `https://reference.langchain.com/mcp`

## Related skills

- **langchain**—Core building blocks that Deep Agents is built on
- **langgraph**—Runtime that powers Deep Agents' durable execution
- **langsmith**—Trace, evaluate, and deploy your deep agents

More from langchain-ai/docs

SkillDescription
add-docs-pageAdd, move, rename, or delete a page on the LangChain docs site. Covers choosing the source directory, writing frontmatter, placing the entry in src/docs.json navigation, adding redirects, and verifying with the lint and broken-link gates. Use when asked to add a new doc or page, move or rename a page, put something in the nav, or add a redirect.
deepagentsAnalyze Deep Agents Python library releases against LangChain Deep Agents docs and prepare one-feature documentation updates.
deepagents-codeAnalyze Deep Agents Code releases against LangChain Deep Agents Code docs and prepare one-feature documentation updates.
deepagentsjsAnalyze Deep Agents TypeScript releases against LangChain Deep Agents docs and prepare one-feature documentation updates for JS-facing content.
docs-code-samplesUse this skill when migrating inline code samples from LangChain docs (MDX files) into external, testable code files that are extracted by this repo’s snippet scripts and used as Mintlify snippets. Applies when extracting code blocks from documentation, creating runnable code samples, using snippet delineators, or wiring snippet output into MDX includes.
docs-editEdit a docs page that already has an open pull request, or revise a page in place. Covers checking out the PR's own branch instead of cutting a new one, forked cross-repository PRs, reading the real diff, checking the edit against related pages, and the verification to run before handing off. Use when asked to edit, revise, fix, or review changes on a named PR, branch, or existing page.
docs-restructureRestructure documentation that spans several pages. Covers splitting a page that has grown too long, moving sections between pages, retiring a page, and fixing a topic documented in two places at once. Use when asked to streamline, simplify, consolidate, or reorganize docs, or when a page review keeps producing edits without the page getting shorter.
docs-reviewReview changed docs prose against Vale and the AGENTS.md style guide, reporting findings with the rule each one breaks. Use after authoring or editing a page and before committing, or to review a PR, a branch, or the current diff.
docs-team-voiceWrite or revise documentation prose so it reads like the rest of this site, in the docs team's shared voice. Covers sentence length, cross-link density, how to state defaults and conditions, naming exact identifiers, and what to cut in a revision pass. Use when drafting or rewriting a page, a section, a concept overview, a how-to, a callout, or landing copy.
docs-tooling-notionDocument new or changed docs-team tooling on the Notion tooling pages. Decides which of the five pages owns the topic, what belongs in the repo instead of Notion, and how to edit safely through the Notion MCP server. Invoke it whenever work adds or changes a script under scripts/, a GitHub Actions workflow, a Makefile target, a PR check, a scheduled job, an agent, a skill, or an MCP server, and invoke it before handing off that pull request. Shipping tooling is itself the trigger, so do not wait to be asked to document it and do not wait for the PR to merge.