Trigger a workflow as a tool
Learn how to create a tool from a workflow with Retool Agents.
Retool Agents Availability | |||
---|---|---|---|
Cloud-hosted | Public beta | ||
Self-hosted (3.259 Edge) | Public beta | ||
Self-hosted (Stable) | Not currently available |
You can configure your agent to use a workflow as a tool. This is useful for users that already have a workflow that they want to leverage.
Using an agent as a tool does not copy the workflow—it creates a new trigger for the workflow. Any changes that you make to a workflow that is referenced as a tool persist in all uses of that workflow.
For example, a marketing team wants to create an agent that helps them with providing discount codes based on the item catalogue and inventory. If the team already has a workflow that retrieves the catalogue of clothing, they can use that workflow as a tool for your agent without needing to create a custom tool or new workflow.
Features
Key features of workflows as tools include:
- Minimize duplicate work by leveraging existing workflows.
- Share a single workflow between several agents.
- Use the workflow limits, which are longer than those of custom tools.
When a workflow is called by an agent, Retool triggers the workflow as if it was triggered by the first user with admin permissions in your organization. If the workflow requires access to user-authenticated resource, the workflow is run as if it was triggered by the authenticated user.
Requirements
Your workflow must meet the following requirements be used in an agent:
- It must be published.
- It must include a response block.
- It must not have path parameters or headers.
Configure a workflow as a tool
Complete the following steps to add a workflow as a tool:
- Create a new agent or navigate to an existing agent. Open the Configuration tab.
- In the Tools section, click the + Add Tool button.
- Click Use workflow.
- On the Use workflow page, select the workflow that you want to use, or create a new one.
- Enter a Name and Description for your workflow.
- If your workflow uses JSON parameters in the trigger block, add corresponding parameters to the tool configuration. Each parameter must have the same Name and Type as what is used in the workflow. Mark parameters as Required if they are necessary for the workflow run.
- Click Save to finalize your changes.
Billing for workflows as tools
Your organization is billed for a workflow run every time an agent calls a workflow as a tool. The time it takes for your workflow to run also counts towards the billable time for your agent. Refer to the Billing and usage guide for more information.
To avoid being billed for a workflow run, consider using a custom tool instead.