> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Analyst Agent

> Use the Data Analyst agent for fast database queries, data analysis, and visualizations

The **Data Analyst Agent**, also known as **DANA** (Data ANAlyst), is a specialized version of Devin optimized for querying databases, analyzing data, and creating visualizations. It's designed to be fast, concise, and tuned specifically for data analytics workflows.

## When to use the Data Analyst Agent

The Data Analyst Agent is ideal when you need to:

* **Query databases**: Write and execute SQL queries against your connected data sources
* **Analyze data**: Explore patterns, calculate metrics, and investigate trends in your data
* **Create visualizations**: Generate professional charts and graphs using seaborn
* **Answer data questions**: Get quick, accurate answers to questions about your data
* **Generate insights**: Discover patterns, anomalies, and actionable findings

## Accessing the Data Analyst Agent

### From the web app

1. Go to the Devin home page
2. Click the agent picker dropdown
3. Select **Data Analyst** from the dropdown menu
4. Start your session with a data-related question or task

### From Slack

You can start a Data Analyst session directly from Slack using either method:

**Using the slash command:**

```
/dana What were our top 10 customers by revenue last month?
```

**Using a mention with the `!dana` macro:**

```
@Devin !dana What were our top 10 customers by revenue last month?
```

Both methods will create a Data Analyst session and respond in-thread with the results.

## Prerequisites

Before using the Data Analyst Agent, you'll need to connect at least one data source via MCP (Model Context Protocol). Common integrations include:

* **Database MCPs**: Redshift, PostgreSQL, Snowflake, BigQuery, and other SQL databases
* **Analytics MCPs**: Datadog, Metabase, and other observability platforms

Without a connected data source, the agent will notify you and ask you to connect one before proceeding.

<Card title="Set up MCP integrations" icon="plug" href="/work-with-devin/mcp">
  Learn how to connect databases and other data sources via MCP
</Card>

## How it works

### Database Knowledge

The Data Analyst Agent maintains a **Database Knowledge** note that contains schema documentation for your connected databases. This knowledge is automatically referenced before running queries, allowing the agent to quickly identify the right tables and columns.

## Example prompts

Here are some effective ways to use the Data Analyst Agent across different query types:

### Simple lookups

* "How many active users did we have last week?"
* "What's our daily revenue trend for the past month?"
* "Which customers have the highest usage?"

### Aggregations and metrics

* "What's the average session duration by plan tier for the past 30 days?"
* "Show me total revenue grouped by region and product line for Q4"
* "Calculate the 95th percentile response time for each API endpoint this week"

### Joins and cross-table analysis

* "Join our users table with the orders table and show the top 20 customers by lifetime value"
* "Correlate signup source with 30-day retention — which acquisition channels have the best retention rates?"
* "Combine session data with billing records to find accounts with high usage but low spend"

### Filtering and segmentation

* "Show me only enterprise customers who signed up after January 2025 and have more than 100 sessions"
* "Filter error logs to 5xx errors from the payments service in the last 48 hours"
* "Break down consumption by enterprise vs. self-serve customers, excluding trial accounts"

### Time-series analysis

* "Plot weekly active users over the past 6 months — highlight any weeks with more than 10% change"
* "Show me a month-over-month comparison of signup rates for 2025 vs. 2024"
* "What's the daily trend for API calls over the past 90 days? Overlay a 7-day moving average"

### Investigations and anomaly detection

* "Why did signups drop last Tuesday? Check if there were any related incidents or deployments"
* "Are there any anomalies in our error rates this week?"
* "Compare this month's metrics to the same period last year and flag significant deviations"

### Multi-step analysis

* "Analyze user retention by cohort for Q4, then identify which cohorts have the steepest drop-off and suggest possible causes"
* "Find the top 10 users by session count, show their activity over time, and flag any that look like potential churns"

## Supported data sources

