Project flow as Tool
The Project flow as Tool component lets you turn any existing project flow into a reusable tool. Once built, the tool can be called from other parts of your dashboard or from automated scripts, making it easy to reuse complex workflows without having to rebuild them each time.
How it Works
When you provide the name of a flow, the component uses the internal FlowToolInternal
logic to create a tool that calls that flow. The tool is built locally, so no external APIs are involved. The resulting tool can then be used like any other tool in Nappai, returning the flow’s output directly or passing it to other components.
Inputs
- Flow Name: The name of the flow you want to run.
- Return Direct: If selected, the tool will return the flow’s result immediately.
- Description: A short description of what the tool does.
- Name: The name you want to give to the tool.
Outputs
- Tool: A Tool object built from the specified flow. Use this output to connect the tool to other components or to expose it for external use.
Usage Example
- Drag the Project flow as Tool component onto your canvas.
- Set Flow Name to
DataCleanup
. - Set Name to
CleanupTool
. - Set Description to
Runs the data cleanup flow
. - Check Return Direct if you want the tool to give you the result right away.
- Connect the Tool output to a component that needs to execute the cleanup, such as a “Run Tool” node or an automation trigger.
Now, whenever the connected component triggers the tool, the DataCleanup
flow will run and its output will be returned directly.
Related Components
- FlowToolInternal – The base class that provides the core logic for building tools from flows.
- FlowRunner – Executes a flow directly without wrapping it as a tool.
- ProjectFlow – The visual editor where you design and manage flows that can be turned into tools.
Tips and Best Practices
- Use clear names: Give your tool a descriptive name so you can easily identify it later.
- Keep descriptions concise: A short description helps others understand the tool’s purpose at a glance.
- Test the flow first: Run the flow manually before turning it into a tool to ensure it behaves as expected.
- Reuse tools wisely: If multiple parts of your dashboard need the same flow, create a single tool and reference it wherever needed.
Security Considerations
- Permission checks: Make sure only authorized users can build or execute tools that access sensitive data.
- Audit logs: Enable logging for tool executions to track who ran what flow and when.
- Input validation: Verify that the flow name entered exists and is safe to run to avoid accidental execution of unintended flows.