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.
By langchain-ai · 13,413 installs
npx skills add langchain-ai/langchain-skills --skill deep-agents-orchestration
Source repository · Upstream listing
<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.
</python
<typescript
Create a custom "researcher" subagent with specialized tools for academic paper search.
</typescript
</ex custom subagents
<ex subagent with hitl
<python
Configure a subagent with HITL approval for sensitive operations.
</python
</ex subagent with hitl
<fix subagents are stateless
<python
Subagents are stateless provide complete instructions in a single call.
</python
<typescript
Subagents are stateless provide complete instructions in a single call.
</typescript
</fix subagents are stateless
<fix custom subagents dont inherit skills
<python
Custom subagents don't inherit skills from the main agent.
</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
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.
</python
<typescript
Invoke an agent that automatically creates a todo list for a multi step task.
</typescript
</ex todolist usage
<ex access todo state
<python
Access the todo list from the agent's final state after invocation.
</python
</ex access todo state
<fix todolist requires thread id
<python
Todo list state requires a thread id for persistence across invocations.
</python
</fix todolist requires thread id
Human in the Loop (Approval Workflows)
<when to use hitl
Use HITL When Skip HITL When
High stakes operations (DB writes, deployments) Read only operations
Compliance requires human oversight Fully automated workflows
</when to use hitl
<ex hitl setup
<python
Configure which tools require human approval before execution.
</python
<typescript
Configure which tools require human approval before execution.
</typescript
</ex hitl setup
<ex approval workflow
<python
Complete workflow: trigger an interrupt, check state, approve action, and resume execution.
</python
<typescript
Complete workflow: trigger an interrupt, check state, approve action, and resume execution.
</typescript
</ex approval workflow
<ex reject with feedback
<python
Reject a pending action with feedback, prompting the agent to try a different approach.
</python
<typescript
Reject a pending action with feedback, prompting the agent to try a different approach.
</typescript
</ex reject with feedback
<ex edit before execution
<python
Edit the proposed action arguments before allowing execution.
</python
</ex edit before execution
<boundaries
What Agents CAN Configure
Subagent names, tools, models, system prompts
Which tools require approval
Allowed decision types per tool
TodoList content and structure
What Agents CANNOT Configure
Tool names ( task , write todos )
HITL protocol (approve/edit/reject structure)
Skip checkpointer requirement for interrupts
Make subagents stateful (they're ephemeral)
</boundaries
<fix checkpointer required
<python
Checkpointer is required when using interrupt on for HITL workflows.
</python
<typescript
Checkpointer is required when using interruptOn for HITL workflows.
</typescript
</fix checkpointer required
<fix thread id required for resumption
<python
A consistent thread id is required to resume interrupted workflows.
</python
<typescript
A consistent thread id is required to resume interrupted workflows.
</typescript
</fix thread id required for resumption
<fix interrupt checks between invocations
<python
Interrupts happen BETWEEN invoke() calls, not mid execution.
</python
</fix interrupt checks between invocations