Skip to content

return_direct in Tool Decorator has no effect #2950

Answered by hinthornw
koenigfb asked this question in Q&A
Discussion options

You must be logged in to vote

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 like create_react_agent or LangChain's legacy AgentExector.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vbarda
Comment options

@koenigfb
Comment options

Answer selected by vbarda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants