AI 고객 서비스 에스컬레이션: 자동 분류에서 인간 상담사 전환까지

AI 기술

AI 고객 서비스에스컬레이션CS 자동화감정 분석챗봇

이 글은 누구를 위한 것인가

  • CS 자동화를 도입했는데 고객 만족도가 오히려 낮아진 팀
  • 언제 AI에서 인간으로 전환해야 할지 기준이 없는 팀
  • 상담사 전환 시 고객이 처음부터 설명해야 하는 문제를 해결하고 싶은 팀

들어가며

AI CS의 가장 큰 실패는 "전환이 너무 늦는 것"이다. 화가 난 고객에게 AI 봇이 계속 정형화된 답변을 주면 분노가 폭발한다. 적시에 상담사로 전환하고, 컨텍스트를 완벽하게 넘기는 것이 핵심이다.

이 글은 bluefoxdev.kr의 AI CS 자동화 설계 를 참고하여 작성했습니다.


1. 에스컬레이션 트리거 설계

[자동 에스컬레이션 트리거]

감정 기반:
  감정 분석 점수 < -0.7 (매우 부정)
  "화나다", "환불", "소비자원", "변호사" 키워드
  욕설 감지
  
해결 실패 기반:
  동일 문의 3회 이상 반복
  AI 답변 거부 ("아니요, 그게 아니라")
  "사람이랑 얘기하고 싶다" 명시적 요청
  
복잡도 기반:
  의도 분류 신뢰도 < 0.6
  다중 문의 혼재 (주문 + 환불 + 배송 동시)
  법적 관련 키워드 (소송, 경찰)
  
금액 기반:
  환불 요청 > 100,000원
  VIP 고객 (자동 에스컬레이션)

[에스컬레이션 우선순위]
  P1 (즉시): 법적 위협, 심각한 불만, VIP
  P2 (5분 내): 해결 실패, 복잡한 문의
  P3 (15분 내): 일반 에스컬레이션

2. CS AI 에이전트 구현

import anthropic
from dataclasses import dataclass

@dataclass
class CustomerQuery:
    query_id: str
    user_id: str
    message: str
    history: list[dict]
    order_info: dict | None = None

@dataclass
class CSResponse:
    message: str
    should_escalate: bool
    escalation_reason: str | None
    suggested_actions: list[str]
    confidence: float

client = anthropic.Anthropic()

CS_TOOLS = [
    {
        "name": "get_order_status",
        "description": "주문 현황 조회",
        "input_schema": {
            "type": "object",
            "properties": {"order_id": {"type": "string"}},
            "required": ["order_id"],
        },
    },
    {
        "name": "process_refund",
        "description": "환불 처리 (30,000원 이하 자동 승인)",
        "input_schema": {
            "type": "object",
            "properties": {
                "order_id": {"type": "string"},
                "amount": {"type": "number"},
                "reason": {"type": "string"},
            },
            "required": ["order_id", "amount", "reason"],
        },
    },
    {
        "name": "escalate_to_human",
        "description": "인간 상담사에게 전환",
        "input_schema": {
            "type": "object",
            "properties": {
                "reason": {"type": "string"},
                "priority": {"type": "string", "enum": ["P1", "P2", "P3"]},
                "summary": {"type": "string"},
            },
            "required": ["reason", "priority", "summary"],
        },
    },
]

async def handle_customer_query(query: CustomerQuery) -> CSResponse:
    """AI CS 에이전트"""
    
    # 감정 사전 분석
    sentiment = await analyze_sentiment(query.message)
    
    system_prompt = f"""당신은 이커머스 고객 서비스 AI입니다.
현재 고객 감정 점수: {sentiment:.2f} (-1.0 매우 부정 ~ 1.0 매우 긍정)

규칙:
- 환불은 30,000원 이하만 자동 처리
- 고객이 화났거나 해결이 어려우면 즉시 에스컬레이션
- 답변은 친절하되 간결하게 (3문장 이내)
- 고객명으로 부르기"""

    messages = [
        *query.history,
        {"role": "user", "content": query.message}
    ]
    
    should_escalate = False
    escalation_reason = None
    
    # 명시적 에스컬레이션 트리거 확인
    if sentiment < -0.7:
        should_escalate = True
        escalation_reason = "고객 감정 매우 부정적"
    
    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=1000,
        system=system_prompt,
        tools=CS_TOOLS,
        messages=messages,
    )
    
    # 도구 사용 처리
    if response.stop_reason == "tool_use":
        for content in response.content:
            if content.type == "tool_use" and content.name == "escalate_to_human":
                should_escalate = True
                escalation_reason = content.input.get("reason", "")
                await create_escalation_ticket(
                    query=query,
                    reason=escalation_reason,
                    priority=content.input.get("priority", "P2"),
                    summary=content.input.get("summary", ""),
                )
    
    response_text = extract_text_response(response)
    
    return CSResponse(
        message=response_text,
        should_escalate=should_escalate,
        escalation_reason=escalation_reason,
        suggested_actions=[],
        confidence=0.9 if not should_escalate else 0.5,
    )

async def create_escalation_ticket(
    query: CustomerQuery,
    reason: str,
    priority: str,
    summary: str,
):
    """에스컬레이션 티켓 생성 + 상담사에게 컨텍스트 전달"""
    
    # 대화 요약 생성
    conversation_summary = await summarize_conversation(query.history + [
        {"role": "user", "content": query.message}
    ])
    
    ticket = {
        "user_id": query.user_id,
        "priority": priority,
        "reason": reason,
        "ai_summary": summary,
        "full_summary": conversation_summary,
        "order_info": query.order_info,
        "sentiment_trend": await get_sentiment_trend(query.query_id),
        "recommended_resolution": await suggest_resolution(summary),
    }
    
    await save_escalation_ticket(ticket)
    await notify_available_agent(ticket)
    
    # 고객에게 전환 안내
    return "고객님의 문의를 전문 상담사에게 연결 중입니다. 잠시만 기다려주세요. (예상 대기: 3분)"

마무리

AI CS의 성공은 "에스컬레이션의 질"에 달려 있다. 상담사가 인수할 때 고객의 대화 이력, 감정 변화, 주문 정보, 권장 해결책을 한 화면에서 볼 수 있어야 한다. "다시 처음부터 설명해주세요"라는 말이 나오지 않아야 AI CS가 성공한 것이다.