LangChain Deep Agents: The Easiest Way to Build Reliable AI Agents

Building AI agents that can handle complex, multi-step tasks has never been easier. LangChain’s Deep Agents is a powerful agent harness that brings together everything you need to build reliable, production-ready LLM-powered agents — all in one package.

What Is Deep Agents?

Deep Agents is a standalone Python library built on top of LangChain’s core building blocks. It uses the LangGraph runtime for durable execution, streaming, human-in-the-loop interactions, and more. Think of it as an “agent harness” — the same core tool-calling loop as other agent frameworks, but with built-in capabilities that make agents reliable for real-world tasks.

Whether you’re building a coding assistant, a data analyst, or a research agent, Deep Agents gives you the infrastructure to do it right from day one.

Quickstart

Getting started is straightforward. Install the library and create your first agent in just a few lines:

# pip install -qU deepagents langchain-google-genai
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="google_genai:gemini-3.5-flash",
tools=[get_weather],
system_prompt="You are a helpful assistant",
)
# Run the agent
agent.invoke(
{"messages": [{"role": "user", "content": "what is the weather in sf"}]}
)

Core Capabilities

Deep Agents comes with six major built-in capabilities:

  • Take actions in an environment — Invoke tools, read and write files, and execute code.
  • Connect to your data — Load memories, skills, and domain knowledge at the right moment.
  • Manage growing context — Summarize history and offload large results across long runs.
  • Parallelize tasks — Delegate to general or specialized subagents running in isolated context windows.
  • Stay in the loop — Pause for human approval at critical decision points.
  • Improve over time — Update memory, skills, and prompts based on real usage.

Execution Environment

Tools and MCP Support

Pass custom functions, LangChain tools, or tools from any MCP (Model Context Protocol) server using the tools= parameter. Deep Agents fully support MCP, letting you connect to databases, APIs, file systems, and more through a standard interface.

from deepagents import create_deep_agent
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
tools=[search, fetch_page, run_query],
)

Virtual Filesystem

The harness provides a configurable virtual filesystem backed by pluggable backends — in-memory state, local disk, LangGraph store, or custom backends. It supports operations like ls, read_file, write_file, edit_file, glob, and grep.

Filesystem Permissions

Declarative permission rules control which files and directories the agent can read or write. You can restrict agents to specific directories, protect sensitive files like .env, and give subagents narrower access than the parent agent.

Code Execution

Deep Agents supports two modes of code execution:

  • Sandbox backends — Expose a shell execute tool for isolated command execution. Ideal for installing dependencies, running tests, or calling CLIs.
  • Interpreters — Add an eval tool running JavaScript in a scoped QuickJS runtime. Great for lightweight data transformations and programmatic tool calling.

Context Management

Skills

Skills package specialized workflows, domain knowledge, and custom instructions for your agent. They follow the Agent Skills standard and use progressive disclosure — the agent reads skill frontmatter at startup and only loads full skill content when a task needs it, keeping startup context compact.

Memory

Memory gives your agent persistent context across conversations — coding style, preferences, conventions, and project guidelines. Memory uses AGENTS.md files and can be updated based on interactions, so preferences carry forward without restating them each session.

Summarization and Context Offloading

The harness automatically compresses conversation history and large intermediate results, isolates subagent work, and uses long-term storage to carry information across threads — all to support multi-step tasks that exceed a single context window.

Prompt Caching

For Anthropic models, Deep Agents automatically applies prompt caching to static sections of the system prompt — base agent instructions, memory, and skill content. This reduces both latency and cost on long-running agents, with no configuration required.

Delegation: Task Planning and Subagents

Deep Agents includes a built-in write_todos tool for structured task tracking with status states (pending, in_progress, completed), giving agents a lightweight planning layer for long-running work.

The subagent system allows the main agent to spin up ephemeral child agents for isolated or parallel tasks. Each subagent gets fresh context, runs autonomously to completion, and returns a single final report — keeping the parent agent’s context clean and token-efficient.

Human-in-the-Loop

Deep Agents integrates with LangGraph interrupts so you can pause for human approval on sensitive tool calls. Use the interrupt_on parameter to specify which tools require a checkpoint:

agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
tools=[edit_file, deploy],
interrupt_on={"edit_file": True}, # Pause before every file edit
)

This gives you a runtime safety layer for destructive operations, expensive API calls, and interactive debugging.

Observability with LangSmith

Deep Agents integrates seamlessly with LangSmith for tracing requests, debugging agent behavior, and evaluating outputs. When you’re ready to move to production, LangSmith provides full deployment and monitoring options.

Getting Started

Deep Agents is the right choice if you want a batteries-included agent framework that handles the hard parts — context management, memory, subagent delegation, and human oversight — so you can focus on building what matters.

Source: LangChain Deep Agents Documentation

Leave a Reply