Calling Children Flows
Learn how to effectively use the Chatflow Tool and the Custom Tool
Last updated
Learn how to effectively use the Chatflow Tool and the Custom Tool
Last updated
One of the powerful features of Tailwinds is that you can turn flows into tools. For example, having a main flow to orchestrate which/when to use the necessary tools. And each tool is designed to perform a niece/specific thing.
This offers a few benefits:
Each children flow as tool will execute on its own, with separate memory to allow cleaner output
Aggregating detailed outputs from each children flow to a final agent, often results in higher quality output
You can achieve this by using the following tools:
Chatflow Tool
Custom Tool
Have a chatflow ready. In this case, we create a Chain of Thought chatflow that can go through multiple chainings.
Create another chatflow with Tool Agent + Chatflow Tool. Select the chatflow you want to call from the tool. In this case, it was Chain of Thought chatflow. Give it a name, and an appropriate description to let LLM knows when to use this tool:
Test it out!
From the response, you can see the input and output from the Chatflow Tool:
With the same example as above, we are going to create a custom tool that will calls the Prediction API of the Chain of Thought chatflow.
Create a new tool:
ideas_flow
Use this tool when you need to achieve certain objective
Input Schema:
input
string
input question
Javascript Function of the tool:
Create a Tool Agent + Custom Tool. Specify the tool we've created in Step 1 in the Custom Tool.
From the response, you can see the input and output from the Custom Tool:
In this example, we have successfully demonstrate 2 ways of turning other chatflows into tools, via Chatflow Tool and Custom Tool. Both are using the same code logic under the hood.