Skip to content

LangChain Deep Agents: Terminal Coding Agent and Deployment Platform

LangChain's Deep Agents ecosystem has matured significantly since its early releases. As of mid-2026 it ships two distinct tools—dcode for interactive AI-assisted coding in your terminal, and deepagents-cli for scaffolding and deploying agents to the cloud—backed by the deepagents Python library (v0.7.5) running on LangGraph.

The project has grown from a simple coding REPL into a full agent platform: persistent memory, sub-agent delegation, model-agnostic backends, MCP server integrations, and a managed cloud offering that entered public beta in August 2026.

Two Tools, Two Jobs

Tool Package Purpose
dcode deepagents-code Interactive REPL for AI-assisted coding
deepagents deepagents-cli Scaffold, develop, and deploy agents

If you want to code with an AI pair programmer, reach for dcode. If you want to build and ship your own agent, reach for deepagents-cli.

Interactive Coding with dcode

Installation

The fastest way to install the interactive coding agent:

curl -LsSf https://langch.in/dcode | bash

Or with uv:

uv tool install deepagents-code

Set Up API Keys

dcode works with any major model provider:

# Anthropic Claude
export ANTHROPIC_API_KEY="your-anthropic-key"

# OpenAI
export OPENAI_API_KEY="your-openai-key"

Launch a Coding Session

Navigate to your project and start the agent:

cd your-project
dcode

Pin a specific model:

dcode --model openai:gpt-5.5

Start with an initial prompt so the agent gets to work immediately:

dcode -m "Refactor the auth module to use Pydantic v2"

Use a named agent profile for isolated memory per project or context:

dcode --agent backend-api

Practical Usage Examples

Scaffold new code — ask in plain language:

> Create a Python module called utils.py with functions for reading JSON files
  and validating email addresses

The agent proposes code, shows a diff, and waits for approval before writing.

Reference files with @ — no copy-pasting required:

> Refactor @data_processor.py to use list comprehensions instead of for loops

Run shell commands with !:

> !pytest tests/test_api.py -v
> The authentication test is failing. Can you debug it?

Non-interactive mode for scripting and CI:

dcode -n "Add type hints to all functions in src/api.py"

Tips for Effective Use

Be specific: "Fix the null pointer in auth.py around line 45 where we check user permissions" beats "fix the bug".

Review diffs carefully: The agent shows proposed changes before applying them—take a moment to verify.

Use named profiles: dcode --agent myproject keeps memory isolated per project so the agent learns your conventions without cross-contamination.

Iterate incrementally: For large changes, break the task into focused sub-tasks rather than asking for everything at once.

Building and Deploying Agents with deepagents-cli

Installation

pip install deepagents-cli

Scaffold a New Agent

deepagents init my-agent
cd my-agent

This creates a project with boilerplate skills, tools.json, and agent.json.

Develop Locally

deepagents dev

Deploy to the Cloud

LangChain's managed Deep Agents platform (public beta, August 2026) lets you run and serve agents without managing infrastructure:

deepagents deploy

Manage MCP Servers

Connect your agent to external data sources via Model Context Protocol:

# Register a server
deepagents mcp-servers add --url https://api.example.com/mcp \
  --header "X-Api-Key=$MY_API_KEY" --name my-data-source

# List, inspect, or remove
deepagents mcp-servers list
deepagents mcp-servers get my-data-source
deepagents mcp-servers delete my-data-source

Manage Deployed Agents

deepagents agents list
deepagents agents get <agent_id>
deepagents agents delete <agent_id>

Python Library Integration (deepagents 0.7.5)

The deepagents library is the programmatic core. Version 0.7 made the harness significantly leaner—65% fewer base input tokens per turn—with a few breaking changes to be aware of.

Installation

pip install deepagents

Basic Usage

As of v0.7, the default system prompt is empty. Supply your own:

import os
from deepagents import create_deep_agent

os.environ["ANTHROPIC_API_KEY"] = "your-anthropic-key"

agent = create_deep_agent(
    system_prompt="You are a helpful coding assistant."
)

result = agent.invoke({
    "messages": [{"role": "user", "content": "Write a Python function for binary search"}]
})

print(result["messages"][-1].content)

Custom Tool Integration

Tools are plain Python functions with type hints and docstrings:

import os
from typing import List
from deepagents import create_deep_agent

def fetch_jira_issues(project_key: str, status: str = "open") -> List[dict]:
    """Fetch issues from JIRA for a given project.

    Args:
        project_key: The JIRA project key (e.g., "BACKEND")
        status: Filter by issue status

    Returns:
        List of issue dictionaries
    """
    # Your JIRA integration logic here
    return [{"key": f"{project_key}-123", "summary": "Example issue"}]

agent = create_deep_agent(
    tools=[fetch_jira_issues],
    system_prompt="You are a project management assistant with JIRA access."
)

result = agent.invoke({
    "messages": [{"role": "user", "content": "What are the open bugs in BACKEND?"}]
})

print(result["messages"][-1].content)

Task Planning with TodoListMiddleware

In v0.7, task planning is opt-in. Add TodoListMiddleware when you want the agent to decompose complex work:

from deepagents import create_deep_agent
from deepagents.middleware import TodoListMiddleware

agent = create_deep_agent(
    middleware=[TodoListMiddleware()],
    system_prompt="You are a coding assistant. Break complex tasks into steps."
)

result = agent.invoke({
    "messages": [{
        "role": "user",
        "content": "Add Pydantic validation to every endpoint in the /api directory"
    }]
})

CI Integration

Pipe test failures into the agent automatically:

import os
import subprocess
from deepagents import create_deep_agent

os.environ["ANTHROPIC_API_KEY"] = "your-key"

agent = create_deep_agent(
    system_prompt="Analyze test failures and suggest targeted fixes."
)

result = subprocess.run(["pytest", "-v"], capture_output=True, text=True)

if result.returncode != 0:
    response = agent.invoke({
        "messages": [{
            "role": "user",
            "content": f"Tests failed:\n{result.stdout}\n{result.stderr}\nSuggest fixes."
        }]
    })
    print(response["messages"][-1].content)

v0.7 Breaking Changes at a Glance

Behavior Before v0.7 v0.7+
Default system prompt Auto-injected Empty — supply your own
TodoListMiddleware Included by default Opt-in via middleware=
Filesystem access Unrestricted by default virtual_mode=True by default
Tool descriptions Verbose 43% trimmed

If you're upgrading from an earlier version, explicitly pass middleware=[TodoListMiddleware()] and write a system_prompt to restore the behavior your agent relied on.

When to Use What

dcode is best for:

  • Interactive coding sessions in your terminal
  • Refactoring across multiple files
  • Debugging test failures with full project context
  • Scaffolding new modules following project conventions

deepagents-cli + library is best for:

  • Building a reusable, deployable agent for a team or product
  • Integrating domain-specific tools (JIRA, APIs, databases)
  • Running agents in CI or automation pipelines
  • Hosting agents via LangChain's managed platform

Resources

The Deep Agents ecosystem has evolved from a single coding CLI into a two-tier platform: dcode for interactive pair programming and deepagents-cli for building and shipping production agents. The v0.7 library refactor made the harness leaner and more explicit—less magic, more control.