Agentic workflows
Learn about agentic workflows and how they differ from standalone agents and workflows.
Retool Agents work well for open-ended, dynamic tasks, but they may not be optimal for well-structured tasks that can be encoded into discrete steps. For less flexible tasks that still require the use of an LLM, it may be more beneficial to use an agentic workflow.
Agentic workflows are deterministic workflows that have some LLM-enhanced steps. The overall sequence of steps in the workflow is determined ahead of time by the programmer, and the programmer identifies the steps where an LLM will generate content or make a decision. To create an agentic workflow in Retool, create a workflow that utilizes an AI Action block or an Agent block.
Watch the following video for further exploration of agents and agentic workflows:
Choosing an agent or agentic workflow
Whether you should use an agentic workflow or use an agent is based on the open-endedness of the task. Tasks that are more open-ended, require a great deal of decision making, and have a large range of possible outcomes are more suited to using an agent. On the other hand, tasks that are narrowly scoped, require limited decision making, and have few possible outcomes are more suited to agentic workflows. In practice, most real-world AI use cases are a combination of deterministic code, Agentic workflows, and Agents, all composed together to optimally solve a problem.
Refer to the following table and diagram for a deeper exploration of the difference between agents and agentic workflows:
Agent | Agentic Workflow | |
---|---|---|
Determinism | Non-deterministic. | Deterministic. |
Tool usage | Works best when allowed to dynamically chooses between a set of tools. | Works best when given a small set of tools to accomplish a task in a specific way. |
Outcomes | Outcomes may be unpredictable and creative. | Outcomes are predictable and straightforward. |
Cost | Higher cost due to indeterminate run time and iterations. | Lower cost due to fixed run time. |
Evaluate use case
An agent and agentic workflow can both be used to accomplish the same goal. It is wise to evaluate both methods to determine which is more effective based on your goals.
For example, imagine that you work on a customer service team and are routinely asked to perform refunds. You want to automate this work in some way. You could accomplish this goal with an agent or an agentic workflow.
- Agent
- Agentic Workflow
Create an agent to independently investigate refund requests, perform the refund, email the customer, and update the record in the CRM. The agent must have access to a set of tools:
- Get any past refund and support requests.
- Get billing information.
- Get product usage for the customer.
- Request more information from the customer.
- Submit refund payment through Stripe.
- Email the customer with the outcome of their request.
- Send a Slack message to the billing team with the outcome of the request.
- Update the customer's status in the CRM.
Instruct the agent to evaluate the customer information using the tools provided and determine if they should be issued a refund. The agent can then independently issue a refund through Stripe if approved, and email the outcome to the billing team. In this scenario, you must be comfortable with allowing the agent to creatively and non-deterministically email the customer for more information, resolve the issue, and refund the customer if necessary.
Create an agentic workflow that handles refund requests. In order to determine whether the customer gets the refund, the workflow uses an Agent block to call an agent that has access to the following set of tools:
- Get any past refund and support requests.
- Get product usage for customer.
Instruct the agent to evaluate whether a refund should be issued, and return a true
or false
value. The agentic workflow doesn't have the same ability to reason and act independently as the pure-agent solution does. In this scenario, the developer has full control over the majority of the process—performing the refund, emailing the customer, and updating the record in the CRM—and the agent makes a decision on whether a refund should be issued using limited information.