Skip to content

Commit a5b636b

Browse files
authored
Merge pull request #87 from lightdash/docs/ai-agents-rework-and-best-practices
docs: improve ai agents docs
2 parents 33de1b5 + 0f2c562 commit a5b636b

File tree

6 files changed

+132
-60
lines changed

6 files changed

+132
-60
lines changed

guides/ai-agents.mdx

Lines changed: 132 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,160 @@
22
title: "AI agents"
33
---
44

5-
<CardGroup cols={2} iconType="solid" horizontal> <Card title="Cloud Pro" icon="bolt" /> <Card title="Cloud Enterprise" icon="rocket" /> </CardGroup>
5+
<CardGroup cols={2} iconType="solid" horizontal>
6+
{" "}
7+
<Card title="Cloud Pro" icon="bolt" /> <Card
8+
title="Cloud Enterprise"
9+
icon="rocket"
10+
/>{" "}
11+
</CardGroup>
612

7-
Lightdash AI agents transform the way you interact with your data by allowing you to ask questions in natural language and get meaningful insights back. Currently, you can interact with AI agents in Slack or the Lightdash app, with more options coming soon.
13+
## Introduction
814

15+
Lightdash AI agents transform the way you interact with your data by allowing you to ask questions in natural language and get answers back. Whether you're exploring data in Lightdash or collaborating with your team in Slack, AI agents make data analysis as simple as having a conversation.
916

10-
## How it works
11-
12-
Ask questions about your data, and it will:
17+
<Frame>
18+
<img src="/images/guides/ai-agent-chat-intro.png" alt="" />
19+
</Frame>
1320

14-
* Automatically select the most relevant data model and metrics to answer your question
15-
* Build and execute queries with appropriate dimensions, filters, and limits
16-
* Present results in the most insightful format, whether that's a visualization, table, or natural language summary
17-
* Ask clarifying questions when needed to ensure you get exactly what you're looking for
21+
AI agents automatically select the most relevant data models and metrics to answer your questions, build and execute queries with appropriate dimensions, metrics, and filters, and present results in the most insightful format.
1822

1923
<Info>
20-
AI Agents in the Lightdash app will follow row-level, column-level, and table-level data access based on [user attributes](/references/user-attributes).
24+
AI Agents in the Lightdash app will follow row-level, column-level, and table-level data access based on [user attributes](/references/user-attributes).
25+
26+
In Slack, the AI will have the user attributes of the user who set up the agent. We plan to respect user attributes based on Slack user email in the future, reach out if you need that feature!
2127

22-
In Slack, the AI will have the user attributes of the user who set up the agent. We plan to respect user attributes based on Slack user email in the future, reach out if you need that feature!
2328
</Info>
2429

30+
## Get started
2531

26-
## Preparing your data for AI
32+
Getting started with AI agents is simple - you can begin using them right away on any project in your Lightdash instance.
2733

28-
To get the most accurate answers, it's important to properly prepare your dimensions and metrics. The quality of the results depend on the quality of your metadata and documentation.
34+
### Creating your first AI agent
35+
36+
<Frame>
37+
<img src="/images/guides/ai-agent-create.png" alt="" />
38+
</Frame>
2939

30-
Watch a demo below, or keep scrolling for more details.
40+
1. **Find the "Ask AI" button** in your project - this will be your entry point to AI agents
41+
2. **Create a new agent** (only admins and developers can create new AI agents)
42+
3. **Configure your agent:**
43+
44+
- **Name and image** - Give your agent a memorable name and visual identity
45+
- **Instructions (optional)** - Provide context about your models, tables, or specific use cases to help the AI give more relevant responses
46+
- **Tags (optional)** - Use tags to control which metrics and dimensions the agent can access
47+
48+
Once set up, you can start asking questions immediately! Try asking "What kind of data can you access?" to get started.
3149

3250
<Frame>
33-
<iframe width="100%" height="420" src="https://www.loom.com/embed/f38e27fee7784e7f95538613b3b77bb5?sid=a13feb5b-fef3-4f68-9fbf-e54f928c28e5" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen />
51+
<img src="/images/guides/ai-agent-chat-intro-response.png" alt="" />
3452
</Frame>
3553

54+
## What it can do
55+
56+
### Core capabilities
57+
58+
AI agents in Lightdash allow you to:
59+
60+
- **Ask questions in natural language** - Simply type what you want to know about your data, like "What's our total revenue by region?" or "Show me user growth over the last 6 months"
61+
- **Get instant visualizations** - Receive bar charts, time series, and tables automatically generated based on your questions
62+
- **Explore interactively** - Follow up with additional questions, drill down into specific data points, or request different chart types
63+
- **Maintain conversation context** - AI agents remember your conversation history, so you can build on previous questions and refine your analysis
64+
- **Provide text-only responses** - Get answers in natural language when visualizations aren't needed
65+
- **Guide you to the right data** - Direct you to the most relevant explores or tables for your questions
66+
67+
### Using AI agents in Slack
3668

37-
### Documenting your data
69+
Connect your AI agents to Slack for collaborative data analysis and team-wide insights sharing, here's how:
3870

39-
Good documentation is crucial for AI to understand your data models and provide meaningful insights. Here are some key tips:
71+
1. Select or create an AI agent in your Lightdash instance
72+
2. Add the Slack integration in your organization settings
73+
3. Under 'Integrations', add the channel you want to use
74+
{" "}
75+
<Frame>
76+
<img src="/images/guides/ai-agent-set-slack-channel.png" alt="" />
77+
</Frame>
78+
4. Tag your **Slack App** in the channel you want to use
79+
5. Start asking questions like "What kind of data can you access?" or "Show me total order amount over time"
80+
6. Get instant results directly in Slack
4081

