Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions libs/langchain_v1/langchain/agents/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,15 +1225,6 @@ async def amodel_node(state: AgentState, runtime: Runtime[ContextT]) -> dict[str
graph.add_edge(START, entry_node)
# add conditional edges only if tools exist
if tool_node is not None:
# Only include exit_node in destinations if any tool has return_direct=True
# or if there are structured output tools
tools_to_model_destinations = [loop_entry_node]
if (
any(tool.return_direct for tool in tool_node.tools_by_name.values())
or structured_output_tools
):
tools_to_model_destinations.append(exit_node)

graph.add_conditional_edges(
"tools",
_make_tools_to_model_edge(
Expand All @@ -1242,7 +1233,7 @@ async def amodel_node(state: AgentState, runtime: Runtime[ContextT]) -> dict[str
structured_output_tools=structured_output_tools,
end_destination=exit_node,
),
tools_to_model_destinations,
[loop_entry_node, exit_node],
)

# base destinations are tools and exit_node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
__start__ --> NoopZero\2ebefore_agent;
model -.-> NoopTwo\2eafter_agent;
model -.-> tools;
tools -.-> NoopTwo\2eafter_agent;
tools -.-> model;
NoopOne\2eafter_agent --> __end__;
classDef default fill:#f2f0ff,line-height:1.2
Expand Down Expand Up @@ -342,6 +343,7 @@
__start__ --> NoopSeven\2ebefore_model;
model --> NoopEight\2eafter_model;
tools -.-> NoopSeven\2ebefore_model;
tools -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
Expand Down Expand Up @@ -374,6 +376,7 @@
__start__ --> NoopSeven\2ebefore_model;
model --> NoopEight\2eafter_model;
tools -.-> NoopSeven\2ebefore_model;
tools -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
Expand Down Expand Up @@ -406,6 +409,7 @@
__start__ --> NoopSeven\2ebefore_model;
model --> NoopEight\2eafter_model;
tools -.-> NoopSeven\2ebefore_model;
tools -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
Expand Down Expand Up @@ -438,6 +442,7 @@
__start__ --> NoopSeven\2ebefore_model;
model --> NoopEight\2eafter_model;
tools -.-> NoopSeven\2ebefore_model;
tools -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
Expand Down Expand Up @@ -470,6 +475,7 @@
__start__ --> NoopSeven\2ebefore_model;
model --> NoopEight\2eafter_model;
tools -.-> NoopSeven\2ebefore_model;
tools -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
Expand All @@ -491,6 +497,7 @@
__start__ --> model;
model -.-> __end__;
model -.-> tools;
tools -.-> __end__;
tools -.-> model;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
Expand Down

This file was deleted.

This file was deleted.