> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Managed Deep Agents

> Build your agent as a directory of files while LangSmith runs the harness and runtime.

Managed Deep Agents (MDA) is the simplest way to build and deploy production agents. You focus on what your agent does. MDA runs it. There are no servers to run and no infrastructure to wire together.

You write the agent's intelligence: its instructions, the tools it can call, the skills it follows, and you select the model that drives it. MDA provides everything underneath:

* **The Deep Agents harness**: The agent loop that plans, calls tools, manages a filesystem, and delegates to subagents. See [Deep Agents](/oss/python/deepagents/overview).
* **A managed runtime**: [LangSmith Deployment's Agent Server](/langsmith/agent-server-overview) hosts and operates the agent, and keeps sessions running across restarts.

```mermaid actions={false} theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
%%{init: {"theme": "base", "themeVariables": {"lineColor": "#40668D", "primaryColor": "#E5F4FF", "primaryTextColor": "#030710", "primaryBorderColor": "#006DDD"}}}%%
flowchart LR
    subgraph you["You provide"]
        Logic["<div style='text-align:left'>Business logic<br/>- Instructions<br/>- Tools<br/>- Skills<br/>- Model</div>"]
    end
    subgraph mda["Managed Deep Agents"]
        direction TB
        Harness["<div style='text-align:left'>Deep Agents harness<br/>- Agent loop<br/>- Filesystem<br/>- Subagents</div>"]
        Runtime["<div style='text-align:left'>Managed runtime<br/>- Agent Server<br/>- Sandboxes<br/>- Schedules</div>"]
        Harness --> Runtime
    end

    Logic --> mda

    classDef process fill:#E5F4FF,stroke:#006DDD,stroke-width:2px,color:#030710
    classDef trigger fill:#F6FFDB,stroke:#6E8900,stroke-width:2px,color:#2E3900
    classDef output fill:#EBD0F0,stroke:#885270,stroke-width:2px,color:#441E33

    class Logic trigger
    class Harness process
    class Runtime output

    style you fill:none,stroke:#40668D,stroke-width:1px
    style mda fill:none,stroke:#40668D,stroke-width:1px
```

## Example agent

A managed deep agent consists of a project folder that contains the business logic for its behavior:

<Tabs>
  <Tab title="Model & configuration">
    ```python agent.py theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    from managed_deepagents import define_deep_agent

    from middleware.audit import log_tool_calls
    from tools.search import internet_search

    agent = define_deep_agent(
        name="research-assistant",
        model="openai:gpt-5.5",
        tools=[internet_search],
        middleware=[log_tool_calls],
    )
    ```
  </Tab>

  <Tab title="Instructions">
    ```markdown instructions.md theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    # Assistant

    You are a helpful assistant.
    ```
  </Tab>

  <Tab title="Skills">
    ```markdown skills/research/SKILL.md theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    ---
    name: research
    description: Gather and synthesize context before answering complex questions.
    ---

    # Research

    Use this skill when a task needs more than a direct answer.

    1. Identify what information is missing.
    2. Search LangChain docs when the question is about LangChain, LangGraph, or LangSmith.
    3. Summarize findings before responding to the user.
    ```
  </Tab>

  <Tab title="Tools">
    ```python tools/search.py theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    from langchain.tools import tool


    @tool(parse_docstring=True)
    def internet_search(query: str) -> str:
        """Search the internet for relevant sources.

        Args:
            query: The search query.
        """
        return f"Results for: {query}"
    ```
  </Tab>

  <Tab title="Middleware">
    ```python middleware/audit.py theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    from collections.abc import Awaitable, Callable

    from langchain.agents.middleware import wrap_tool_call
    from langchain.messages import ToolMessage
    from langchain.tools.tool_node import ToolCallRequest
    from langgraph.types import Command


    @wrap_tool_call
    async def log_tool_calls(
        request: ToolCallRequest,
        handler: Callable[[ToolCallRequest], Awaitable[ToolMessage | Command]],
    ) -> ToolMessage | Command:
        print(f"Calling tool: {request.tool_call['name']}")
        result = await handler(request)
        print(f"Finished tool: {request.tool_call['name']}")
        return result
    ```
  </Tab>

  <Tab title="MCP Connectors">
    ```python connectors/mcp.py theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    from managed_deepagents import connectors

    connector = connectors.mcp(
        mcp_servers={
            "langchainDocs": {
                "transport": "http",
                "url": "https://docs.langchain.com/mcp",
                "include_tools": ["search_docs_by_lang_chain"],
            },
        },
    )
    ```
  </Tab>
</Tabs>

When you upload this folder with the `mda` CLI, it will automatically run on managed LangSmith infrastructure.
You provide the business logic, and Managed Deep Agents provides the agent harness and production infrastructure.

To get started, see the [Managed Deep Agents quickstart](/langsmith/python/managed-deep-agents-quickstart).

## Core capabilities

Each part of the agent maps to a file or directory. Add the ones your agent needs:

| Capability                                                                        | Path              | Description                                                                              |
| --------------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------- |
| [Model and configuration](/langsmith/python/managed-deep-agents-agent-definition) | `agent.py`        | The model and core options. Required.                                                    |
| [Instructions](/langsmith/python/managed-deep-agents-instructions)                | `instructions.md` | The system prompt that defines how the agent behaves.                                    |
| [Skills](/langsmith/python/managed-deep-agents-skills)                            | `skills/`         | Task-specific playbooks the agent loads when they are relevant.                          |
| [Tools](/langsmith/python/managed-deep-agents-tools)                              | `tools/`          | Functions the agent calls to run your application logic or reach external services.      |
| [MCP connectors](/langsmith/python/managed-deep-agents-mcp-connectors)            | `connectors/`     | Remote MCP servers that provide tools to the agent.                                      |
| [Middleware](/langsmith/python/managed-deep-agents-middleware)                    | `middleware/`     | Custom logic that runs around model and tool calls.                                      |
| [Sandbox](/langsmith/python/managed-deep-agents-sandboxes)                        | `sandbox/`        | An isolated filesystem and shell for running agent-written code.                         |
| [Memory](/langsmith/python/managed-deep-agents-memory)                            | `memory.py`       | Preferences and knowledge that persist across threads.                                   |
| [Identity](/langsmith/python/managed-deep-agents-identity)                        | `identity.py`     | Per-caller private threads, memory, and credentials for multi-user deployments.          |
| [Channels](/langsmith/python/managed-deep-agents-channels)                        | `channels/`       | Connections to messaging services, such as Slack, that start runs and receive responses. |
| [Schedules](/langsmith/python/managed-deep-agents-schedules)                      | `schedules/`      | Managed cron schedules that run the agent on a recurring basis.                          |
| [Evals](/langsmith/python/managed-deep-agents-evals)                              | `evals/`          | Harbor-style tasks that test the agent.                                                  |

For the full layout, see [Project structure](/langsmith/python/managed-deep-agents-project-structure).

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/langsmith/python/managed-deep-agents-quickstart">
    Create and deploy your first Managed Deep Agent with the `mda` CLI.
  </Card>

  <Card title="Tutorial" icon="book" href="/langsmith/python/managed-deep-agents-tutorial">
    Add a custom search tool, durable memory, and a daily schedule.
  </Card>
</CardGroup>

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/managed-deep-agents-overview.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