41-
* Write clear, descriptive names for metrics and dimensions that avoid acronyms or technical jargon
42-
* Add detailed descriptions to all metrics and dimensions explaining what they represent.
43-
* Descriptions can even include example questions that AI could answer with the metric (e.g. "Useful for answering questions like 'What is the total revenue for the USA?'").
44-
* Use business terminology that would make sense to any user, not just technical teams
45-
* Include units of measurement where applicable (e.g. "Revenue in USD" rather than just "Revenue")
46-
* Document any important caveats or limitations about the data
82+
You can also summon the bot on a thread to continue the conversation. In order for the bot to be able to respond, you need enable this context sharing in your Lightdash Integrations settings.
83+
84+
<Frame>
85+
<img src="/images/guides/ai-agent-slack-thread-consent.png" alt="" />
86+
</Frame>
87+
88+
## Best practices
89+
90+
To get the most accurate and useful answers from your AI agents, follow these best practices for preparing your data and configuring your agents.
91+
92+
### Think specialized, not general
93+
94+
Think of AI agents as your specialized analysts - each one can be configured to focus on specific areas of your business. For example, you might create a "Marketing Assistant" that only has access to marketing data like campaign performance, lead generation, and customer acquisition metrics. This focused approach ensures more accurate, relevant responses and prevents sensitive data from being accessible to the wrong teams. To find out more about how to configure specific access, see [Curating fields with tags](#curating-fields-with-tags).
95+
96+
### Document your data thoroughly
97+
98+
Good documentation is crucial for AI to understand your data models and provide meaningful insights. The quality of the results depend on the quality of your metadata and documentation.
99+
100+
- **Write clear, descriptive names** for metrics and dimensions
101+
- **Add detailed descriptions** to all metrics and dimensions explaining what they represent
102+
- **Include example questions** in descriptions that AI could answer with the metric
47103

48104
Remember: If your colleague wouldn't understand your documentation, neither will the AI agent. The more context you provide, the better the AI can interpret and analyze your data.
49105

106+
## Set up multiple agents
50107

51-
### Curating the fields used by AI agents
108+
You can create multiple AI agents, each configured for different tasks, tones, languages, or teams. Each agent can have access to different datasets to focus results and give more accurate answers.
52109

53-
You can use tags to categorize your metrics and dimensions in your YAML file to control which fields the AI uses. This helps focus the AI on the most relevant data for analysis.
110+
<Frame>
111+
<iframe
112+
width="100%"
113+
height="420"
114+
src="https://www.loom.com/embed/26adbd03cf2049ddb81e015f9756a4bb?sid=dae39714-3c86-4254-af23-bb2def551fba"
115+
frameborder="0"
116+
webkitallowfullscreen
117+
mozallowfullscreen
118+
allowfullscreen
119+
/>
120+
</Frame>
54121

122+
### Limiting access to specific explores/fields
55123

56-
##### Adding tags to metrics & dimensions
124+
For each AI agent, you can configure which fields are used to answer questions using the tags you've defined in your YAML files. You can add one or many tags - fields with **any** of the tags in the list will be considered by the AI agent.
125+
Use tags to control which metrics and dimensions each AI agent can access. This helps focus the AI on the most relevant data for analysis and ensures agents only work with appropriate datasets. You can add tags at the model level to give access to entire explores, or at the individual metric and dimension level for more granular control.
57126

58-
To configure which fields are used by your AI agent, you need to add `tags` to your metrics & dimensions in your YAML files. You can then use these tags when you create a new AI agent to filter the metrics & dimensions available for each AI agent.
127+
#### Adding tags at the model level
128+
129+
Tag entire models to give your AI agent access to all metrics and dimensions within that explore:
130+
131+
```bash
132+
models:
133+
- name: marketing_campaigns
134+
meta:
135+
tags: ['marketing', 'ai'] # <--------- tagging the entire model
136+
columns:
137+
- name: campaign_name
138+
meta:
139+
dimension:
140+
type: string
141+
- name: impressions
142+
meta:
143+
metrics:
144+
total_impressions:
145+
type: sum
146+
```
147+
148+
#### Adding tags to individual metrics & dimensions
149+
150+
For more granular control, tag specific metrics and dimensions:
59151

60152
```bash
61153
- name: orders
62154
columns:
63155
- name: status
64156
meta:
65157
dimension:
66-
tags: ai # <--------- tagging the dimension
158+
tags: ['ai', 'sales'] # <--------- tagging the dimension
67159
- name: location
68160
meta:
69161
dimension:
@@ -76,41 +168,21 @@ To configure which fields are used by your AI agent, you need to add `tags` to y
76168
type: sum
77169
format: usd
78170
round: 2
79-
tags: ai # <--------- tagging the metric
171+
tags: ['ai', 'finance'] # <--------- tagging the metric
80172
```
81173

82-
##### Configuring tags used by each agent
83-
84-
For each AI agent, you can configure which fields are used to answer questions using the tags you've defined in your YAML files.
85-
86-
You can add one or many tags to this list. Fields with **any** of the tags in the list will be considered by the AI agent in that Slack channel.
87-
88-
![](/images/guides/ai-agent-tags.png)
89-
90-
91-
### Providing custom instructions
92-
93-
You can provide custom instructions to each AI agent on its settings page. Watch the video to learn more.
94-
95-
<Frame>
96-
<iframe width="100%" height="420" src="https://www.loom.com/embed/3449c632b5ab4ad1854fe17b53a98487?sid=7782be68-1a14-4b9a-96a9-fb21eb04743d" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen />
97-
</Frame>
98-
99-
100-
### Setting up multiple agents
101-
102-
Here's a sneak peak at an alpha feature, multiple AI agents! You can set up a different agent for different tasks, different tones, languages, etc. and each one can have access to different datasets to focus results and give more accurate answers.
103-
104-
<Frame>
105-
<iframe width="100%" height="420" src="https://www.loom.com/embed/26adbd03cf2049ddb81e015f9756a4bb?sid=dae39714-3c86-4254-af23-bb2def551fba" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen />
106-
</Frame>
174+
## Learn more
107175

108-
109-
## Connecting to Slack
110-
111-
Watch this video to learn how to setup an AI agent in Slack.
176+
Watch this comprehensive demo to see AI agents in action:
112177

113178
<Frame>
114-
<iframe width="100%" height="420" src="https://www.loom.com/embed/f2a6bc73561149baacaf4e15e891f438?sid=e718bb15-1d75-43b3-ae24-d743e3ab5694" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen />
179+
<iframe
180+
width="100%"
181+
height="420"
182+
src="https://www.loom.com/embed/f38e27fee7784e7f95538613b3b77bb5?sid=a13feb5b-fef3-4f68-9fbf-e54f928c28e5"
183+
frameborder="0"
184+
webkitallowfullscreen
185+
mozallowfullscreen
186+
allowfullscreen
187+
/>
115188
</Frame>
116-
288 KB
Loading
92.8 KB
Loading

images/guides/ai-agent-create.png

277 KB
Loading
64.4 KB
Loading
189 KB
Loading

0 commit comments

Comments
 (0)