Author LookML with Agentic Coding Tools

1. Introduction

Agentic code authoring tools based on the VS Code ecosystem have become very popular. Cursor and Antigravity are just two examples. This codelab will demonstrate how LookML can be written with these code tools.

What you'll do

In this codelab, you will use Looker's VS Code extension to modify a LookML model in order to add a new measure, test the new measure, then build a LookML dashboard using that new measure. All this will be done by prompting a Coding Agent.

What you'll need

  • A Looker instance where you have developer privileges.
  • Basic familiarity with Looker, including Creating a new LookML project, Viewing and interacting with Explores in Looker.
  • An API client_id and client_secret for your user on the Looker instance.
  • VS Code based Coding Agent. For this guide, we will use Antigravity.
  • A GitHub account.
  • A Google Cloud project with BigQuery enabled.

Audience: LookML Developers, Data Engineers, and Architects.

2. Set up your Looker instance

Create a Google Cloud Project

  1. In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.
  2. Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

Connect Looker to the datasource

  1. In Looker, under Admin go to the Databases heading and select Connections.
  2. Click Add Connection in the top right of the screen.
  3. Create a new data source for the Cymbal Gadgets dataset. Name it cymbal_gadgets. Select Google BigQuery Standard SQL for the SQL Dialect. Screenshot of general connection settings
  4. On the next page, enter your Google Cloud project name, the storage project looker-private-demo, and the dataset name cymbal_gadgets. Screenshotof database settings
  5. Accept the defaults for all remaining fields and complete the new data source creation process.
  6. In the SQL Runner confirm that you can query the dataset by running
    SELECT count(*)
    FROM looker-private-demo.cymbal_gadgets.transactions
    

Import the project from GitHub

  1. Fork the project https://github.com/looker-open-source/cymbal_gadgets from GitHub into your own repository. You cannot add a deploy key to a project you don't own, so forking is necessary to link the project to Looker.
  2. Enable Development Mode.
  3. Select Develop then Projects.
  4. From the LookML Projects page click New Model.
  5. Click the link to use the old LookML Model creation page. Screenshot of the old model creation dialog link
  6. Create a new blank project in Looker named cymbal_gadgets. Screenshot of new project dialog
  7. Choose Configure Git to connect it to the forked repository you created. Screenshot of git setup
  8. Add the Deploy Key to your Git repository. Be sure to click to box to allow write access with the deploy key. Screenshot of git deploy key setup
  9. Then choose Test and Finalize Setup. Screenshot of completed project setup
  10. Verify that the project and the data source work by querying data from the explore "🛍️ Cymbal Gadgets: Transactions & Sales".
  11. Open the cymbal_gadgets project in the LookML editor and press the Create Developer Copy button in the upper right.
  12. Under Git Actions click Push Changes To Remote so that the dev branch is available from GitHub. Screenshot of Git Actions
  13. From a terminal session on your computer, run the following:
    cd $HOME
    git clone git@github.com:YOUR_GITHUB_USER/cymbal_gadgets.git
    cd cymbal_gadgets
    git checkout YOUR_DEV_BRANCH
    
    Substitute your GitHub user account name for YOUR_GITHUB_USER. Also substitute your dev branch name for YOUR_DEV_BRANCH. Your dev branch will be named something like dev-john-doe-jhgr - that is the word dev followed by your first and last name, followed by a short random string. You will find your personal dev branch at the top of the LookML editor in the Looker UI.

3. Setup up your Agentic IDE

Install VS Code extension

In the IDE, click the Extensions icon on the left panel. Then search for "Looker" and install the official extension from Google by clicking the install button.

Install MCP Toolbox for Databases server

To provide Antigravity with access to the Looker API (run queries, inspect SQL, inspect the LookML model, and inspect connection schema information), you need a running, local MCP Toolbox for Databases server. MCP Toolbox comes with the official Looker MCP implementation. In this section you will set this up and configure it for your Looker instance.

  1. First you need an API client_id and client_secret. Use the Looker API Keys guide to generate the client_id and client_secret for your user. You will also need the base URL for your Looker instance.
  2. Now you will use npx to install the MCP Toolbox. You can provide your Looker instance URL and API credentials as inline environment variables, or you can set them in your shell environment. Run this in shell environment for Mac and Linux:
    LOOKER_BASE_URL="https://your-instance.looker.com" \
    LOOKER_CLIENT_ID="YOUR_CLIENT_ID" \
    LOOKER_CLIENT_SECRET="YOUR_CLIENT_SECRET" \
    npx @toolbox-sdk/server --prebuilt=looker,looker-dev
    
    For Windows, run this in Powershell:
    $env:LOOKER_BASE_URL="https://your-instance.looker.com"
    $env:LOOKER_CLIENT_ID="YOUR_CLIENT_ID"
    $env:LOOKER_CLIENT_SECRET="YOUR_CLIENT_SECRET"
    npx @toolbox-sdk/server --prebuilt=looker,looker-dev
    

