Skip to content
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ web-common/tests/projects
web-local/tests/data

.env
.example.env
*.sql
*.bin
*.csv
Expand Down
5 changes: 5 additions & 0 deletions integrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Rill Integration

## Google Gemini Integration

Enhance your Rill Data experience with the Gemini integration, enabling advanced data analysis. Explore the [Gemini README](gemini/README.md) for detailed information on installation, configuration, and usage.
4 changes: 4 additions & 0 deletions integrations/gemini/.example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Rill Configuration
RILL_ORG="demo"
RILL_PROJECT="demo-project"
RILL_ACCESS_TOKEN="rill_usr_1234567890abcdef"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where precisely will users provide these values? I'm seeing placeholders both here and in integrations/gemini/gemini-extension.json. Ideally there's just one place, and ideally it's a single snippet they can copy/paste from their AI tab.

77 changes: 77 additions & 0 deletions integrations/gemini/GEMINI.md

@ericpgreen2 ericpgreen2 Nov 5, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this language seems to be addressed to the end user (e.g. "By connecting to your Rill projects, the Gemini agent can..."), not the Gemini agent. I'd expect that the document would be exclusively addressed to the Gemini agent.

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
## Rill Gemini Integration

The Rill Gemini Integration enables advanced data analysis and visualization using Rill's AI-powered agent capabilities. By connecting to your Rill projects, the Gemini agent can autonomously explore metrics views, generate insights, and create text-based visualizations to help you understand your data better.

## Chart Generation

If a user asks for data visualization, either from tool use or using your own analysis capabilities, do not build web pages or React apps. For visualizing data, you can use text-based techniques for data visualization:

Bar Charts using block characters:

Q1 ████████░░ 411

Q2 ██████████ 514

Q3 ██████░░░░ 300

Q4 ████████░░ 400

Horizontal progress bars: Project Progress:

Frontend ▓▓▓▓▓▓▓▓░░ 80%

Backend ▓▓▓▓▓▓░░░░ 60%

Testing ▓▓░░░░░░░░ 20%

Using different block densities: Trends:

Jan ▁▂▃▄▅▆▇█ High

Feb ▁▂▃▄▅░░░ Medium

Mar ▁▂░░░░░░ Low

Sparklines with Unicode Basic sparklines:

Stock prices: ▁▂▃▅▂▇▆▃▅▇

Website traffic: ▁▁▂▃▅▄▆▇▆▅▄▂▁

CPU usage: ▂▄▆█▇▅▃▂▄▆█▇▄▂

Trend indicators:

AAPL ▲ +2.3%

GOOG ▼ -1.2%

MSFT ► +0.5%

TSLA ▼ -3.1%

Simple trend arrows: Sales ↗️ (+15%) Costs ↘️ (-8%) Profit ⤴️ (+28%)

Pivot tables using text formatting:

| Region | Q1 Sales | Q2 Sales | Q3 Sales | Q4 Sales |
| ------ | -------- | -------- | -------- | -------- |
| North | $120,000 | $130,000 | $125,000 | $140,000 |
| South | $100,000 | $110,000 | $115,000 | $120,000 |
| East | $90,000 | $95,000 | $100,000 | $105,000 |
| West | $110,000 | $115,000 | $120,000 | $130,000 |

## Troubleshooting

### Common Issues

- **Access denied**: Ensure your Rill access token has AI feature permissions
- **No data found**: Verify your project contains metrics views with available data
- **Analysis incomplete**: The agent may need more specific context about what metrics to focus on

### Best Practices

- **Be specific**: Provide clear context about what you want to analyze
- **Trust the process**: The agent will autonomously execute comprehensive analysis
- **Review results**: The agent provides citations for all quantitative claims
- **Ask follow-ups**: Request deeper analysis on specific findings
53 changes: 53 additions & 0 deletions integrations/gemini/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Gemini CLI Extension for Rill Data

Professional data analysis and report generation using Rill's metrics layer.

## Overview

