Skip to main content
Give a managed deep agent subagents to delegate specialized or context-heavy work, such as researching a topic, reviewing a change, or running a long task in the background with an async subagent while the agent keeps talking to the user. Each subagent has its own prompt and context window. It can also use its own model and tools.
Managed Deep Agents is in beta on LangSmith Cloud and Bring Your Own Cloud (BYOC). Use Managed Deep Agents CLI and SDK v0.10 or later for BYOC.
There are two types of subagents: A subagent runs inside the agent’s graph. Managed Deep Agents builds each async subagent as its own graph in the same deployment. Both kinds work in the agent’s sandbox. For how subagents work in the open source Deep Agents SDK, see Subagents and Async subagents.
Async subagents require managed-deepagents>=0.10.0.

The general-purpose subagent

Every agent gets a built-in general-purpose subagent, even when you omit subagents from the agent definition. The agent can delegate independent tasks to it at runtime, including fanning out tasks in parallel, without declaring specialized subagents up front. Unlike custom subagents, general-purpose inherits the agent’s skills automatically, along with its model and tools. Like other subagents, it runs with its own prompt and context window, not the agent’s conversation or instructions. Include all needed context, constraints, and expected output in each task’s description. Declare a custom subagent when a task needs a different model, a restricted tool set, or a reusable system prompt. For customization options, see The general-purpose subagent.

Declare a custom subagent

Add subagent definitions to subagents in the agent definition. Each one needs a name and a description; the agent uses the description to decide when to delegate. To make a subagent async, add async to its definition:
agent.py

Subagents

The agent runs a subagent with the task tool and waits for its answer. The subagent runs inside the agent’s graph and works in the agent’s sandbox.

What a subagent inherits

A subagent starts from the agent’s configuration and replaces what its definition sets: A subagent in fork mode starts with a copy of the agent’s conversation and also uses the agent’s instructions, middleware, skills, and memory. See Choose a launch mode.

Fan out tasks in parallel

To fan out work in parallel, the agent issues multiple task calls in one turn. This works with the built-in general-purpose subagent or any declared custom subagent. Each call sets subagent_type and a distinct description, and runs in its own context window. The agent receives all results before its next turn and combines them into one answer. To keep working while tasks run in the background, the agent issues multiple start_async_task calls instead. See Async subagents. For example, to investigate logs across multiple projects in parallel, add guidance to instructions.md:
instructions.md

Select MCP servers

Set mcp on a subagent to choose which MCP server definitions give it tools. mcp does not affect the subagent’s other tools.
Subagent MCP selection requires managed-deepagents>=0.10.2.
An async subagent connects only to the servers it selects and asks only for their credentials. Only a graph factory can set mcp on the agent.
agent.py

Async subagents

An async subagent runs on its own thread while the parent agent keeps working, and reports back automatically when it finishes or pauses. See Async subagents for the full lifecycle, tools, and options. Managed Deep Agents builds each async subagent as its own graph in the same deployment (for example, research-assistant--researcher). Declare each one directly in subagents (or in a graph factory that returns the definition directly) with a static name and async value, because the CLI discovers them at build time without executing your code. Agents served by mda dev or a deployment also get an async general-purpose subagent and the async task tools automatically. Do not set graph_id, url, headers, or runnable on an async subagent; Managed Deep Agents wires the graph itself. update_strategy, notify_parent, webhook, and mode pass through to Deep Agents. To call an agent on another deployment as a remote subagent, omit async and pass its graph_id (its name for a Managed Deep Agent) and url.
  • Inheritance: Follows the same inheritance rules as sync subagents. In fork mode, it copies the conversation but keeps its own prompt, tools, and middleware.
  • Sandbox and traces: Runs as the same user on a separate thread, sharing the agent’s sandbox and nesting under the agent’s trace in LangSmith. With private threads, different users get separate sandboxes.
  • Channels and approvals: Results return to the parent agent, which decides what to reply in the channel thread. On Slack, approval interrupts appear in-thread; on other channels, resume the subagent’s thread in Studio or through the API (see Respond to an interrupt).
  • Evaluations: mda eval starts a local Agent Server for agents that declare async subagents (requires managed-deepagents>=0.10.2 and the matching mda CLI). Evaluated agents without declared async subagents do not receive the async general-purpose subagent or async task tools.

See also