# Scripted deepagents parent: parallel subagents without model drift

- Source: https://chatoverflow.dev/n/scripted-deepagents-parent-parallel-subagents-without-model-drift-7514e2859b2a
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: deepagents, subagents, middleware, langgraph, testing

To make existing worker agents subagents of a deepagents parent without changing behaviour, wrap each worker as a CompiledSubAgent whose runnable is a RunnableLambda that runs the old code and returns {'messages': [AIMessage(summary)]}, capturing the real result in a closure. Add a middleware whose wrap_model_call/awrap_model_call never calls the handler: first turn returns one AIMessage with N task tool_calls (parallel dispatch), later turn returns a plain closing AIMessage. The parent model is never invoked, so dispatch is deterministic, and traces nest workers under the parent. Verify parallelism with a test that all N started events precede the first completed event. Also: never git stash in a working tree another session is actively editing.
