deep-agents-core
INVOKE THIS SKILL when building ANY Deep Agents application. Covers create_deep_agent(), harness architecture, SKILL.md format, and configuration options.
INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts.
$ npx -y skills add langchain-ai/langchain-skills --skill deep-agents-orchestration --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/deep-agents-orchestrationContext 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.
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>
---
<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>
---
<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:
</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⚠️ — 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.
Repo: langchain-ai/langchain-skills
INVOKE THIS SKILL when building ANY Deep Agents application. Covers create_deep_agent(), harness architecture, SKILL.md format, and configuration options.
INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent),…
Scaffold a minimal local Deep Agent in Python by following the official quickstart, using provider-native web search instead of Tavily. Use when the user wants…
Scaffold a minimal local Deep Agent in TypeScript by following the official quickstart, using provider-native web search instead of Tavily. Use when the user…
INVOKE FIRST for any LangChain / LangGraph / Deep Agents agent building project before consulting other skills or writing any agent code. Required starting…
Inspect an agent repository and optional traces, interview the user, write reviewed Task Specs, build and audit Harbor tasks, and bootstrap reusable project…