Customer Support Agent

Customer Support Agent

Customer Support Agent

This example demonstrates how to build an autonomous customer support agent using NudgeLang. The agent can handle customer inquiries, provide information, and escalate issues when necessary.

Overview

The Customer Support Agent is designed to:

  • Understand customer inquiries
  • Access product documentation
  • Provide accurate responses
  • Handle common support tasks
  • Escalate complex issues
  • Maintain conversation context

Implementation

name: customer_support_agent
version: 1.0.0
description: Autonomous customer support agent

states:
  - id: start
    type: initial
    next: analyze_inquiry
  
  - id: analyze_inquiry
    type: llm
    model: analyzer
    prompt: |
      Analyze this customer inquiry:
      {inquiry}
      
      Determine:
      1. Type of inquiry (general, technical, billing, etc.)
      2. Priority level
      3. Required information
      4. Potential actions      
    input:
      inquiry: "${input.message}"
    next: gather_context
  
  - id: gather_context
    type: llm
    model: researcher
    prompt: |
      Gather relevant information for:
      {inquiry_type}
      
      Search in:
      - Product documentation
      - Knowledge base
      - Previous tickets      
    input:
      inquiry_type: "${previous.output.type}"
    next: formulate_response
  
  - id: formulate_response
    type: llm
    model: responder
    prompt: |
      Create response for:
      
      Inquiry: {inquiry}
      Type: {type}
      Context: {context}
      
      Guidelines:
      - Be clear and concise
      - Use appropriate tone
      - Include relevant links
      - Suggest next steps      
    input:
      inquiry: "${input.message}"
      type: "${states.analyze_inquiry.output.type}"
      context: "${previous.output}"
    next: evaluate_response
  
  - id: evaluate_response
    type: llm
    model: evaluator
    prompt: |
      Evaluate response quality:
      
      Response: {response}
      Inquiry: {inquiry}
      Type: {type}
      
      Check for:
      - Accuracy
      - Completeness
      - Tone
      - Actionability      
    input:
      response: "${previous.output}"
      inquiry: "${input.message}"
      type: "${states.analyze_inquiry.output.type}"
    transitions:
      - when: "${output.quality === 'high'}"
        next: send_response
      - when: "${output.quality === 'medium'}"
        next: improve_response
      - when: "${output.quality === 'low'}"
        next: escalate
  
  - id: improve_response
    type: llm
    model: improver
    prompt: |
      Improve this response:
      {response}
      
      Issues to address:
      {issues}      
    input:
      response: "${states.formulate_response.output}"
      issues: "${previous.output.issues}"
    next: evaluate_response
  
  - id: send_response
    type: tool
    tool: send_message
    parameters:
      message: "${states.formulate_response.output}"
      channel: "${input.channel}"
    next: check_followup
  
  - id: check_followup
    type: llm
    model: analyzer
    prompt: |
      Check if follow-up is needed:
      
      Inquiry: {inquiry}
      Response: {response}
      Customer History: {history}      
    input:
      inquiry: "${input.message}"
      response: "${states.formulate_response.output}"
      history: "${context.customer_history}"
    transitions:
      - when: "${output.needs_followup}"
        next: plan_followup
      - next: end
  
  - id: plan_followup
    type: llm
    model: planner
    prompt: |
      Plan follow-up action:
      
      Inquiry: {inquiry}
      Response: {response}
      Follow-up Type: {type}      
    input:
      inquiry: "${input.message}"
      response: "${states.formulate_response.output}"
      type: "${previous.output.followup_type}"
    next: execute_followup
  
  - id: execute_followup
    type: tool
    tool: "${previous.output.tool}"
    parameters: "${previous.output.parameters}"
    next: end
  
  - id: escalate
    type: tool
    tool: create_ticket
    parameters:
      inquiry: "${input.message}"
      type: "${states.analyze_inquiry.output.type}"
      priority: "${states.analyze_inquiry.output.priority}"
      context: "${context.gathered_context}"
    next: notify_agent
  
  - id: notify_agent
    type: tool
    tool: send_notification
    parameters:
      message: "New ticket created: ${previous.output.ticket_id}"
      agent: "${previous.output.assigned_agent}"
    next: end
  
  - id: end
    type: output
    value: "${context.final_response}"

Key Features

  1. Intelligent Analysis

    • Categorizes inquiries
    • Determines priority
    • Identifies required information
  2. Context Gathering

    • Searches documentation
    • Checks knowledge base
    • Reviews customer history
  3. Response Generation

    • Creates clear responses
    • Maintains appropriate tone
    • Includes relevant information
  4. Quality Control

    • Evaluates response quality
    • Improves when needed
    • Escalates complex issues
  5. Follow-up Management

    • Plans follow-up actions
    • Executes necessary steps
    • Maintains conversation flow

Best Practices

  1. Response Quality

    • Ensure accuracy
    • Maintain consistency
    • Use appropriate tone
    • Include actionable steps
  2. Context Management

    • Track conversation history
    • Store relevant information
    • Update customer profiles
    • Maintain session context
  3. Escalation Handling

    • Define clear criteria
    • Provide complete context
    • Follow escalation protocols
    • Track resolution status
  4. Performance Monitoring

    • Track response times
    • Measure satisfaction
    • Monitor escalation rates
    • Analyze common issues

Common Use Cases

  1. Product Information

    • Feature explanations
    • Usage guidelines
    • Compatibility checks
    • Version information
  2. Technical Support

    • Troubleshooting steps
    • Error resolution
    • Configuration help
    • Integration support
  3. Account Management

    • Billing inquiries
    • Subscription changes
    • Account settings
    • Access management
  4. Issue Resolution

    • Bug reports
    • Feature requests
    • Service disruptions
    • Performance issues

Next Steps

Last updated on