[GH-ISSUE #3228] [deepagents]: The ‘name’ passed into CompiledSubAgent init method may not work correctly as a metadata when pretty_print() subgraph‘s AIMessage #2719

Open
opened 2026-06-05 17:26:27 -04:00 by yindo · 0 comments
Owner

Originally created by @dayuan-Xu on GitHub (Mar 19, 2026).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/3228

Type of issue

issue / bug

Language

Python

Description

There may be an error in https://docs.langchain.com/oss/python/deepagents/subagents#compiledsubagent

research_graph = create_agent(
    model=LLMs["gpt-5-mini"],
    tools=[internet_search],
    system_prompt="You are a great researcher.",
    checkpointer=True,
    name="researchGraph"
)

research_subagent = CompiledSubAgent(
    name="research-agent",
    description="Used to research more in depth questions",
    runnable=research_graph,
)

As shown in the above code, when I print (by pretty_print() method )the AI message inside the subgraph, the actual effective Name is' researchGraph ' instead of ' research-agent ', and even if I only specified the name for the CompiledSubAgent object above but not for the research_graph: Runnable , it does not take effect when beautifying the output subgraph AIMessage.

So I think there is an error in the following content in the document:

CompiledSubAgent
For complex workflows, use a prebuilt LangGraph graph:
Field Type Description
name str Required. Unique identifier for the subagent. The subagent name becomes metadata for AIMessages and for streaming, which helps to differentiate between agents.
description str Required. What this subagent does.
runnable Runnable Required. A compiled LangGraph graph (must call .compile() first).

Originally created by @dayuan-Xu on GitHub (Mar 19, 2026). Original GitHub issue: https://github.com/langchain-ai/docs/issues/3228 ### Type of issue issue / bug ### Language Python ### Description There may be an error in https://docs.langchain.com/oss/python/deepagents/subagents#compiledsubagent ```python research_graph = create_agent( model=LLMs["gpt-5-mini"], tools=[internet_search], system_prompt="You are a great researcher.", checkpointer=True, name="researchGraph" ) research_subagent = CompiledSubAgent( name="research-agent", description="Used to research more in depth questions", runnable=research_graph, ) ``` As shown in the above code, when I print (by pretty_print() method )the AI message inside the subgraph, the actual effective Name is' researchGraph ' instead of ' research-agent ', and even if I only specified the name for the CompiledSubAgent object above but not for the research_graph: Runnable , it does not take effect when beautifying the output subgraph AIMessage. So I think there is an error in the following content in the document: CompiledSubAgent For complex workflows, use a prebuilt LangGraph graph: Field Type Description name str Required. Unique identifier for the subagent. The subagent name becomes metadata for AIMessages and for streaming, which helps to differentiate between agents. description str Required. What this subagent does. runnable Runnable Required. A compiled LangGraph graph (must call .compile() first).
yindo added the externaldeepagents labels 2026-06-05 17:26:27 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2719