Serene Review System
dsl_version: “1.0”
app:
name: “🌍 Serene Review System — Multi‑Agent Auto‑Optimised”
description: “Multi-language review analysis with self-learning and cost‑efficient agent routing”
icon: “🧠”
mode: “workflow”
workflow:
nodes:
- id: start
type: start
title: "🌱 New Review Arrives"
config:
variables:
- name: review_text
type: string
required: true
label: "Customer Review"
- name: customer_name
type: string
required: false
label: "Customer Name"
- name: source
type: string
required: true
label: "Review Source"
options: ["google","shopify","amazon","yelp","website","facebook","email"]
- name: client_phone
type: string
required: true
label: "WhatsApp Number"
- name: client_language
type: string
required: true
label: "Preferred Language"
options: ["english","spanish","french","german","italian","portuguese","japanese","chinese"]
- name: learning_mode
type: string
required: false
label: "Learning Mode"
options: ["always_ask_feedback","ask_when_uncertain","learn_silently"]
default: "ask_when_uncertain"
- id: agent_detect
type: llm
title: "🔍 Agent: Language & Sentiment"
config:
model: "gpt-4o-mini"
prompt: |
You are a multilingual review analysis agent.
Analyse the review: "{{start.review_text}}"
Output JSON:
{
"detected_language": "",
"feeling": "",
"topic": "",
"warmth_needed": 1-10,
"key_phrases": [],
"share_with": "",
"confidence": 0-100,
"summary": ""
}
temperature: 0.2
output_schema:
type: json
- id: agent_translate
type: llm
title: "🌐 Agent: Translation"
config:
model: "qwen2.5-7b-instruct"
prompt: |
Translate to English:
"{{start.review_text}}"
temperature: 0.1
- id: agent_quality
type: llm
title: "✓ Agent: Quality Assurance"
config:
model: "gpt-4o"
prompt: |
Review: "{{start.review_text}}"
Translation: "{{agent_translate.output}}"
Analysis: {{agent_detect.output}}
Validate the analysis.
Output JSON:
{
"language_correct": true/false,
"feeling_correct": true/false,
"topic_correct": true/false,
"warmth_correct": true/false,
"corrected_feeling": "",
"corrected_topic": "",
"corrected_warmth": "",
"quality_score": 0-100,
"needs_human": true/false,
"issues": []
}
temperature: 0.2
output_schema:
type: json
- id: impact_calc
type: code
title: "💰 Calculate Impact"
config:
code: |
def main(primary, quality):
feeling = quality.get('corrected_feeling') if quality.get('feeling_correct') == False else primary.get('feeling')
topic = quality.get('corrected_topic') if quality.get('topic_correct') == False else primary.get('topic')
feeling_impact = {
"Very distressed": 100,
"Quite worried": 50,
"Slightly concerned": 20,
"Peaceful and happy": 5
}
topic_multiplier = {
"Urgent issue": 2.0,
"Product experience": 1.5,
"Delivery/shipping": 1.3,
"Customer service": 1.2,
"Price/value": 1.0,
"Website/app": 0.8,
"Pure appreciation": 0.3
}
base = feeling_impact.get(feeling, 10)
mult = topic_multiplier.get(topic, 1.0)
impact = round(base * mult, 2)
return {
"peaceful_impact": impact,
"warmth_level": quality.get('corrected_warmth', primary.get('warmth_needed')),
"feeling": feeling,
"topic": topic,
"quality_score": quality.get('quality_score'),
"needs_human": quality.get('needs_human')
}
inputs:
primary: "{{agent_detect.output}}"
quality: "{{agent_quality.output}}"
- id: gate
type: if
title: "🚦 Quality Gate"
config:
conditions:
- id: human_needed
condition: "{{agent_quality.output.needs_human}} == true or {{agent_quality.output.quality_score}} < 70"
branch_name: "HUMAN_NEEDED"
- id: auto
condition: "{{agent_quality.output.quality_score}} >= 70"
branch_name: "AUTO"
- id: agent_response
type: llm
title: "✨ Agent: Customer Response"
config:
model: "gpt-4o-mini"
prompt: |
Write a warm, human-sounding response in {{agent_detect.output.detected_language}}.
Review: "{{start.review_text}}"
Feeling: {{agent_detect.output.feeling}}
Warmth: {{agent_detect.output.warmth_needed}}/10
temperature: 0.7
- id: agent_client_translate
type: llm
title: "💬 Agent: Translate for Client"
config:
model: "qwen2.5-7b-instruct"
prompt: |
Translate to {{start.client_language}}:
"Impact: ${{impact_calc.output.peaceful_impact}} - {{impact_calc.output.feeling}}"
temperature: 0.3
- id: feedback
type: human_in_the_loop
title: "💭 Learning Feedback"
config:
timeout: 86400
message: |
Was this analysis helpful?
Review: "{{start.review_text[:100]}}..."
Feeling: {{agent_detect.output.feeling}}
Quality: {{agent_quality.output.quality_score}}/100
actions:
- label: "👍 Yes"
value: "positive"
- label: "🤔 Mostly"
value: "neutral"
- label: "👎 No"
value: "negative"
- id: learning_log
type: code
title: "📚 Log Learning"
config:
code: |
def main(primary, quality, feedback):
return {
"learned": True,
"feedback": feedback.get('action') if feedback else 'none',
"quality": quality.get('quality_score')
}
inputs:
primary: "{{agent_detect.output}}"
quality: "{{agent_quality.output}}"
feedback: "{{feedback.output}}"
- id: whatsapp
type: http
title: "📱 Send WhatsApp"
config:
method: POST
url: "https://api.twilio.com/2010-04-01/Accounts/{{settings.twilio_account_sid}}/Messages.json"
authorization:
type: basic
username: "{{settings.twilio_account_sid}}"
password: "{{settings.twilio_auth_token}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: |
To=whatsapp:{{start.client_phone}}
From=whatsapp:{{settings.twilio_whatsapp_number}}
Body=
🌿 *Review Analysis*
Language: {{agent_detect.output.detected_language}}
Feeling: {{agent_detect.output.feeling}}
Topic: {{agent_detect.output.topic}}
Quality: {{agent_quality.output.quality_score}}/100
Impact: ${{impact_calc.output.peaceful_impact}}
{% if start.learning_mode == 'always_ask_feedback' or agent_quality.output.quality_score < 80 %}
Was this helpful? Reply 👍 🤔 👎
{% endif %}
- id: end
type: end
title: "✓ Complete"
connections:
– from: start
to: agent_detect
– from: agent_detect
to: agent_translate
– from: agent_translate
to: agent_quality
– from: agent_quality
to: impact_calc
– from: impact_calc
to: gate
– from: gate
to: agent_response
– from: agent_response
to: agent_client_translate
– from: agent_client_translate
to: feedback
– from: feedback
to: learning_log
– from: learning_log
to: whatsapp
– from: whatsapp
to: end