diff --git a/VantageCloud_Lake/UseCases/Customer_Lifetime_Value_Agent/Customer_Lifetime_Value_Agents.ipynb b/VantageCloud_Lake/UseCases/Customer_Lifetime_Value_Agent/Customer_Lifetime_Value_Agents.ipynb new file mode 100644 index 00000000..2e3590f9 --- /dev/null +++ b/VantageCloud_Lake/UseCases/Customer_Lifetime_Value_Agent/Customer_Lifetime_Value_Agents.ipynb @@ -0,0 +1,314 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "9944e564-a16d-44fb-b9e0-0dd16a45eb1f", + "metadata": {}, + "source": [ + "
\n", + "

\n", + " Discover Customer Lifetime Value using Teradata AgentBuilder\n", + "
\n", + " \"Teradata\"\n", + "

\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "67ed6f6f-da47-40ca-8877-6849fc54060a", + "metadata": {}, + "source": [ + "

Introduction

\n", + "\n", + "

\n", + "Customer Lifetime Value (CLV) measures the total net revenue a customer is expected to generate throughout their relationship with a business. It is a foundational metric for customer-centric organizations, guiding decisions in marketing, retention, service design, and product strategy. While traditional AI models focus primarily on predicting CLV, modern agentic AI systems go a step further by not only forecasting value but also proactively identifying actions and interventions that increase it.

\n", + "

Why CLV Matters

\n", + "

Most enterprises already maintain some form of CLV—but many struggle to translate it into operational insights or strategic decisions. As a result, the potential of CLV often remains underutilized. Agentic AI transforms this landscape by making CLV actionable, enabling teams to ask and answer complex business questions instantly. Examples include:\n", + "

\n", + "

Through automated reasoning, contextual understanding, and tool-based execution, agentic systems empower business users to extract insights, explore scenarios, and drive meaningful outcomes without relying on manual analytics or specialist intervention.

\n", + "

Why Teradata

\n", + "

Teradata provides a uniquely powerful ecosystem for implementing CLV and agentic AI at enterprise scale. With its high-performance, massively parallel processing engine and integrated analytics capabilities, Teradata enables organizations to compute, store, and operationalize CLV on large and complex datasets with exceptional speed and accuracy. Its architecture supports real-time intelligence, operational decisioning, and analytical workloads on the same trusted data foundation—ensuring that AI-generated insights remain reliable, auditable, and enterprise-ready.
Beyond raw performance, Teradata delivers capabilities that enable enterprises to build and manage autonomous AI agents grounded in trusted data, domain expertise, and hybrid deployment flexibility. This includes:\n", + "

\n", + "

Together, these capabilities position Teradata as the ideal platform for unlocking the full value of Customer Lifetime Value through agentic AI, transforming insights into scalable, autonomous actions that drive measurable business impact.
\n", + "In this notebook we will go through Customer LifeTime Value expert agent using the pre-built template. \n", + "

\n" + ] + }, + { + "cell_type": "markdown", + "id": "2e8c7c2b-0216-451c-b5e5-8972c51fbe63", + "metadata": {}, + "source": [ + "
\n", + "1. Connect to Agent Builder Framework" + ] + }, + { + "cell_type": "markdown", + "id": "c67503a4-a812-4ea7-b783-9b727265bb46", + "metadata": {}, + "source": [ + "
\n", + "

If you haven't already done so, please go through Teradata AgentBuilder Getting Started notebook before proceeding. This will provide an overview of the Teradata AgentBuilder platform we have established and the connection parameters we have prepared to facilitate the usage of your own instance of Flowise.

\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "b87ffb05-1395-43e1-8d62-6a12a8fb665a", + "metadata": {}, + "source": [ + "Teradata AgentBuilder Getting Started Notebook " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f209873c-09e1-4c27-be04-5a004bc379a9", + "metadata": {}, + "outputs": [], + "source": [ + "var = input(\"Enter hostname:\")\n", + "url = f\"https://flowise-{var}\"\n", + "\n", + "from IPython.display import HTML, display\n", + "\n", + "html = f\"\"\"\n", + "

\n", + " Launch Flowise from the button below:\n", + "

\n", + "\n", + " \"Launch\"\n", + "\n", + "\"\"\"\n", + "display(HTML(html))" + ] + }, + { + "cell_type": "markdown", + "id": "049c137d-8530-4bc3-821d-c1736d90ee3d", + "metadata": {}, + "source": [ + "
\n", + "

2. Architecture of this Customer Lifetime Value Agent

\n", + "

Here's the flow of the Customer Lifetime Value Agent we are going to execute:
\n", + " \"clv " + ] + }, + { + "cell_type": "markdown", + "id": "a45f5db1-410d-4583-82de-308b9555cac1", + "metadata": {}, + "source": [ + "

The first node of the agentflow is the Start node. This node is where you set up variables that your agent will use throughout its workflow. Think of these variables as containers of information that the agent will need to access as it works through the flow. We have defined four variables: \n", + "

    \n", + "
  1. main_agent_op -This is an output variable that will store the main response or result from the agent.
  2. \n", + "
  3. main_vis_op - This variable will hold output meant for visualization, like charts or graphs, which future agents can use.
  4. \n", + "
  5. main_question - This variable stores the user’s main question or request.
  6. \n", + "
  7. db_name - This holds the name of the database the agent will use. In this case, it is set to FINSERV.
  8. \n", + "
\n", + "

" + ] + }, + { + "cell_type": "markdown", + "id": "c5bfa709-bff0-459b-9431-9f5e617e4d92", + "metadata": {}, + "source": [ + "
\n", + "

The second node of the agentflow is the condition node named Check Question Intent. A Condition Agent helps your flow make decisions based on what the user asks. It checks the user’s \n", + "questions or input and decides which path the flow should follow next. Think of it as a traffic controller that \n", + "directs questions to the right place. We have divided user intent for question in three scenarios below: \n", + "

    \n", + "
  1. Scenario-0: User is asking for basic details about tables, databases, columns, etc.
  2. \n", + "
  3. Scenario-1: User is asking about customer lifetime value, CLV, correlation, sentiments analysis, charts like pie chart, histogram etc.
  4. \n", + "
  5. Scenario-2: User is asking about features impacting churn, recommendations to reduce the churn, what are the main factors leading to a Churn or low CLV, recommend me method to reduce Churn, which are important \n", + "factors for Churn.
  6. \n", + "
\n", + "

Based on each scenario the execution of agents happen at runtime\n", + "

" + ] + }, + { + "cell_type": "markdown", + "id": "c2644cfb-52d4-49ee-9a54-5633f66e6d21", + "metadata": {}, + "source": [ + "
\n", + "

Then there are three agents Data Exploration Agent\n", + " , Data Insights Agent and Stretgic Agent attached to each scenario we have discussed in condition node. The content, flow and variable information is pre-filled in each of these agents. We have to configure some of the parameters which we will explain later in notebook.

" + ] + }, + { + "cell_type": "markdown", + "id": "8ddf50b5-960b-4a04-9c95-84029eba7847", + "metadata": {}, + "source": [ + "
\n", + "

After that we again have a condition agent named Check if Chart Required which checks if the response to the user require any visualization or not. Depending upon the output from this node the execution flow is directed towards Visualization Agent or towards Generate the Response\n", + " node.
The Visualization Agent will create a json required for the chart type required from the output for the Draw Plot function to display as reponse for the user query.
The last node in the flow is Generate the Response which is a LLM node. The LLM Node uses a language model to generate smart responses based on the user's \n", + "input and the instructions you provide.

" + ] + }, + { + "cell_type": "markdown", + "id": "a0ea1d8e-da21-4326-82ee-13ca8b9c83af", + "metadata": {}, + "source": [ + "
\n", + "

3. Creating AgentFlow from Template

" + ] + }, + { + "cell_type": "markdown", + "id": "13eb9673-8cb4-4e08-8188-80120d14d822", + "metadata": {}, + "source": [ + "

For the CLV expert agent, we will use the pre-created template based on the design and logic explained in section 2. To use the template \n", + "

" + ] + }, + { + "cell_type": "markdown", + "id": "a4ed3db3-6cf9-4667-b92e-ca2d3d8af879", + "metadata": {}, + "source": [ + "
\n", + "

2. Configuring the nodes in the AgentFlow

\n", + "

While most of the configuration of the nodes are already done in the template, we still need to provide the authentication credentials and the tools action for them. For this you need to double click on each of the node and add the details of Teradata Authentication and Litellm authentication you have created earlier. For this
LLM credentials
\n", + "