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

# Welcome to Bluepine

> How to build an AI agent that monitors customer signals and scores churn risk so customer success can prioritize outreach to prevent subscription cancellations.

Rise and shine — it's Monday morning.

You're a data analyst at Bluepine, a subscription-based learning platform with a few thousand customers. Most weeks you write SQL queries and build dashboards. When somebody asks a question, you run a query and return a table or a chart.

If someone asks what plans customers are on, you run a simple query:

```sql theme={null}
SELECT plan, COUNT(*)
FROM customers
GROUP BY plan;
```

Your job is to find the right data and make sense of it for the business.

Then this email lands.

It's from Claire, who runs the customer success team. The subject line reads, "We lost Northgate."

Now read the email together.

Northgate canceled Friday afternoon. Nobody on my team saw it coming. I have 12 renewals this quarter, and I can't tell which one of them is going to be next. I need to know before they tell me.

That last sentence is the actual requirement. Claire isn't asking how many customers we lost already or what our churn rate was last quarter — she's asking about the customers who haven't left yet.

Bluepine makes money one subscription at a time. Customers pay every month, and as long as they stay, revenue repeats. When Northgate canceled, that repeating stopped. This is churn.

![A diagram titled "One Subscription at a Time" showing user icons on the left connected by lines and dollar symbols to two buildings on the right, illustrating individual subscription payments funneling to a company.](https://mintcdn.com/kodekloud-c4ac6d9a/YiW0Xl5gQ25uff6L/images/AI-Agents-For-Data-Analytics/Building-Agent-With-BigQuery/Welcome-to-Bluepine/one-subscription-at-a-time-diagram.jpg?fit=max\&auto=format\&n=YiW0Xl5gQ25uff6L\&q=85\&s=55161e46f9915093380b49a042d395f0)

Churn compounds. Losing 2% of customers every month sounds small, but 12 months later more than a fifth of the base can be gone. At that point, every new sale is just refilling a leaking bucket, not genuine growth.

![A dark infographic titled "Churn Compounds" with a grid of rounded tiles where red squares mark churned items and a few cyan tiles highlight other events. A side panel reads "-2% / month", "Month 12" and "Gone 22 of 100."](https://mintcdn.com/kodekloud-c4ac6d9a/YiW0Xl5gQ25uff6L/images/AI-Agents-For-Data-Analytics/Building-Agent-With-BigQuery/Welcome-to-Bluepine/churn-compounds-red-cyan-tiles-gone22.jpg?fit=max\&auto=format\&n=YiW0Xl5gQ25uff6L\&q=85\&s=1920c86d5ada0b654de19ca5ecd4099c)

Refilling is expensive: marketing spend, sales calls, demos, onboarding — often several times the cost of keeping an existing customer. Retention often comes down to simpler, cheaper interventions like a timely phone call from customer success.

Bluepine's customer success team exists to prevent churn. Their quarter is judged by one number: how many customers stayed.

So your job is to stop cancellations before they happen. The catch is customers rarely say, "I'm leaving." They fade away: logins drop, support tickets increase, engagement declines.

![A dark-themed dashboard titled "Customers Fade" showing a Customer Success panel that asks "How many customers stayed?" with a row of turquoise dollar icons and a red X on the right labeled "Friday." The left side shows a Customer Success icon and customer entries (e.g., "Northgate") with status buttons like "Logins drop off" and "Tickets pile up."](https://mintcdn.com/kodekloud-c4ac6d9a/YiW0Xl5gQ25uff6L/images/AI-Agents-For-Data-Analytics/Building-Agent-With-BigQuery/Welcome-to-Bluepine/customers-fade-customer-success-dashboard.jpg?fit=max\&auto=format\&n=YiW0Xl5gQ25uff6L\&q=85\&s=230deca5645a43045e3181a92ea03e7d)

By the time the cancellation email arrives, there is often nothing left to save. Bluepine never missed an announcement and nobody ignored a warning — there simply wasn't a clear warning surfaced to the team. The signals were in the data the whole time: weeks, months, or even years.

For example, consider an account — Bluepine with customer ID C002. It has one login in the last 30 days and six support tickets. No one noticed because catching it requires cross-referencing login counts against ticket queues for every account, every day.

So where do we start?

You do the obvious thing first: open the dashboard. It isn't helpful — it counts customers who already left, but Claire asked for the ones who haven't left yet.

![A dark-themed dashboard titled "The Dashboard" with a "Churn Dashboard" panel showing "Customers lost this month: 1" and a small colored bar chart of churn rates.](https://mintcdn.com/kodekloud-c4ac6d9a/YiW0Xl5gQ25uff6L/images/AI-Agents-For-Data-Analytics/Building-Agent-With-BigQuery/Welcome-to-Bluepine/dark-dashboard-churn-customers-lost-1.jpg?fit=max\&auto=format\&n=YiW0Xl5gQ25uff6L\&q=85\&s=2897627f4c18c57275d9995ad9e547c5)

Answering Claire's question means digging into the raw signals and labeling accounts by risk. Useful signals include:

| Signal category | What to measure | Example |
| - | - | - |
| Recent usage | Login count, feature usage over window | `usage_30d: 1` |
| Tenure | How long they've been a customer | `tenure_years: 2.1` |
| Support activity | Open tickets, ticket volume and type | `tickets_open: 6` |
| Billing | Failed payments, disputes, invoicing delays | `failed_payments_30d: 2` |
| Seat / product changes | Drop in seat counts or decreased feature adoption | `seats_active_change: -30%` |

A simplified per-account snapshot you might examine:

```text theme={null}
account: Bluepine (C002)

usage_30d: 1
tenure_years: 2.1
tickets_open: 6
```

If an account looks high risk, someone on the customer success team needs to call — that requires human judgment to prioritize and explain why.

This is exactly the kind of continuous monitoring and prioritization you can offload to an AI agent: one that watches signals, scores risk, and highlights accounts for outreach. Bluepine doesn't have that agent yet.

Building it breaks down into three parts:

1. Build the agent itself and understand what it's made of.
2. Give the agent external tools — this is the Model Context Protocol (MCP). Learn more: [https://learn.kodekloud.com/user/courses/udemy-labs-model-context-protocol-mcp-for-beginners](https://learn.kodekloud.com/user/courses/udemy-labs-model-context-protocol-mcp-for-beginners)
3. Reach the data where it actually lives.

![An infographic titled "Three Things You Need" showing a flowchart with a blue robot block labeled "Build the Agent" on the left and an orange server block labeled "Tools You Didn't Write" on the right. Arrows connect both blocks down to several green tool icons with labels like "What it's made of" and "MCP."](https://mintcdn.com/kodekloud-c4ac6d9a/YiW0Xl5gQ25uff6L/images/AI-Agents-For-Data-Analytics/Building-Agent-With-BigQuery/Welcome-to-Bluepine/three-things-you-need-agent-tools.jpg?fit=max\&auto=format\&n=YiW0Xl5gQ25uff6L\&q=85\&s=212e413c5058a564fd253b661a09387a)

And that last task — reaching the data — often contains a surprise: the data you need usually lives in a database, data warehouse, or a set of tools that require connectors, permissions, and careful data modeling before an agent can reliably act on it.

Start by defining the risk signals you care about and where each lives (auth logs, support system, billing, product telemetry). This makes it easier to map the data sources and prioritize integrations.

> **[Watch Video](https://learn.kodekloud.com/user/courses/ai-agents-for-data-analytics/module/4e6bc78e-00a8-405d-97ce-830c7892b1b1/lesson/2546add7-7766-45dd-94ff-91f394bcdf21)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.