Customer-facing systems place agentic design under direct human scrutiny. Unlike code agents that iterate against objective tests, customer systems must satisfy subjective human expectations while handling the full variety of human communication. Unlike research systems that operate asynchronously, customer systems often require real-time response. And unlike internal tools where failures are inconvenient, customer system failures directly impact user experience and business outcomes. This chapter builds a customer service system that classifies inquiries, retrieves relevant knowledge, generates appropriate responses, and escalates when confidence is low. The system learns from resolutions to improve over time, accumulating expertise that makes it more capable with use.Documentation Index
Fetch the complete documentation index at: https://docs.idyllic.so/llms.txt
Use this file to discover all available pages before exploring further.
14.1 The Customer Service Challenge
Customer service has properties that make it both suitable and challenging for automation. High volume, repetitive queries. Many customer inquiries follow patterns—password resets, order status, billing questions, feature explanations. These repetitive queries are ideal for automation because the system can learn effective responses and apply them consistently. Variable complexity. While many queries are straightforward, some are complex, ambiguous, or emotionally charged. A system must recognize when a query exceeds its capabilities and route to human agents appropriately. Quality expectations. Customers expect accurate information, appropriate tone, and genuine helpfulness. A response that’s technically correct but cold or confusing fails the customer even if it answers their question. Stakes matter. Stakes matter because poor customer service costs revenue, drives customers away, and can create legal liability when it spreads misinformation. The system must be reliable enough to trust with real customer interactions. These properties shape the design: classify to route appropriately, retrieve knowledge to ground responses, generate with appropriate tone, evaluate confidence to know when to escalate, and learn from outcomes to improve over time.14.2 System Architecture
The customer system routes inquiries through specialized handlers based on classification, with escalation paths for uncertain or complex cases.14.3 Intent Classification
Classification is the routing decision that determines everything downstream. A misclassified inquiry goes to the wrong handler, uses wrong knowledge, and produces wrong responses.14.4 Knowledge-Grounded Response
Handlers generate responses grounded in retrieved knowledge. This prevents hallucination—responses cite actual documentation, policies, and facts rather than generating plausible-sounding fiction.14.5 Confidence-Based Escalation
Not every inquiry should be handled automatically. The system must know when to escalate to human agents.14.6 Learning from Resolutions
The system increases its automated resolution rate by capturing successful human responses and reusing them as templates or retrieval items. When a human agent resolves an escalated ticket, or when customer feedback indicates satisfaction, the system captures what worked.getRelevantPatterns inside handlers like the FAQ handler by injecting the top patterns into the system prompt as additional examples or by storing them in the knowledge base so they are retrieved alongside documentation. This closes the loop between human resolutions and future automated answers.
14.7 The Complete Customer System
The following class wires the classifier, handlers, escalation manager, and learner into a single service entrypoint.Key Takeaways
- Customer systems require balancing automation with appropriate escalation
- Classification determines routing—get it right and everything downstream works better
- Response grounding in knowledge prevents hallucination and enables citation
- Confidence-based escalation uses multiple signals, not just a single threshold
- Tone adaptation based on sentiment and context improves customer experience
- Learning from resolutions creates compounding improvement