How I Built an AI Customer Agent for Sri Lanka's Largest E-Commerce Platform
A deep dive into building a multilingual, MCP-powered AI agent that handles customer support for Kapruka.com.
When I started building the AI customer agent for Kapruka, I knew it had to solve three critical problems: language barriers, cart integration, and human handoff. Sri Lankan customers don't just speak English — they speak Sinhala, Tamil, Singlish, and often switch between them mid-conversation.
The solution was MCP — Model Context Protocol. Instead of relying on a generic AI model that gives generic answers, I built a custom MCP server that connects the AI directly to Kapruka's product catalog, pricing, inventory, and order system. The agent doesn't just 'know' about products — it queries the live database in real-time.
The multilingual challenge was unique. Most AI models handle English well, but Sinhala and Tamil are underrepresented in training data. I solved this by implementing a translation layer that normalizes Singlish (Romanized Sinhala) into a format the model can understand, then translates responses back naturally.
Voice input and output were added to make the agent accessible to users who prefer speaking over typing. The agent listens, processes, and responds aloud — with selectable male or female voices. This is particularly important for older customers and those who find typing in Sinhala difficult.
The most complex feature was the 'price lock' system. When the agent generates a checkout block, it locks the item prices and stock for 60 minutes. This ensures that if a customer takes time to complete payment, the price won't change and the item won't go out of stock. It's a small detail that prevents major customer frustration.
Building this agent taught me that AI in e-commerce isn't about replacing humans — it's about handling the 80% of queries that are repetitive, so human agents can focus on the 20% that require empathy and complex problem-solving.