Customer support inboxes get flooded with emails daily. Some need expert human attention, others are routine questions that keep coming up again and again.
We wanted to create a system that could:
Process incoming customer emails automatically
Determine the sentiment and urgency of each message
Identify which ones need human expertise
Automatically respond to straightforward inquiries
So we rolled up our sleeves and built a solution with Datazone
[ { "mail": "john.smith@gmail.com", "subject": "Card Not Working", "message_content": "Hello, my bank card has balance but it didn't work when I tried to make a purchase.", "source": "email", "timestamp": "2025-08-01T09:15:30Z" }]
We have used a sample JSON file to simulate incoming customer emails. You can find it in the example repository which I’ll share in below.
We created a Pydantic model to structure the AI’s analysis:
Copy
class SentimentAnalysisResultFormat(BaseModel): issue_title: str = Field(description="Brief title for the issue") summary: str = Field(description="Summary of the message") response: str = Field(description="Response to the message") solving_score: int = Field(description="Confidence score, 1-10") request_type: Literal["information_request", "complaint", "suggestion"] = Field() sentiment_category: Literal["positive", "negative", "neutral"] = Field() urgency_level: int = Field(description="Urgency level, 1-10")
This gives us structured data we can actually use in our workflow, rather than raw text.
We wrote a clear set of instructions for the AI in a markdown file:
Copy
You are an automation agent for responding to user feedback....Scale the solving_score as follows: - 1-3: Not confident. Use when you're unsure. - 4-6: Moderately confident. Use for complaints needing more info. - 7-8: Confident. Use for basic information requests. - 9-10: Very confident. Use for simple suggestions or appreciation.
This helps the AI make consistent assessments about each incoming message. You can access the full instructions in the example repository.
The key part of the system is the logic that decides which emails need human attention:
Copy
# If the AI confidence is below our threshold, route to human teamif row["solving_score"] < 8: # Mark for human review emails.at[index, "status"] = "NEED_ACTION"
When the AI isn’t confident in its response, it flags the message for human review. This ensures customers always get the right answer, whether it comes from AI or the support team.
{"mail": "john.smith@gmail.com","subject": "Card Not Working","message_content": "Hello, my bank card has balance but it didn't work when I tried to make a purchase.","source": "email","timestamp": "2025-08-01T09:15:30Z","issue_title": "Bank Card Payment Failure","sentiment_category": "negative","solving_score": 7,"response": "I'm sorry to hear about the trouble with your bank card. This could be due to several reasons such as a temporary system issue, a hold on your account, or a security feature triggered by unusual purchase activity. Please try the following steps:\n\n1. Try the card again at a different terminal\n2. Contact your bank's customer service at the number on the back of your card\n3. Check your online banking to ensure there are no restrictions on your account\n\nIf you continue to experience issues, please reply with more details about where you attempted to make the purchase and we'll investigate further.","status": "NEED_ACTION"}
We built a dashboard in Datazone to monitor the system:
The dashboard tracks:
Total message volume
Average urgency levels
Messages requiring human intervention
Sentiment distribution across all communications
Please don’t assume I moved the data to another platform or used a traditional BI tool to build this app! 😊 I’m still in Datazone and accomplished this with a simple command to Orion AI. For more details, check out the Intelligent App section.