Explainer: how to let AI call functions in Retool Workflows

Hey business developers and Retool team,

On the road to implement agentic AI in Retool, I've figured out my path and I thought it could be helpful to share with you.

** I cannot yet add the JSON file here, as I'm a new user of the forum.*

In order to create agents, our AI models need to be able to call tools. Tools are actually nothing more than functions.

**Step 1: **
Go to Retool Workflows and create a function named getBeer (so it can be called using getBeer()). I'm creating a REST call to https://random-data-api.com/api/v2/beers which provides me with a random beer in JSON-format each time it's called.

Step 2:
Create an AI action called createPlan that generates text. Let it create the plan using a smaller model, such as gpt-4o-mini.

Input:

Hi, I'm curious to know about a random beer. I'd like to know its name, its style and its hop, so make sure that's part of the plan.

System Message:

Propose a plan to solve the task. You have access to 1 action but you cannot execute it:

* getBeer() which retrieves details of a random beer.

Temperature can be set to 0.7 to reduce creativity.

Step 3:
Create an AI action that executes the function based on the plan. It needs a model that can execute functions, so I used gpt-4.1.

Input:

The plan you should execute is:
{{ createPlan.data }}

You have access to action getBeer()

System Message:

You will receive a plan. Execute the plan and possible actions and only provide the output of the last step after executing all steps.

Temperature to 0.7 here as well.

Step 4:
Run the workflow and see how it returns the name, style and hop contents of a random beer.

Hope this helps you build agentic AI that can use tools (functions) in Retool Workflows.

Let me know if I can assist with anything.

Robin

2 Likes

Very cool, @robinpapa! Welcome to the community and thanks for sharing. On the topic of AI, you might be interested in seeing some of the announcements that we have planned. :grin:

2 Likes

Hey Darren, thanks! Definitely joining on the 28th. I'm working on a client project where I'm developing internal tooling for an accountancy agency and the more we can explore agentive AI, the better.

Looking forward to more news regarding AI.

1 Like