# How to Integrate Retool with H2O.ai

- Tool: Retool
- Difficulty: Advanced
- Time required: 30 minutes
- Last updated: April 2026

## TL;DR

Connect Retool to H2O.ai using a REST API Resource pointed at your H2O instance's REST API endpoints. H2O.ai exposes a comprehensive REST API for managing AutoML runs, comparing model leaderboards, and submitting prediction requests. Configure the base URL to your H2O server, authenticate with API key or session token, and build a model management dashboard where data science teams can monitor AutoML jobs, compare model performance, and deploy the best model for production inference — all without using the H2O Flow UI.

## Why connect Retool to H2O.ai?

H2O.ai's primary interface is H2O Flow — a Jupyter-style notebook UI powerful for data scientists but inaccessible to product managers, business analysts, and ops teams who need to view model results, submit prediction requests, or approve model deployments. Retool fills this gap by providing a structured internal tool interface over H2O's REST API: clean tables showing the AutoML leaderboard, interactive prediction forms, model performance charts, and deployment action buttons — all accessible to non-data-science team members without requiring H2O Flow familiarity.

The most valuable Retool-H2O integrations are model evaluation dashboards and inference testing panels. An AutoML leaderboard dashboard shows all trained models ranked by AUC, RMSE, or log loss with sortable columns and a Bar Chart comparing key metrics visually — enabling faster model selection decisions. An inference panel lets product managers and business stakeholders submit test inputs and see prediction outputs without touching the H2O Flow interface, dramatically reducing the feedback loop between data science and product teams.

H2O-3's REST API (at /3/ endpoints) covers the full ML lifecycle: frame management, model building, AutoML configuration, model inspection, and prediction. The API returns JSON responses with consistent structure across all operations, making it straightforward to build Retool interfaces. H2O Cloud and Driverless AI use a different API surface (at /api/v1/ endpoints with Bearer token authentication) — this guide covers H2O-3 primarily, with notes on Driverless AI where they differ.

## Before you start

- A running H2O-3 cluster accessible via HTTP (local development server, cloud instance, or enterprise deployment)
- The H2O cluster base URL (e.g., http://localhost:54321 for local, or https://your-h2o-host.com for cloud deployments)
- H2O API key or session credentials (for enterprise H2O deployments with authentication enabled)
- At least one completed AutoML run or trained model in the H2O cluster
- A Retool account with Resource creation permissions and network access to the H2O cluster

## Step-by-step guide

### 1. Verify H2O cluster accessibility and configure authentication

Before creating the Retool Resource, confirm your H2O cluster is accessible from Retool's servers. For Retool Cloud, the H2O cluster must be accessible from the internet (or through a VPN tunnel if using Retool's on-premise agent). The default H2O-3 port is 54321 — ensure this port is open in your security group or firewall for Retool Cloud's IP ranges (35.90.103.132/30 and 44.208.168.68/30 for us-west-2). For self-hosted Retool, the cluster can be on the same private network. To check if authentication is enabled on your H2O cluster, make a test request to http://YOUR_H2O_HOST:54321/3/Frames — if it returns a 401, authentication is enabled. H2O Enterprise supports API key authentication: generate an API key in H2O Flow (Admin menu → API Keys) or via the H2O client library. Store this key in a Retool configuration variable named H2O_API_KEY (mark it as secret). If your H2O cluster has no authentication (common for local development), the Resource configuration skips authentication headers. For H2O Cloud (cloud.h2o.ai), authentication uses a Bearer token obtainable from your H2O Cloud profile settings.

**Expected result:** You have confirmed the H2O cluster URL, verified accessibility from Retool's network, and retrieved an API key or Bearer token if authentication is enabled. Credentials are stored in Retool configuration variables.

### 2. Create the H2O REST API Resource in Retool