Check out [Rill's Docs](https://docs.rilldata.com) for more information about Rill.

## Installation

Install the extension via GitHub:

```bash
gemini extensions install https://github.com/rilldata/gemini
Comment thread
grahamplata marked this conversation as resolved.
Outdated
```

Install Rill CLI if you haven't already:

```bash
curl https://rill.sh | sh
```

## Configuration

Generate a Rill authentication token:

```bash
rill token issue --display-name "Gemini Extension"
```

Update the extension with your Rill credentials by providing the following information when prompted:

- `Organization`: Your Rill organization name
- `Project`: Your Rill project name
- `Access Token`: Your Rill access token

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do they provide these values?


## Development

### Local Development

To test changes locally:

1. Make your changes to the extension files
2. Install the extension from your local development branch:
```bash
gemini extensions install https://github.com/rilldata/rill --ref=your-branch-name
Comment thread
grahamplata marked this conversation as resolved.
Outdated
```

### Releasing

Extension updates are automatically available when changes are merged to the main branch. Users will be prompted to update when new versions are available.

The extension version is managed through the `gemini-extension.json` file, and users can install specific versions using git refs if needed.
40 changes: 40 additions & 0 deletions integrations/gemini/gemini-extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "rill",
"description": "Professional data analysis using Rill's metrics layer",
"version": "0.1.0",
"displayName": "Rill Analytics",
"contextFileName": "GEMINI.md",
"mcpServers": {
"rill": {
"httpUrl": "https://api.rilldata.com/v1/orgs/${RILL_ORG}/projects/${RILL_PROJECT}/runtime/mcp",
"headers": {
"Authorization": "Bearer ${RILL_ACCESS_TOKEN}",
"X-Rill-Agent": "gemini",
"Content-Type": "application/json"
},
"env": {
"RILL_ORG": "${RILL_ORG}",
"RILL_PROJECT": "${RILL_PROJECT}",
"RILL_ACCESS_TOKEN": "${RILL_ACCESS_TOKEN}"
}
}
},
"settings": [
{
"name": "Organization",
"description": "Your Rill organization name",
"envVar": "RILL_ORG"
},
{
"name": "Project",
"description": "Your Rill project name",
"envVar": "RILL_PROJECT"
},
{
"name": "Access Token",
"description": "Your Rill access token",
"envVar": "RILL_ACCESS_TOKEN",
"sensitive": true
}
]
}
23 changes: 23 additions & 0 deletions integrations/gemini/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "rill",
"version": "0.1.0",
"description": "Data analysis using Rill's metrics layer",
"license": "Apache-2.0",
"type": "module",
"author": {
"name": "Rill Data",
"email": "support@rilldata.com",
"url": "https://rilldata.com"
},
"scripts": {
"build": "echo 'No build required'",
"link": "gemini extensions link .",
"unlink": "gemini extensions uninstall rill",
"format": "prettier --write \"**/*.{ts,js,json,md}\""
},
"repository": {
"type": "git",
"url": "https://github.com/rilldata/rill",
"directory": "integrations/gemini"
}
}
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"workspaces": [
"docs",
"integrations/gemini",
"web-admin",
"web-common",
"web-integration",
Expand Down
8 changes: 8 additions & 0 deletions runtime/ai/ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"net/http"
"reflect"
goruntime "runtime"
"slices"
Expand Down Expand Up @@ -71,6 +72,7 @@ type SessionOptions struct {
CreateIfNotExists bool
Claims *runtime.SecurityClaims
UserAgent string
Headers http.Header
Comment thread
grahamplata marked this conversation as resolved.
Outdated
}

// Session creates or loads an AI session.
Expand Down Expand Up @@ -160,6 +162,7 @@ func (r *Runner) Session(ctx context.Context, opts *SessionOptions) (res *Sessio
id: session.ID,
instanceID: opts.InstanceID,
claims: opts.Claims,
headers: opts.Headers,

runner: r,
logger: logger,
Expand Down Expand Up @@ -361,6 +364,7 @@ type BaseSession struct {
id string
instanceID string
claims *runtime.SecurityClaims
headers http.Header

runner *Runner
logger *zap.Logger
Expand Down Expand Up @@ -457,6 +461,10 @@ func (s *BaseSession) Claims() *runtime.SecurityClaims {
return s.claims
}

func (s *BaseSession) Headers() http.Header {
return s.headers
}

func (s *BaseSession) Title() string {
return s.dto.Title
}
Expand Down
9 changes: 7 additions & 2 deletions runtime/ai/analyst_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ func (t *AnalystAgent) CheckAccess(ctx context.Context) bool {
return false
}

// Only allow for rill user agents since it's not useful in MCP contexts.
if !strings.HasPrefix(s.CatalogSession().UserAgent, "rill") {
// Allow for rill user agents and rill integrations
// TODO: This is a temporary measure until we have a proper authentication mechanism for integrations.
agent := s.CatalogSession().UserAgent
isRillAgent := strings.HasPrefix(agent, "rill")
isRillIntegration := s.Headers().Get("X-Rill-Agent") != ""
Comment thread
grahamplata marked this conversation as resolved.
Outdated

if !isRillAgent && !isRillIntegration {
return false
}

Expand Down
Loading
Loading