AI-powered customer retention workflow built with Lyzr
Identify β Decide β Personalize
Ecommerce teams don't need to message every customer.
This workflow identifies who needs attention, decides what action to take, and generates what to say.
βοΈ How It Works
Customer Data β Classify β Strategize β Personalize
π Agent 1 β Customer Classifier Identifies customer risk using purchase behavior, spend and inactivity.
π― Agent 2 β Retention Strategist Determines the appropriate action, channel and urgency.
βοΈ Agent 3 β Message Generator Creates personalized re-engagement messaging based on the strategy.
Architecture
π§ͺ Example
Aman β C035 48 days inactive Β· βΉ45,000 spend Β· Luxury Watches
β
High-Value At-Risk
β
High-Value Retention Β· Email Β· Critical
β
Personalized re-engagement message
π οΈ Tech Stack
Lyzr Β· LLMs Β· Prompt Engineering Β· Multi-Agent Workflows Β· Structured JSON
π Evaluation
Tested with 50 synthetic customer profiles, including:
Normal customer behavior 30/60-day boundary cases High-value customers Low-frequency / high-spend customers Inconsistent data
Validated classification, strategy selection, structured outputs and message personalization.
- Learned how to design and connect multi-agent workflows using Lyzr.
- Understood how to pass structured outputs between agents.
- Improved prompt design using clear rules, constraints, and edge-case handling.
- Learned the importance of defining strict output schemas for reliable agent responses.
- Explored how customer behavior can be translated into actionable retention strategie
Prompts were iteratively tested using normal and edge-case customer profiles.
Evaluation focused on:
- Classification consistency
- Correct handling of 30/60-day boundaries
- Retention strategy accuracy
- Channel and urgency consistency
- Customer-data preservation
- Message personalization
- Preventing unsupported discounts/offers
The prompts were refined based on observed failures before connecting the agents into the final workflow.
-
Agent-to-agent context passing Ensuring each agent receives the relevant output from the previous agent.
-
Schema mismatch The initial generated schema used unrelated customer segments such as consumer and vip. This was corrected to match the business-specific retention segments.
-
Data preservation Preventing agents from modifying customer IDs or reinterpreting classifications.
-
Edge cases Handling customers exactly at inactivity boundaries and customers with unusual combinations of spend and purchase frequency.
-
Cost-efficient testing Used targeted test cases during development and reserved broader testing for the final workflow to minimize LLM usage costs.
Email automation β CRM integration β Campaign analytics