Navigate to the Resources tab in Retool and click Add Resource → REST API. Name the resource H2O.ai API. Set the Base URL to your H2O cluster's address: http://YOUR_H2O_HOST:54321 for H2O-3, or https://cloud.h2o.ai for H2O Cloud. If your H2O cluster uses authentication, configure the auth header: in the Headers section, add Authorization with the value api_key {{ environment.variables.H2O_API_KEY }} for API key authentication, or Bearer {{ environment.variables.H2O_BEARER_TOKEN }} for H2O Cloud Bearer token auth. The header name for H2O-3 Enterprise API key authentication is typically Authorization with the format api_key YOUR_KEY — verify with your H2O administrator as the exact format can vary by H2O version. If your cluster has no authentication (development mode), skip the auth header configuration. Click Save. Verify the Resource works by creating a quick test query: set the method to GET and path to /3/About — this returns H2O cluster information including the version, Java version, and cluster status. A successful response confirms the Resource is properly configured and Retool can reach the H2O cluster.

**Expected result:** The H2O.ai REST API Resource is saved in Retool, and a test query to /3/About returns the H2O cluster version and status information, confirming the Resource can reach your H2O instance.

### 3. Retrieve the AutoML leaderboard

Create a query named getAutoMLLeaderboard. Set the HTTP method to GET and the path to /3/AutoML. This endpoint lists all AutoML runs in the cluster with their IDs, status, and project names. The response contains an automl_ids array with the key for each AutoML run. Select an AutoML run ID and create a second query to retrieve its leaderboard: GET /3/AutoML/{{ automlSelect.value }}/Leaderboard. The leaderboard response contains column_headers (metric names) and data (an array of rows where each row is a model's metrics as an array of values in the same order as column_headers). Write a JavaScript transformer to zip column headers with data rows into named objects: iterate over data.data, and for each row, create an object using data.column_headers as keys and the row values as values. The first column is typically model_id (a string), and subsequent columns are numeric metrics like auc, logloss, mse, rmse, and mean_per_class_error. Sort the resulting array by the primary metric descending. Drag a Table and bind it to the transformer output. Add a Select dropdown at the top listing AutoML run IDs from the /3/AutoML query result, making the leaderboard update when a different run is selected.

```
// Transformer: convert H2O leaderboard column/data format to named objects
const headers = data.column_headers || [];
const rows = data.data || [];

const models = rows.map(row => {
  const obj = {};
  headers.forEach((header, i) => {
    const value = row[i];
    // Round numeric values to 4 decimal places for readability
    if (header !== 'model_id' && typeof value === 'number') {
      obj[header] = parseFloat(value.toFixed(4));
    } else {
      obj[header] = value;
    }
  });
  // Extract algorithm type from model_id pattern like 'GBM_1_AutoML_...'
  const modelId = obj.model_id || '';
  const algorithmMatch = modelId.match(/^([A-Za-z]+)_/);
  obj.algorithm = algorithmMatch ? algorithmMatch[1] : 'Unknown';
  return obj;
});

// Sort by AUC descending (or RMSE ascending for regression)
return models.sort((a, b) => (b.auc || 0) - (a.auc || 0));
```

**Expected result:** A Table displays the H2O AutoML leaderboard with all candidate models ranked by AUC, each row showing the model ID, algorithm type, and performance metrics across validation and cross-validation sets.

### 4. Build the model comparison chart and add prediction testing

Create a JavaScript transformer that extracts the top 10 models from the leaderboard data for Chart visualization. Drag a Bar Chart component onto the canvas and bind it to this top-10 dataset. Set the X axis to model_id (or a shortened version that includes just the algorithm and number), the Y axis to auc (or whichever is the primary metric for your models), and configure horizontal bar orientation so model names are readable on the Y axis. Add a second Y axis data series for logloss if the Chart component supports dual axes. Below the Chart, create a prediction testing panel. Add a Text Area component labeled Input Features (JSON) with placeholder text showing the expected feature format for your models. Create a query named submitPrediction: POST to /3/Predictions/models/{{ modelTable.selectedRow.model_id }}/frames using a multipart/form-data or JSON body with the test data. Note that H2O's prediction endpoint requires data to already be loaded as an H2O Frame — for online inference from Retool, the recommended pattern is to use /3/Predictions with a pre-loaded test frame, or export the model to MOJO format and serve it via a separate REST endpoint. For simple testing, pre-load a small test frame in H2O and reference its frame_id in the Retool prediction query.

```
// Transformer: prepare top 10 models for Bar Chart
const leaderboard = getLeaderboard.data || [];
const top10 = leaderboard.slice(0, 10);

return top10.map(model => {
  // Shorten model_id for chart label: 'GBM_1' instead of 'GBM_1_AutoML_1_20240615_123456'
  const shortId = (model.model_id || '').split('_AutoML')[0] || model.model_id;
  return {
    model_label: shortId,
    model_id: model.model_id,
    algorithm: model.algorithm,
    auc: model.auc || 0,
    logloss: model.logloss || 0,
    rmse: model.rmse || 0,
    mse: model.mse || 0
  };
});
```

**Expected result:** A horizontal Bar Chart shows the top 10 H2O AutoML models by AUC, and a prediction testing form allows entering feature values and submitting them to the selected model for inference output.

### 5. Add model inspection and deployment controls

Extend the dashboard with model inspection and deployment action buttons. Create a query named getModelDetails: GET /3/Models/{{ modelTable.selectedRow.model_id }}. The model details response includes the model's algorithm parameters, training and validation metrics, variable importance (if available), and training frame information. Create a transformer to extract variable importance from the response — it lives at data.models[0].output.variable_importances.data and follows the same column/data format as the leaderboard. Display variable importance as a sorted Bar Chart or Table showing which features contributed most to the model. Add a Download MOJO button that calls POST /3/Models.mojo/{{ modelTable.selectedRow.model_id }} to export the selected model as a MOJO file — the response is a binary file that can be served to production inference systems. Add a Deploy to Staging button that triggers a Retool Workflow: the Workflow calls your model serving API (a custom endpoint or MLflow, Seldon, or another model server) to register the selected H2O model for serving, then sends a Slack notification to the ML team channel with the deployed model ID and AUC. For complex ML ops workflows involving multi-environment deployments, approval gates, and automated performance monitoring, RapidDev's team can help architect and build your Retool solution.

```
// Transformer: extract variable importance from H2O model details
const model = (data.models && data.models[0]) || {};
const varImp = model.output?.variable_importances;

if (!varImp || !varImp.data || !varImp.column_headers) {
  return []; // Model may not have variable importance (e.g., GLM without regularization)
}

const headers = varImp.column_headers;
const rows = varImp.data;

return rows
  .map(row => {
    const obj = {};
    headers.forEach((h, i) => { obj[h] = row[i]; });
    return {
      variable: obj.variable || obj.names,
      relative_importance: parseFloat((obj.relative_importance || obj.scaled_importance || 0).toFixed(4)),
      percentage: obj.percentage
        ? (parseFloat(obj.percentage) * 100).toFixed(2) + '%'
        : 'N/A'
    };
  })
  .sort((a, b) => b.relative_importance - a.relative_importance)
  .slice(0, 20); // Top 20 features
```

**Expected result:** A complete H2O.ai ML ops dashboard shows the AutoML leaderboard table, performance comparison chart, variable importance visualization for the selected model, and deployment action buttons that trigger model export and serving registration.

## Best practices

- Store the H2O cluster URL in a Retool configuration variable rather than hardcoding it in the Resource — this makes it easy to switch between development, staging, and production H2O clusters.
- Implement a cluster health check query (/3/About or /3/Cloud) that runs on page load and displays the H2O version and cluster status — this catches connectivity issues before users try to run model queries.
- H2O models are ephemeral and lost on cluster restart — integrate H2O MOJO export into your Retool deployment approval workflow to ensure approved models are persisted before the cluster stops.
- Apply the column_headers + data array flattening pattern consistently across all H2O API responses — this format is used for leaderboards, variable importance, frame summaries, and model metrics, so a reusable transformer utility reduces code duplication.
- Cache the AutoML leaderboard query for 2-5 minutes — model rankings do not change unless new AutoML runs complete, and repeated queries during dashboard navigation add unnecessary load to the H2O cluster.
- For teams where non-data-scientists need to submit prediction requests, deploy H2O models as MOJO scoring endpoints behind a proper API service rather than having Retool call H2O's frame-based prediction endpoint directly — the MOJO approach supports row-level prediction from JSON input without pre-loading data frames.
- Use Retool's secret configuration variables for H2O API keys and never expose them in query paths or visible components — H2O API keys grant full cluster access including data deletion and model training.

## Use cases

### AutoML leaderboard and model comparison dashboard

Build a Retool dashboard that displays the H2O AutoML leaderboard for a completed training run, showing all candidate models ranked by their primary metric (AUC for classification, RMSE for regression). Each row in the Table shows the model ID, algorithm type (GBM, Random Forest, Deep Learning, XGBoost, Stacked Ensemble), and performance metrics across training, validation, and cross-validation sets. A Bar Chart compares the top 10 models by AUC side-by-side. Clicking a model row loads its variable importance and partial dependence plots from H2O's model inspection endpoints.

Prompt example:

```
Build a Retool dashboard that queries the H2O AutoML leaderboard endpoint, displays models in a Table sorted by AUC descending with columns for model ID, algorithm, AUC, logloss, and RMSE, shows a Bar Chart of the top 10 models by AUC, and loads variable importance for the selected model row in a side panel.
```

### Model inference testing panel

Create a Retool prediction testing panel where data scientists and product managers can submit test inputs to a deployed H2O model and review prediction outputs. A Select dropdown lists all available models from H2O's model registry. A dynamic form generates input fields based on the selected model's feature schema. On submission, Retool calls H2O's predict endpoint and displays the prediction values and confidence scores in a Table. A history panel below shows the last 20 predictions with their inputs and outputs for reproducibility.

Prompt example:

```
Build a Retool app with a Select dropdown for available H2O models, a form with labeled input fields for model features, a Submit Prediction button that calls the H2O predict endpoint, and a Table showing prediction results with probability scores. Add a prediction history Table below showing recent submissions with their inputs and outputs.
```

### ML experiment tracking and deployment approval workflow

Build an ML ops panel where data science leads can review AutoML experiments, compare performance across multiple runs, and approve models for production deployment. Each experiment shows training data, feature count, training duration, and the top 3 models from the leaderboard. An Approve for Deployment button triggers an API call to export the selected model to MOJO format or register it in your model serving infrastructure via a downstream Retool Workflow. The approval action is logged to a connected PostgreSQL audit table for compliance tracking.

Prompt example:

```
Build a Retool MLOps panel showing all AutoML experiment runs with their target metric, training duration, and best model performance. Selecting an experiment shows the full leaderboard. An Approve button calls the H2O model export API and triggers a Workflow to register the model in the production serving system, logging the approval to a PostgreSQL audit table.
```

## Troubleshooting

### REST API Resource returns connection refused or timeout errors when querying H2O endpoints

Cause: The H2O cluster is not accessible from Retool's server infrastructure — either the cluster is on a private network without public access, the wrong port is specified, or the H2O process is not running.

Solution: For Retool Cloud, verify the H2O cluster has a public IP or is accessible through Retool's allowed IP ranges. For private clusters, consider using Retool Self-hosted deployed in the same VPC, or expose H2O through an API gateway. Verify the H2O process is running (the H2O logs show 'INFO: H2O cloud ...' on successful startup) and that port 54321 (or your custom port) is open in the security group. Test accessibility independently with a curl request to http://YOUR_HOST:PORT/3/About from a machine on the same network.

### Leaderboard query returns empty data array even though AutoML runs completed in H2O Flow

Cause: AutoML runs in H2O are ephemeral — they exist only as long as the H2O cluster is running. If the cluster was restarted since the AutoML run completed, all trained models and their leaderboards are lost unless explicitly saved.

Solution: In H2O Flow, save the AutoML leaderboard models to a persistent H2O binary format or export them to MOJO files before restarting the cluster. For persistent model storage, integrate H2O with an external model registry (MLflow, DVC) or save models to cloud storage (S3, GCS) from within H2O. Retool can then query the external registry rather than the ephemeral in-memory H2O state.

### Prediction request returns 'Frame not found' error

Cause: H2O's /3/Predictions endpoint requires test data to already be loaded as an H2O Frame in the cluster. Retool cannot send raw CSV or JSON rows directly to this endpoint — the data must be pre-loaded.

Solution: For online inference testing from Retool, use a different approach: export the H2O model to MOJO format and deploy it behind a simple REST endpoint (using H2O MOJO runtime or Java scorer). Then point Retool at this MOJO serving endpoint instead of the H2O cluster's prediction endpoint. Alternatively, pre-load small test datasets as H2O Frames during the H2O session startup and reference those frame IDs for batch prediction testing.

### Variable importance data is empty for the selected model

Cause: Not all H2O model types compute variable importance. GLM models, Deep Learning models without specific settings, and some stacked ensemble configurations may not include variable_importances in their output object.

Solution: Check the model type before querying variable importance: GBM, DRF, and XGBoost models reliably include variable importance. Add a conditional check in your transformer: if (!varImp || varImp.data.length === 0) return []. Display a clear message in the UI when variable importance is not available for the selected algorithm rather than showing an empty chart.

```
// Safe extraction with model type check
const model = data?.models?.[0];
const hasVarImp = model?.output?.variable_importances?.data?.length > 0;
if (!hasVarImp) return []; // Render 'Not available for this model type' in UI
```

## Frequently asked questions

### What is the difference between H2O-3, H2O Driverless AI, and H2O Cloud in terms of Retool integration?

H2O-3 is the open-source ML library with a REST API at /3/ endpoints (port 54321 by default) — this is what most self-hosted integrations target. H2O Driverless AI (DAI) is a separate commercial AutoML product with its own REST API at /api/v1/ with Bearer token authentication and a different endpoint structure. H2O Cloud is the managed SaaS offering of both products. Each requires a different base URL and authentication configuration in Retool, so create separate Resources if you need to access multiple H2O products.

### Can Retool trigger a new AutoML training run on H2O?

Yes. Send a POST request to /3/AutoML with a JSON body specifying the training frame ID, target column name, and optional configuration parameters (max_runtime_secs, max_models, stopping_metric). The response returns an AutoML job key. Monitor job progress with GET /3/AutoML/{job_key} — the response includes a is_running flag and leaderboard updates as models complete training. A Retool Workflow with a loop that polls the job status every 30 seconds can provide automated notification when the AutoML run finishes.

### How do I load data into H2O from Retool for training or prediction?

H2O data loading requires pointing H2O at a data file accessible from the H2O cluster — a local file path, S3 bucket, HDFS path, or HTTP URL. From Retool, trigger a POST request to /3/ImportFiles with a path parameter pointing to the data location. H2O fetches the file and creates a Frame in memory. For CSV data generated by Retool, upload the CSV to S3 using a separate S3 Resource query, then trigger H2O to import it from the S3 path. Direct in-memory data transfer from Retool to H2O is not supported through the REST API.

### What happens to H2O models when the cluster restarts?

H2O-3 stores all frames, models, and AutoML results in memory — when the cluster restarts, all in-memory state is lost. This is the most important operational consideration for H2O integrations. Best practice is to export important models to MOJO or binary format after training (POST to /3/Models.mojo/{model_id}) and store them in persistent storage. For production inference, serve the MOJO from a Java-based scoring service rather than keeping the full H2O cluster running. Retool's deployment workflow should include an automatic MOJO export step before any model is approved for production.

---

Source: https://www.rapidevelopers.com/retool-integrations/h2o-ai
© RapidDev — https://www.rapidevelopers.com/retool-integrations/h2o-ai
