Skip to content
Development
Skill

/deep-agents-orchestration

INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts.

From plugin
langchain-skills
1.1k22 skills
Install
$ npx -y skills add langchain-ai/langchain-skills --skill deep-agents-orchestration --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/deep-agents-orchestration

Context preview

The summary Claude sees to decide when to auto-load this skill.

INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts.

SKILL.md

deep-agents-orchestration.SKILL.md
name: deep-agents-orchestration
description: "INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts."

<overview> Deep Agents include three orchestration capabilities:

1. **SubAgentMiddleware**: Delegate work via `task` tool to specialized agents 2. **TodoListMiddleware**: Plan and track tasks via `write_todos` tool 3. **HumanInTheLoopMiddleware**: Require approval before sensitive operations

All three are automatically included in `create_deep_agent()`. </overview>

---

Subagents (Task Delegation)

<when-to-use-subagents>

| Use Subagents When | Use Main Agent When | |-------------------|-------------------| | Task needs specialized tools | General-purpose tools sufficient | | Want to isolate complex work | Single-step operation | | Need clean context for main agent | Context bloat acceptable |

</when-to-use-subagents>

<how-subagents-work> Main agent has `task` tool -> creates fresh subagent -> subagent executes autonomously -> returns final report.

**Default subagent**: "general-purpose" - automatically available with same tools/config as main agent. </how-subagents-work>

<ex-custom-subagents> <python> Create a custom "researcher" subagent with specialized tools for academic paper search.

from deepagents import create_deep_agent
from langchain.tools import tool

@tool
def search_papers(query: str) -> str:
    """Search academic papers."""
    return f"Found 10 papers about {query}"

agent = create_deep_agent(
    subagents=[
        {
            "name": "researcher",
            "description": "Conduct web research and compile findings",
            "system_prompt": "Search thoroughly, return concise summary",
            "tools": [search_papers],
        }
    ]
)

# Main agent delegates: task(agent="researcher", instruction="Research AI trends")

</python> <typescript> Create a custom "researcher" subagent with specialized tools for academic paper search.

import { createDeepAgent } from "deepagents";
import { tool } from "@langchain/core/tools";
import { z } from "zod";

const searchPapers = tool(
  async ({ query }) => `Found 10 papers about ${query}`,
  { name: "search_papers", description: "Search papers", schema: z.object({ query: z.string() }) }
);

const agent = await createDeepAgent({
  subagents: [
    {
      name: "researcher",
      description: "Conduct web research and compile findings",
      systemPrompt: "Search thoroughly, return concise summary",
      tools: [searchPapers],
    }
  ]
});

// Main agent delegates: task(agent="researcher", instruction="Research AI trends")

</typescript> </ex-custom-subagents>

<ex-subagent-with-hitl> <python> Configure a subagent with HITL approval for sensitive operations.

from deepagents import create_deep_agent
from langgraph.checkpoint.memory import MemorySaver

agent = create_deep_agent(
    subagents=[
        {
            "name": "code-deployer",
            "description": "Deploy code to production",
            "system_prompt": "You deploy code after tests pass.",
            "tools": [run_tests, deploy_to_prod],
            "interrupt_on": {"deploy_to_prod": True},  # Require approval
        }
    ],
    checkpointer=MemorySaver()  # Required for interrupts
)

</python> </ex-subagent-with-hitl>

<fix-subagents-are-stateless> <python> Subagents are stateless - provide complete instructions in a single call.

# WRONG: Subagents don't remember previous calls
# task(agent='research', instruction='Find data')
# task(agent='research', instruction='What did you find?')  # Starts fresh!

# CORRECT: Complete instructions upfront
# task(agent='research', instruction='Find data on AI, save to /research/, return summary')

</python> <typescript> Subagents are stateless - provide complete instructions in a single call.

// WRONG: Subagents don't remember previous calls
// task research: Find data
// task research: What did you find?  // Starts fresh!

// CORRECT: Complete instructions upfront
// task research: Find data on AI, save to /research/, return summary

</typescript> </fix-subagents-are-stateless>

<fix-custom-subagents-dont-inherit-skills> <python> Custom subagents don't inherit skills from the main agent.

# WRONG: Custom subagent won't have main agent's skills
agent = create_deep_agent(
    skills=["/main-skills/"],
    subagents=[{"name": "helper", ...}]  # No skills inherited
)

# CORRECT: Provide skills explicitly (general-purpose subagent DOES inherit)
agent = create_deep_agent(
    skills=["/main-skills/"],
    subagents=[{"name": "helper", "skills": ["/helper-skills/"], ...}]
)

</python> </fix-custom-subagents-dont-inherit-skills>

---

TodoList (Task Planning)

<when-to-use-todolist>

| Use TodoList When | Skip TodoList When | |------------------|-------------------| | Complex multi-step tasks | Simple single-action tasks | | Long-running operations | Quick operations (< 3 steps) |

</when-to-use-todolist>

<todolist-tool>

write_todos(todos: list[dict]) -> None

Each todo item has:

  • `content`: Description of the task
  • `status`: One of `"pending"`, `"in_progress"`, `"completed"`

</todolist-tool>

<ex-todolist-usage> <python> Invoke an agent that automatically creates a todo list for a multi-step task.

from deepagents import create_deep_agent

agent = create_deep_agent()  # TodoListMiddleware included by default

result = agent.invoke({
    "messages": [{"role": "user", "content": "Create a REST API: design models, implement CRUD, add auth, write tests"}]
}, config={"configurable": {"thread_id": "session-1"}})

# Agent's planning via write_todos:
# [
#   {"content": "Design data models", "status": "in_progress"},
#   {"content": "Implement CRUD endpoints", "status": "pending"},
#   {"content": "Add authentication", "status": "pending"},
#   {"content": "Write tests", "status": "pend
Read more
Ships withlangchain-skills

⚠️ — This project is in early development. APIs and skill content may change. Agent skills for building agents with LangChain, LangGraph, and Deep Agents. For LangSmith-specific trace and dataset workflows, use langsmith-skills.

Get the whole plugin

Other skills on langchain-skills.