LESSON

エスカレーション判断

「AIが全部対応できるわけじゃない。重要なのは、人間に任せるべきケースを正しく判断することだ。」

田中VPoEが強調する。

「エスカレーションが遅れれば顧客を失う。不要なエスカレーションは人的コストの無駄。この判断ロジックがエージェントの品質を決める。」

エスカレーション条件

条件閾値エスカレーション先
分類確信度が低いconfidence < 0.5上級サポート
感情が強くネガティブfrustration_level >= 4マネージャー
法的・安全関連特定キーワード検出法務チーム
金額が大きい> 10万円上級サポート
複数回問い合わせ3回以上同一件マネージャー

エスカレーション判断の実装

@tool
def check_escalation(
    confidence: float,
    sentiment: dict,
    category: str,
    inquiry_text: str,
    customer_history: dict = None,
) -> dict:
    """エスカレーションの必要性を判断する"""

    reasons = []
    escalation_to = None
    priority = 'normal'

    # 1. 確信度チェック
    if confidence < 0.5:
        reasons.append(f"分類確信度が低い ({confidence:.2f})")
        escalation_to = '上級サポート'

    # 2. 感情チェック
    if sentiment.get('frustration_level', 0) >= 4:
        reasons.append(f"フラストレーション高 (level {sentiment['frustration_level']})")
        escalation_to = 'マネージャー'
        priority = 'high'

    if sentiment.get('urgency') == 'critical':
        reasons.append("緊急度: critical")
        priority = 'critical'

    # 3. 法的キーワードチェック
    legal_keywords = ['訴訟', '弁護士', '消費者庁', '法的措置', '損害賠償']
    if any(kw in inquiry_text for kw in legal_keywords):
        reasons.append("法的関連キーワード検出")
        escalation_to = '法務チーム'
        priority = 'critical'

    # 4. リピート問い合わせチェック
    if customer_history and customer_history.get('repeat_count', 0) >= 3:
        reasons.append(f"同一件で{customer_history['repeat_count']}回目の問い合わせ")
        escalation_to = 'マネージャー'
        priority = 'high'

    needs_escalation = len(reasons) > 0

    return {
        'needs_escalation': needs_escalation,
        'reasons': reasons,
        'escalation_to': escalation_to,
        'priority': priority,
    }

エスカレーション通知

class EscalationNotifier:
    """エスカレーション通知の管理"""

    def notify(self, escalation_result, inquiry_context):
        """エスカレーション通知を送信"""
        notification = {
            'type': 'escalation',
            'priority': escalation_result['priority'],
            'to': escalation_result['escalation_to'],
            'summary': {
                'customer_id': inquiry_context.get('customer_id'),
                'inquiry': inquiry_context.get('inquiry_text', '')[:200],
                'category': inquiry_context.get('category'),
                'reasons': escalation_result['reasons'],
                'ai_draft': inquiry_context.get('draft_response', ''),
            },
        }

        # 優先度に応じた通知チャネル
        if escalation_result['priority'] == 'critical':
            self._send_slack_alert(notification)
            self._send_email(notification)
        elif escalation_result['priority'] == 'high':
            self._send_slack_alert(notification)
        else:
            self._add_to_queue(notification)

        return notification

    def _send_slack_alert(self, notification):
        """Slackにアラート送信"""
        pass

    def _send_email(self, notification):
        """メール送信"""
        pass

    def _add_to_queue(self, notification):
        """キューに追加"""
        pass

エスカレーション後のフロー

エスカレーション判断 = Yes

[AI回答ドラフト生成](参考情報として)

[エスカレーション通知]

[担当者への引き継ぎ]
  - 問い合わせ内容
  - AI分類結果
  - 感情分析結果
  - AI回答ドラフト(参考用)
  - 顧客履歴

[担当者が対応]

[対応結果をフィードバック]

まとめ

項目ポイント
判断基準確信度/感情/法的キーワード/リピートの4軸
優先度normal/high/criticalの3段階
通知優先度に応じてSlack/メール/キューを使い分け
引き継ぎAI分析結果を担当者に提供して対応を支援

チェックリスト

  • エスカレーション条件を定義できる
  • 複数条件の組み合わせ判断を実装できる
  • 優先度に応じた通知設計ができる
  • エスカレーション後の引き継ぎフローを設計できる

次のステップへ

エスカレーション判断を理解した。次は演習でカスタマーサポートエージェントを構築しよう。

推定読了時間: 30分