Skip to main content

Data in apps

This guide explains how your data sources are connected to apps, and how functions are used to operate upon them.

Data sources and resources

A data source is a location where you store and perform operations with data. This could be a PostgreSQL database, the Twilio REST API, an Amazon S3 bucket, etc.

A resource is a saved set of user-configured properties that determine how Retool interacts with a data source. You create a resource for each data source you want to use with Retool.

When prompting, you can suggest that the agent uses a particular resource by @-tagging it by name. If you don't know what resource is most appropriate, the agent investigates the schemas of available resources and intelligently suggests which one to use.

To view the resources that your app uses, navigate to the Data tab in the app builder.

Data governance

Organization administrators can configure access to resources by assigning Use, Edit, or Own access to certain permission groups. Learn more in the Permissions documentation.

When using the Chat tab in the app builder, Retool only explores and connects resources for which the user has Edit permission.

In addition, admins can create and configure resource environments in order to further control access to sensitive production data.

Functions

A function is the logic operation that Retool uses to interact with your resources. Functions are multi-step, TypeScript code with typed parameters. Functions run queries against your resources, apply business logic, and return structured results. They are serverless and run on Retool's backend.

Before the agent executes a function that adds, deletes, or modifies data in one of your resources, it sends a human-in-the-loop (HITL) request to you in the Chat tab.

Function composition

Functions can be composed of multiple blocks of logic, and they have a control flow similar to that of a workflow. Functions can be composed of any combination of resource queries and JavaScript queries.

Functions can also have parameters. Function parameters are always strongly typed.

Function playground

To view the functions that your app uses, navigate to the Data tab in the app builder.

The Functions section contains a list of the functions that interact with your connected resources. Each function displays the number of times it has been run during the current session.

Select a function to open the Function playground. You can use the Function playground to enter sample parameters and perform manual function runs. The panel on the right displays the code by default. Click to view a visual representation of the function.