langchain - 💡(How to fix) Fix Allow ReAct supervisors to call subagents defined as LangGraph nodes (not only tools) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#36157Fetched 2026-04-08 01:17:09
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
commented ×2labeled ×2issue_type_added ×1mentioned ×1

Fix Action

Fix / Workaround

While this works, it feels like a workaround for something that should be a first-class capability: a supervisor agent that can call node-based subagents the same way it calls tools.

RAW_BUFFERClick to expand / collapse

Checked other resources

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Feature Description

Currently, when building multi-agent systems in LangGraph, there are two primary patterns:

  1. Subagents as tools (via ToolNode + tools_condition)
  2. Agents as nodes/subgraphs with handoffs (via Command / Command.PARENT)

The subagents-as-tools pattern provides excellent ergonomics for ReAct-style supervisors:

  • The supervisor can iteratively call subagents
  • It can reason over intermediate outputs
  • It can dynamically decide which subagents to call next
  • It naturally supports looping until completion

However, this pattern requires subagents to be wrapped as tools and invoked via ToolNode, which:

  • Obscures the graph structure (subagents do not appear as nodes)
  • Makes graph diagrams less interpretable
  • Creates inconsistency when mixing deterministic node flows with tool-based agents

In contrast, the node/subgraph + handoff pattern:

  • Preserves explicit graph structure
  • Keeps agents visible as nodes in diagrams
  • Is easier to reason about structurally

But it lacks the ergonomic ReAct-style loop where a supervisor:

  • Calls a subagent
  • Observes the result
  • Decides what to do next
  • Potentially calls additional subagents based on new information

Currently, there appears to be no first-class way to define subagents as nodes while still allowing a supervisor agent to:

  • Be aware of them
  • Call them at its discretion
  • Iteratively reason over their outputs (ReAct-style)

Use Case

I am building multi-agent workflows in LangGraph that combine:

  • Deterministic steps (explicit node-to-node flows)
  • ReAct-style orchestration (LLM decides what to do next)
  • Parallel and sequential subagent execution
  • Iterative refinement based on intermediate results

In these workflows, I want:

  • A supervisor agent that can dynamically decide which subagents to call
  • Subagents to be represented as first-class nodes (not hidden behind ToolNode)
  • A clear and interpretable graph diagram showing all agents and flows

Currently, I must choose between:

  • Using ToolNode (good reasoning, poor graph visibility), or
  • Hand-rolling orchestration loops with nodes (good visibility, more boilerplate)

This leads to patterns like:

orchestrator → workers → reviewer → loop → synthesizer

While this works, it feels like a workaround for something that should be a first-class capability: a supervisor agent that can call node-based subagents the same way it calls tools.

Proposed Solution

No response

Alternatives Considered

  1. Subagents as tools (ToolNode + tools_condition)

    • Works well for reasoning
    • Poor visibility in graph diagrams
    • Harder to mix with node-based workflows
  2. Handoff pattern (Command / Command.PARENT)

    • Keeps graph explicit
    • Requires manual orchestration
    • Does not naturally support iterative supervisor reasoning
  3. Custom orchestration loop (orchestrator → workers → reviewer → loop)

    • Fully flexible
    • Works well in practice
    • Feels like reimplementing missing framework functionality
  4. Treat subgraphs as tools

    • Suggested in forums
    • Still hides structure behind ToolNode

Additional Context

This gap becomes especially apparent when building hybrid workflows that combine:

  • Sequential pipelines
  • Parallel execution
  • ReAct-style reasoning loops

The current split between:

  • "agents as tools" (good reasoning)
  • "agents as nodes" (good structure)

forces developers into tradeoffs or custom patterns.

There are also related community signals suggesting this need.

extent analysis

Fix Plan

To address the issue of subagents not being first-class nodes in LangGraph, we can introduce a new node type, SubagentNode, which allows supervisors to call subagents dynamically while preserving graph structure.

Step-by-Step Solution:

  1. Create a new node type: Introduce SubagentNode that extends the existing Node class.
  2. Add subagent invocation logic: Implement a method in SubagentNode to invoke the subagent and return its output.
  3. Update supervisor logic: Modify the supervisor agent to use SubagentNode instead of ToolNode for subagent invocation.
  4. Update graph rendering: Update the graph rendering logic to display SubagentNode instances as first-class nodes.

Example Code:

# langgraph/nodes.py
class SubagentNode(Node):
    def __init__(self, subagent):
        self.subagent = subagent

    def invoke(self, input_data):
        # Invoke the subagent and return its output
        output = self.subagent(input_data)
        return output

# langgraph/supervisor.py
class SupervisorAgent:
    def __init__(self):
        self.subagents = {}

    def add_subagent(self, name, subagent):
        self.subagents[name] = SubagentNode(subagent)

    def invoke_subagent(self, name, input_data):
        subagent_node = self.subagents[name]
        output = subagent_node.invoke(input_data)
        return output

Verification

To verify the fix, create a sample workflow with a supervisor agent and subagents, and check that:

  • The graph diagram displays subagents as first-class nodes.
  • The supervisor agent can dynamically invoke subagents and reason over their outputs.

Extra Tips

  • Consider adding support for parallel and sequential subagent execution to the SubagentNode class.
  • Update the LangGraph documentation to reflect the new SubagentNode type and its usage.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING