Skip to main content

Work with data and functions in apps

Use this guide to learn how to connect resources and write functions in apps. For the full list of resources available in apps, refer to the resources reference.

Connect resources

As you build, the agent connects to your app. The agent can only connect resources for which you have Edit or Own access. Learn more about access rules.

When building an app, 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 can view the schemas of available resources and intelligently suggest those to which you can connect. You can always deny or remove these resources.

Admins control who can use, edit, and manage resources at an organization level. They can also create resource environments in order to further control access to sensitive production data.

Write functions

Code in your app that accesses a resource is called a function. While the agent is building, you will be asked to approve functions before they run. You can also click See details to open the Function playround.

If you cancel the function run, the agent asks you what can be done to improve the function with a pop-up in the Build tab.

Function playground

Inside the Function playground, you can view and edit the parameters for the function, run the function, and view the function's run history.

You can also choose to view the exact code that the function runs against the resource, or visualize the control flow of the function as connected blocks, similar to a workflow.

Trigger workflows

To trigger a workflow from your app, open the Chat tab and prompt your agent with the workflow's name.

Update my app so that the Customer Feedback table retrieves data using the Retrieve Survey Feedback workflow.
Create a new app that tracks our quarterly sales KPIs. For the data, use the Calculate Conversion Rate workflow as well as the lifetime_value and quota_attainment tables in @Retool Database.

The triggered workflow is run on behalf of the app's authenticated user.

Return data to the app

Workflows run from within an app operate in a similar way to a webhook-triggered workflow.

In order to make data from the workflow available to the app, you must include a Response block in the workflow. The data returned from the Response block is sent to the app once the workflow run completes. If you want to trigger a workflow without returning data back to the app, you don't need a Response block.

Capabilities and limitations

The following tabs show a summary of the current capabilities of the app builder. Limitations describe functionality that isn't yet supported in apps but may exist in classic apps.

  • Connect to data through Retool resources.
  • Tag a specific resource with @ in the Chat tab to direct the agent.
  • Let the agent investigate resource schemas and suggest the most appropriate resource.
  • Compose multi-step, strongly-typed functions that combine resource queries and JavaScript queries.
  • Run functions serverlessly on Retool's backend.
  • Test functions with sample parameters in the Function playground.
  • Trigger workflows from functions.