Skip to main content

Looker Integration

Oxygen integrates with Looker to enable agents and automations to query Looker explores directly. The integration supports metadata synchronization, LLM-powered query generation, and automation support.

Prerequisites

  • A Looker instance with API access enabled
  • API credentials (client ID and client secret) from your Looker admin panel
  • Oxygen CLI installed

Configuration

Add your Looker integration to config.yml:

Configuration Options

  • client_id_var - Name of the environment variable storing your Looker API client ID
  • client_secret_var - Name of the environment variable storing your Looker API client secret
  • base_url - Your Looker instance URL including the API port (typically :19999)
  • explores - List of Looker explores to make available
    • model - The LookML model name
    • name - The explore name
    • description - Optional description for agent context

Authentication

Oxygen authenticates with Looker using OAuth 2.0 client credentials. Store your credentials as environment variables:
To generate API credentials in Looker:
1

Navigate to Looker Admin

Go to your Looker instance and navigate to Admin > Users.
2

Edit API keys

Select your user (or a service account) and click Edit Keys under the API section.
3

Create new API credentials

Click New API Key. Copy the Client ID and Client Secret — the secret is only shown once.
4

Set environment variables

Export the credentials in your shell or add them to your .env file:

Metadata Synchronization

Before querying, you need to sync explore metadata from Looker. This downloads field definitions (dimensions, measures, views) so that agents have context for generating queries.

Sync Commands

How Metadata Storage Works

Synced metadata is stored in two layers:
  • Base metadata (auto-generated, git-ignored): ~/.local/share/oxy/.looker/<integration>/<model>/<explore>.yml
  • Overlay metadata (user-managed, version-controlled): looker/<integration>/<model>/<explore>.yml in your project directory
The overlay file lets you add custom descriptions, agent hints, and query examples that are merged with the base metadata at runtime.

Overlay Metadata Example

Using Looker in Agents

Add a Looker tool to your agent configuration to let the agent query Looker explores:
The agent receives synced metadata (dimensions, measures, descriptions, and any overlay hints) as context. It uses this to generate Looker query parameters — including fields, filters, and sorts — and executes them via the Looker API.

Looker Filter Syntax

Looker uses its own filter syntax, not SQL expressions. When writing overlay hints for agents, include examples using native Looker filter syntax:

Using Looker in Automations

Add a Looker query task to your automation:

Query Parameters

  • fields - List of dimension and measure names to include (use full view.field_name format)
  • filters - Map of field names to Looker filter expressions
  • filter_expression - Optional filter expression for complex OR conditions
  • sorts - List of sort objects, each with field and direction (asc or desc, defaults to asc)
  • limit - Maximum number of rows to return (use -1 for unlimited)

CLI Commands

Test Connection

List Synced Explores

Troubleshooting

  • Authentication errors - Verify your client ID and secret are correct and that the environment variables are exported. API credentials may expire if rotated in the Looker admin panel.
  • Connection refused - Ensure the base_url includes the correct port (Looker API typically runs on port 19999).
  • Empty metadata after sync - Check that the explores listed in your configuration exist in Looker and that your API credentials have permission to access them.
  • Query errors with filters - Looker uses its own filter syntax, not SQL. Use expressions like "last 30 days" instead of SQL date functions.