# How to implement Dynamic Runtime Subagents in DeepAgents + LangGraph

**URL:** <https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607>\
**Category:** Deep Agents\
**Tags:** intro-to-langgraph, python-help\
**Created:** [September 25, 2026, 6:40am UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607 "2026-09-25T06:40:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrsknetwork](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mrsknetwork](https://forum.langchain.com/u/mrsknetwork)\
**Post date:** [September 25, 2026, 6:40am UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607/1 "2026-09-25T06:40:19Z")

</div>

Hi everyone,

I’m trying to understand the best way to implement **dynamically generated subagents at runtime.**

My goal is slightly different from the standard DeepAgents subagent pattern. Instead of predefining all subagents, I want the orchestrator to:

1. Analyze the incoming task.
2. Generate a specialist agent definition at runtime.
3. Allocate a custom system prompt, tools, permissions, workspace/file access rules, and context.
4. Execute the specialist.
5. Verify the output using a reviewer/critic agent.
6. Return the result to the orchestrator.
7. Dispose of the temporary specialist and continue the workflow.

### Conceptually:

Orchestrator  
↓  
Agent Architect  
↓  
Runtime Agent Factory  
↓  
Specialist Agent  
↓  
Verifier  
↓  
Aggregator

From my research, it seems DeepAgents supports custom “ **CompiledSubAgent** ” runnables, and LangGraph provides dynamic worker execution through “ **Send** ”. This makes me wonder whether a runtime-created LangGraph workflow or DeepAgent instance could be treated as a temporary specialist worker.

### My questions:

- Is this architecture aligned with how DeepAgents and LangGraph are intended to be used?
- Has anyone implemented runtime-generated specialists or agent factories in production?
- Would you recommend using LangGraph as the orchestration layer and DeepAgents as workers, or keeping everything inside DeepAgents?
- Are there existing examples of combining “CompiledSubAgent”, “Send”, and dynamic tool allocation for this pattern?

---

<div class="post-metadata">

**Author:** ![capitaharlock](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@capitaharlock](https://forum.langchain.com/u/capitaharlock)\
**Post date:** [September 25, 2026, 7:26am UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607/2 "2026-09-25T07:26:03Z")

</div>

In your Runtime Agent Factory, who authorizes the specialist’s tools and workspace/file access: the generated definition itself, or runtime checks independent of it? Putting permission rules in the system prompt isn’t the same as enforcing them.

---

<div class="post-metadata">

**Author:** ![mrsknetwork](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mrsknetwork](https://forum.langchain.com/u/mrsknetwork)\
**Post date:** [September 25, 2026, 8:15am UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607/3 "2026-09-25T08:15:15Z")

</div>

Current **workspace-level** access grants permissions to all sub-agents accessible by the main orchestration agent.

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [September 25, 2026, 7:44pm UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607/4 "2026-09-25T19:44:35Z")

</div>

Hello @mrsknetwork welcome to Langchain community,  
This is a reasonable architecture, but separate **runtime-generated plans** from **runtime-generated permissions**.

I would generally use LangGraph for orchestration and DeepAgents as workers when specialists need filesystem access, long-running planning, or their own subagents. `Send` is useful for dynamic fan-out, while `CompiledSubAgent` can represent a worker but neither provides authorization or sandboxing.

The agent architect should return a validated declarative spec containing things like the model, tools, workspace, and budget. A separate policy layer must authorize that spec before execution:

```plaintext
effective permissions =
caller permissions ∩ environment policy ∩ approved capabilities

```

Never let the generated prompt grant permissions or load arbitrary tools. If all subagents inherit workspace-level access, they share that authority; narrower access must be enforced by tool wrappers, scoped filesystems, credentials, or isolated processes.

For verification, use deterministic checks followed by a reviewer with limited permissions. The reviewer should return a structured approval, retry, or rejection decision.

For simple model routing, you likely do not need to compile a new graph per request. Classify once, store the route in state, and select from a static allowlist of models. This is easier to observe, secure, and maintain.

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [October 1, 2026, 9:56am UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607/5 "2026-10-01T09:56:20Z")

</div>

@mrsknetwork if everything is clear, please mark the answer as solution otherwise let me know if you have any more questions, would love to help you out 🙂

---

<div class="post-metadata">

**Author:** ![mrsknetwork](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mrsknetwork](https://forum.langchain.com/u/mrsknetwork)\
**Post date:** [October 7, 2026, 4:34pm UTC](https://forum.langchain.com/t/how-to-implement-dynamic-runtime-subagents-in-deepagents-langgraph/4607/6 "2026-10-07T16:34:52Z")

</div>

@keenborder786 thanks for your suggestion and solution. I also noticed that Langchain recently released their beta version of the SDK update that has dynamic sub-agents. Which I was looking for. [Dynamic subagents - Docs by LangChain](https://docs.langchain.com/oss/python/deepagents/dynamic-subagents)
