Retool Agentic Workflow with AI Actions
The following lab demonstrates how to create an agentic workflow using Retool AI Action blocks. These blocks will help classify specific parameters assisting the workflow to route based on identified combinations.
Requirements
- Retool Workflows
- Retool AI
Steps
In this example we will leverage AI Actions to pass in a support ticket and perform different classifications. The classifications will focus on:
- Identifying what the traveler issue is, (lost bag | missed flight | change flight).
- Extracting sentiment of the customer, (positive | negative).
- Identifying the traveler type, (frequent flyer | standard traveler).
This extracted information can then power a workflow to make intelligent routing decisions. From an architecture perspective, the following is a simple diagram showing Retool Workflow integrating with an LLM Provider for classification.

Create Workflow
Let's now build a workflow that uses AI Actions to perform the classications steps and intelligent routing.
- Select Retool Home > Workflows > Create
- Update the name to
Frequent Flyer Agentic Workflow
. - Delete the
code
block as it is not required for this example.
startTrigger block
The startTrigger will be configured to have a test input, that has three different tickets (ticket1, ticket2, ticket3).
- Modify the startTrigger block Test JSON Parameters and enter the following:
{"ticket1":"I have lost my baggage and need someone to help me locate it!
This is the third time this has happened in the past month and I am an
exclusive frequent flyer on Air New England! This shouldn't be happening.
Maybe I should switch to Nantucket Air!","ticket2":"I am a frequent flyer
and I need help because I missed my flight.","ticket3":"I have missed my
flight and need help."}
The following is an image of the completed block:

customerIssue AI Action block
This block will use AI to determine if it finds mentions of lost baggage
, missed flight
, or change flight
.
- Next create a new AI Action block by selecting the green dot on the right-hand side of the startTrigger block.
- Specify AI Action.
- Update the name to
customerIssue
.- Set Action to
Classify text
. - Enter the following Input.
Examine the following ticket details and classify what issue it relates to:
<ticket>
{{ startTrigger.data.ticket3 }}
</ticket>- In Classification labels type the following entries and then select them when they appear to add them to an enumerated list.
- Lost baggage
- Missed flight
- Change flight
- Set Action to
The following is an image of the completed block:

sentimentAnalysis AI Action block
This next block focuses on identifying sentiment in the ticket, whether we have positive or negative sentiment.
- Next create a new AI Action block by selecting the green dot on the right-hand side of the customerIssue block.
- Specify AI Action.
- Update the name to
sentimentAnalysis
.- Set Action to
Classify text
. - Enter the following Input.
Examine the submitted ticket details and determine the sentiment of the traveller.
<ticket>
{{ startTrigger.data.ticket3 }}
</ticket>- In Classification labels type the following entries and then select them when they appear to add them to an enumerated list.
- positive
- negative
- Set Action to
The following is an image of the completed block:

frequentFlyer AI Action block
This block looks to identify whether there is a mention of frequent flyer or not in the ticket. This will help with route prioritization later in the workflow.
- Next create a new AI Action block by selecting the green dot on the right-hand side of the customerIssue block.
- Specify AI Action.
- Update the name to
frequentFlyer
.- Set Action to
Classify text
. - Enter the following Input.
Examine the submitted ticket details and determine if the traveller is a frequent flyer.
<ticket>
{{ startTrigger.data.ticket3 }}
</ticket>- In Classification labels type the following entries and then select them when they appear to add them to an enumerated list.
- frequent flyer
- standard flyer
- Set Action to
The following is an image of the completed block:

routeSupportRequest Branch block
With the previous steps completed, we now have three parameters we can use for routing of the request.
- Next create a new Branch Action block by selecting the green dot on the right-hand side of the frequentFlyer block.
- Specify Branch.
- Update the name to
routeSupportRequest
. - In the if section enter the following value:
frequentFlyer.data === "frequent flyer" && sentimentAnalysis.data === "negative"
The following is an image of the completed block with the followup escalation and standard paths:

escalationPath
For the escalation path, we will see a console output that demonstrates that the ticket information matched.
- Next create a Code block by selecting in the if section, the dot on the right-hand side of the routeSupportRequest block.
- Specify Code
- Update the name to
escalationPath
. - Update the code block with the following JavaScript:
let response = "Escalating this request to make sure your frequent flyer experience is positive. We will contact you regarding " + customerIssue.data + ".";
return response;
standardPath
For the standardPath we will just log a console output that is different demonstrating that the correct path was executed.
- Next create a Code block by selecting in the else section, the dot on the right-hand side of the routeSupportRequest block.
- Specify Code
- Update the name to
standardPath
. - Update the code block with the following JavaScript:
let response = "Thank you for informing us about " + customerIssue.data + ". We will be contacting you as soon as our agent is available";
return response;
Test Workflow
To test the workflows, we will use the parameters ticket1
, ticket2
, and ticket3
.
- In each of the AI Action blocks change the parameter from
ticket3
toticket1
for example. - Then select Run and examine the results. The values should show,
lost baggage
,negative
, andfrequent flyer
, routing it to the escalationPath block.
Completed Examples
You can import the following examples and compare with what you have built.
Summary
This lab demonstrates the use of Generative AI / Classify text as a mechanism to have LLMs output route requests within Retool Workflows.