deepagents — sub-agent delegation via the task tool (isolated mode)

deepagents — sub-agent delegation via the task tool (isolated mode) A sequence diagram generated by Archify. task(description, type) ToolRuntime(state, id) invoke(isolated state) messages = [HumanMessage(description)]; private keys dropped system + description tool_calls write_file(...) files update next step final text final state Command(update) last AI text as ToolMessage + shared keys such as files ToolMessage only Delegate Child runs alone Report back Parent model · main agent · Sequence participant Parent model main agent Parent graph · tools node · Sequence participant Parent graph tools node task tool · _build_task_tool · Sequence participant task tool _build_task_tool Child agent · own create_agent · Sequence participant Child agent own create_agent Child model · spec or parent · Sequence participant Child model spec or parent Backend · shared files · Sequence participant Backend shared files Legend main request return security message