Skip to main content
A swarm splits a task across parallel subagents and combines their findings. In this example, a lead agent starts three specialized async subagents to investigate an incident in parallel, then writes one report. When the number of parallel tasks depends on the request, the lead can also fan out dynamically with the built-in general-purpose subagent.
Managed Deep Agents is in public beta on LangSmith Cloud and Bring Your Own Cloud (BYOC). Use Managed Deep Agents CLI and SDK v0.10 or later for BYOC.
This TypeScript example requires managed-deepagents version 0.10.0 or later and the matching mda CLI.
Mock incident-investigator chat launching logs-investigator, changes-investigator, and issues-investigator in parallel via start_async_task and combining their findings into one report. Mock incident-investigator chat launching logs-investigator, changes-investigator, and issues-investigator in parallel via start_async_task and combining their findings into one report.

Declare the subagents

Start with a project from the quickstart and replace the agent definition:
agent.ts
Subagents inherit the lead’s model and tools. An async subagent sees only its task description, not the lead’s conversation.

Write the instructions

Replace instructions.md:
instructions.md
The lead launches each task with start_async_task. Tasks run in separate threads and notify the lead as each one finishes.

Try it

Run the agent with mda dev or deploy it. In a new conversation, describe an incident and paste logs, recent changes, and related issues. Confirm that the lead starts all three tasks at once and combines their findings.

Fan out dynamically

When the number of parallel tasks depends on the request (such as one investigation per affected service), you do not need to declare subagents up front. Every deployed or mda dev agent includes a built-in general-purpose subagent that inherits the lead’s model, tools, and skills. Instruct the lead to launch multiple general-purpose tasks in one turn, using start_async_task for background runs or task to wait for all results:
instructions.md
Each task runs in its own context window and does not see the user’s message, so include all needed details in the description.

Extend the pattern

  • Add read-only tools or MCP servers so the subagents pull live logs, changes, and issues.
  • Add a Slack channel so people can start an investigation by mentioning the agent.
  • Add more async subagents, such as one for metrics, and name them in instructions.md.

See also