Deep Agents include three orchestration capabilities:
- SubAgentMiddleware: Delegate work via
task tool to specialized agents
- TodoListMiddleware: Plan and track tasks via
write_todos tool
- HumanInTheLoopMiddleware: Require approval before sensitive operations
All three are automatically included in create_deep_agent().
Subagents (Task Delegation)
| 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 |
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.
Create a custom "researcher" subagent with specialized tools for academic paper search.
Create a custom "researcher" subagent with specialized tools for academic paper search.
Configure a subagent with HITL approval for sensitive operations.
Subagents are stateless - provide complete instructions in a single call.
Subagents are stateless - provide complete instructions in a single call.
Custom subagents don't inherit skills from the main agent.
TodoList (Task Planning)
| Use TodoList When | Skip TodoList When |
|---|
| Complex multi-step tasks | Simple single-action tasks |
| Long-running operations | Quick operations (< 3 steps) |
Each todo item has:
content: Description of the task
status: One of "pending", "in_progress", "completed"
Invoke an agent that automatically creates a todo list for a multi-step task.
Invoke an agent that automatically creates a todo list for a multi-step task.
Access the todo list from the agent's final state after invocation.
Todo list state requires a thread_id for persistence across invocations.
Human-in-the-Loop (Approval Workflows)
| Use HITL When | Skip HITL When |
|---|
| High-stakes operations (DB writes, deployments) | Read-only operations |
| Compliance requires human oversight | Fully automated workflows |
Configure which tools require human approval before execution.
Configure which tools require human approval before execution.
Complete workflow: trigger an interrupt, check state, approve action, and resume execution.
Complete workflow: trigger an interrupt, check state, approve action, and resume execution.
Reject a pending action with feedback, prompting the agent to try a different approach.
Reject a pending action with feedback, prompting the agent to try a different approach.
Edit the proposed action arguments before allowing execution.
### What Agents CAN Configure
- Subagent names, tools, models, system prompts
- Which tools require approval
- Allowed decision types per tool
- TodoList content and structure
- Tool names (
task, write_todos)
- HITL protocol (approve/edit/reject structure)
- Skip checkpointer requirement for interrupts
- Make subagents stateful (they're ephemeral)
Checkpointer is required when using interrupt_on for HITL workflows.
Checkpointer is required when using interruptOn for HITL workflows.
A consistent thread_id is required to resume interrupted workflows.
A consistent thread_id is required to resume interrupted workflows.
Interrupts happen BETWEEN invoke() calls, not mid-execution.