-
Version: Problem: However setting @tool(return_direct=True) to true or false has no effect. I also tried StructuredTool.from_function(func=get_report, return_direct=True). The message flow is exactly the same. Here is the code:
Is there anything missing? Or is it a bug? Thx for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
In your graph, you've written a direct edge
|
Beta Was this translation helpful? Give feedback.
In your graph, you've written a direct edge
builder.add_edge("tools", "assistant")
. This means "always return to the assistant after the tools node is called." If you're writing your own graph and not using a higher-level prebuilt abstraction, then you'll also have to include the logic on whether or not to return directly yourself. In this case you'd replace that with a conditional edge and then check to see whther the tool message is from a tool you've marked with `return_direct.return_direct
is designed for and correctly interpreted by higher level abstractions likecreate_react_agent
or LangChain's legacyAgentExector
.