Configure the VS Code extension

In this step, you will configure the VS Code extension to connect to Looker and the Looker MCP server.

  1. In Antigravity, use CMD-SHIFT-P (Mac) or CTRL+SHIFT+P (Linux/Windows) to open the command palette and choose Preferences: Open Workspace Settings (JSON).
  2. Add the following to your Workspace Settings to configure the extension using client_id and client_secret. For the looker.projectId use cymbal_gadgets:
    {
       "looker.instanceURL": "https://your-instance.looker.com",
       "looker.clientId": "YOUR_API_KEY_CLIENT_ID",
       "looker.clientSecret": "YOUR_API_KEY_CLIENT_SECRET",
       "looker.projectId": "cymbal_gadgets"
    }
    

Open your editor

  1. Open Antigravity.
  2. Click File > Open Folder....
  3. Navigate to and select the cymbal_gadgets folder.

4. Create a Customer Lifetime Value measure

First you will create a new measure in the existing LookML model using the Agent. A Customer Lifetime Value measure will be useful in this retail use case. You will use the Agent to determine the methodology and LookML for this measure.

Prompt the Agent

In the cymbal_gadgets project in your Antigravity workspace, you should have a new conversation interface on the right. Start the conversation in Planning mode using the latest Gemini model with the prompt: Create a Customer Lifetime Value measure.

Screenshot of the prompt in Antigravity

Check the implementation plan

The Agent will first create an implementation plan. Open the implementation plan to review it, then click the Proceed button.

Screenshot of the implementation plan

Review the LookML

Review the changed LookML. Make sure that the changes make sense and are valid.

Screenshot of the changed LookML

The modified LookML is automatically synced with Looker by the VS Code extension. It can be tested in Development Mode.

Test in IDE

Prompt Antigravity to query CLV broken down by customer loyalty tier. Antigravity will use the Looker MCP Server to find the models, examine the available fields, and run a query using Looker. The result will be something like this:

Screenshot of data in Antigravity

Test in Looker

In Looker, with Development Mode activated, open the 🛍️ Cymbal Gadgets: Transactions & Sales explore. Select the Customer Lifetime Value measure then pivot by the Customer Registration Year. Run the query. It should look similar to this.

Screenshot of the explore

5. Create a Customer Lifetime Value dashboard

Now we are going to try a more complex example. We will ask the agent to create an entirely new LookML dashboard.

Request a new dashboard from the Agent

Switch back to Antigravity. In the same conversation, ensure Planning mode and the latest Gemini model are selected. Then prompt Create a dashboard showing customer lifetime value based on customer loyalty tier.

Screenshot of the dashboard creation

Again, approve the implementation plan and accept the code changes. Now this new LookML file will sync with Looker automatically.

Test in Looker

In Development Mode, navigate to the folder LookML Dashboards. Select the newly created dashboard to view it.

Screenshot of new dashboard

6. Clean up

  1. In Antigravity under the Source Control pane, revert the LookML changes if wanted. Next to each modified LookML file there will be a symbol like ↶ to revert the file. Press that button for each file. Screenshot of revert changes
  2. In Looker select Admin then Database then Connections. Click the gear icon for the cymbal_gadgets connection and choose Delete. Confirm that you want to delete the connection.
  3. In Looker use Development Mode. Select Develop then the cymbal_gadgets project. Under Project Settings select Delete Project. Confirm that you want to delete the project by typing the name of the project - cymbal_gadgets - then selecting the button labeled Permanently Delete cymbal_gadgets.

7. Congratulations

Congratulations for completing the codelab.

What we've covered

  • How to modify LookML with an Agent.
  • How to verify implementation plans.
  • How to test from the IDE.
  • How to test in the Looker UI.
  • How to create a new dashboard with an Agent.

Things to try

Now try the following prompts in the UI to see different capabilities of the agentic IDE:

  • Good descriptions are critical for both users and AI. Prompt the Agent to add descriptions to all the fields that don't have one.
  • Ask the Agent to add more timeframes to one of the Dimension Groups.
  • Ask the Agent to perform a query like "revenue broken down by product category pivoted by Quarter."

Learn more