The Data Analyst Agent connects to your data through MCP (Model Context Protocol) integrations. You can connect multiple data sources and query across them. Below are some of the most common data sources available in the [MCP Marketplace](https://app.devin.ai/settings/mcp-marketplace) — this is not an exhaustive list.

### SQL databases

| Data source                               | MCP name   | Setup                           |
| ----------------------------------------- | ---------- | ------------------------------- |
| Amazon Redshift                           | Redshift   | Connection string + credentials |
| PostgreSQL                                | PostgreSQL | Connection string               |
| Snowflake                                 | Snowflake  | Account + credentials           |
| Google BigQuery                           | BigQuery   | OAuth or service account        |
| MySQL                                     | MySQL      | Connection string               |
| SQL Server                                | SQL Server | Connection string               |
| Neon                                      | Neon       | OAuth                           |
| Supabase                                  | Supabase   | Personal access token           |
| Cloud SQL (PostgreSQL, MySQL, SQL Server) | Cloud SQL  | OAuth                           |

### Analytics and observability platforms

| Data source | MCP name | Setup                       |
| ----------- | -------- | --------------------------- |
| Datadog     | Datadog  | API key + app key           |
| Metabase    | Metabase | OAuth                       |
| Grafana     | Grafana  | URL + service account token |
| Sentry      | Sentry   | OAuth                       |

### Connecting a data source

1. Navigate to [Settings > MCP Marketplace](https://app.devin.ai/settings/mcp-marketplace)
2. Find your data source and click **Enable**
3. Provide any required credentials (connection strings, API keys, or OAuth)
4. Start a Data Analyst session — the agent will automatically discover your connected data sources

Need a data source that isn't in the Marketplace? Use **Add Your Own** to connect any MCP server by providing its configuration directly.

<Card title="Set up MCP integrations" icon="plug" href="/work-with-devin/mcp">
  Full setup instructions for each data source
</Card>

<Note>
  You can connect multiple data sources simultaneously. The Data Analyst Agent will use the appropriate MCP tools based on your query context.
</Note>

## Best practices

### Be specific about metrics

Instead of asking vague questions, define exactly what you want to measure:

<CodeGroup>
  ```text Good theme={null}
  "What's our 7-day active user count, defined as users who started at least one session?"
  ```

  ```text Less effective theme={null}
  "How are our users doing?"
  ```
</CodeGroup>

### Specify time periods

Always include the time range you're interested in. The agent defaults to UTC when interpreting relative dates.

<CodeGroup>
  ```text Good theme={null}
  "Show me daily revenue for the past 30 days"
  ```

  ```text Less effective theme={null}
  "Show me revenue"
  ```
</CodeGroup>

### Request specific output formats

Tell the agent how you want to see results — as a table, chart, or summary:

<CodeGroup>
  ```text Good theme={null}
  "Plot a line chart of weekly signups for the past quarter, with a table of the raw numbers below"
  ```

  ```text Less effective theme={null}
  "Get signup numbers"
  ```
</CodeGroup>

### Define business logic upfront

If your metrics have specific definitions, state them in your prompt to avoid ambiguity:

<CodeGroup>
  ```text Good theme={null}
  "Show monthly churn rate, where churn is defined as accounts with zero sessions in the past 30 days that had at least one session in the prior 30 days"
  ```

  ```text Less effective theme={null}
  "What's our churn rate?"
  ```
</CodeGroup>

### Ask for comparisons and context

Adding comparison periods or benchmarks makes results more actionable:

<CodeGroup>
  ```text Good theme={null}
  "Show this week's daily active users compared to the same week last month, and highlight any days with more than 15% deviation"
  ```

  ```text Less effective theme={null}
  "Show daily active users"
  ```
</CodeGroup>

### Iterate on results

You can ask follow-up questions in the same session to drill deeper:

1. Start broad: *"What are our top 10 customers by revenue this quarter?"*
2. Drill down: *"For the top 3, show me their monthly revenue trend over the past year"*
3. Investigate: *"Customer X had a revenue spike in March — what drove that?"*

### Validate the SQL

The agent always includes the SQL query it used. Review it to ensure the logic matches your expectations, especially for complex analyses involving joins, filters, or aggregations.

## Output formats

The Data Analyst Agent returns results in several formats depending on the type of analysis:

### Tables

For data lookups and aggregations, results are returned as formatted tables:

```
| Customer       | Revenue   | Sessions | Avg Duration |
|----------------|-----------|----------|--------------|
| Acme Corp      | $125,400  | 1,247    | 34 min       |
| Globex Inc     | $98,200   | 983      | 28 min       |
| Initech        | $87,600   | 876      | 41 min       |
```

### Charts and visualizations

When you request visual analysis or the data is best understood graphically, the agent generates charts using seaborn. Common chart types include:

* **Line charts** — time-series trends, comparisons over time
* **Bar charts** — categorical comparisons, rankings
* **Heatmaps** — correlation matrices, activity patterns
* **Scatter plots** — relationship analysis between two metrics

<Tip>
  Request a specific chart type if you have a preference, or let the agent choose the most appropriate visualization for your data.
</Tip>

### Summaries and insights

For investigation-style prompts, the agent provides a structured response that includes:

* **Analysis summary** — a plain-language answer to your question
* **SQL query** — the exact query used, so you can verify the logic
* **Key numbers** — the most important metrics highlighted
* **Data insights** — patterns, anomalies, or notable findings
* **Metabase link** — if your organization has Metabase connected via MCP, the agent may include a link to an interactive dashboard for further exploration

## Knowledge management

The Data Analyst Agent can persist learnings across sessions using the knowledge system. When it discovers:

* New schema information or table relationships
* Business logic or metric definitions
* Data quality patterns or caveats

It will save these to knowledge notes so future sessions benefit from what was learned.

<Card title="Learn more about Knowledge" icon="brain" href="/product-guides/knowledge">
  Understand how Devin's knowledge system works
</Card>

## Differences from standard Devin

| Capability                | Data Analyst Agent       | Standard Devin        |
| ------------------------- | ------------------------ | --------------------- |
| SQL query execution       | Optimized                | Supported             |
| Data visualizations       | Built-in seaborn support | Manual setup          |
| Database schema awareness | Pre-loaded knowledge     | On-demand exploration |
| Response style            | Concise, metrics-focused | Detailed explanations |
| Code changes              | Not primary focus        | Full support          |
| MCP integrations          | Required                 | Optional              |

The Data Analyst Agent is purpose-built for data work. For tasks involving code changes, deployments, or general software engineering, use standard Devin instead.
