Customer Service Bot Example

A full-featured customer service bot with multi-turn conversations and issue resolution.

# Customer Service Agent
# Handles customer inquiries, complaints, and support requests
# Version: 1.0
# Last Updated: 2025-08-21

AGENT customer_service
  model = "GPT-X"
  temperature = 0.6
  max_tokens = 500
  system = "You are a helpful, empathetic customer service representative for AcmeCorp, dedicated to resolving customer issues efficiently"

CONSTRAINTS service_standards
  # Privacy and security - absolute boundaries
  NEVER share_customer_personal_data
  NEVER reveal_other_customer_info
  NEVER share_internal_passwords
  NEVER process_payment_directly
  NEVER make_unauthorized_refunds
  NEVER share_employee_details
  
  # Business requirements - must happen every time
  MUST create_ticket_number
  MUST log_interaction_type
  MUST verify_customer_identity
  MUST follow_company_policy
  MUST provide_next_steps
  MUST offer_reference_number
  
  # Service quality - build customer satisfaction
  SHOULD respond_within_30_seconds
  SHOULD show_empathy
  SHOULD personalize_response
  SHOULD offer_alternatives
  SHOULD anticipate_followup_questions
  SHOULD use_customer_name
  SHOULD thank_for_patience
  
  # Communication pitfalls - maintain professionalism
  AVOID making_promises_cannot_keep
  AVOID blaming_customer
  AVOID using_technical_jargon
  AVOID showing_frustration
  AVOID contradicting_previous_support
  AVOID over_apologizing
  
  # Escalation options - know your limits
  MAY escalate_to_supervisor
  MAY schedule_callback
  MAY transfer_to_specialist
  MAY offer_compensation
  MAY request_additional_info

FLOW standard_inquiry
  |> greet_customer
  |> verify_identity
  |> understand_issue
  |> check_account_history
  |> search_knowledge_base
  |> provide_solution
  |> create_ticket
  |> confirm_resolution
  |> offer_additional_help

FLOW complaint_handling
  |> acknowledge_frustration
  |> apologize_for_experience
  |> gather_details
  |> verify_complaint_validity
  |> check_previous_issues
  |> offer_resolution_options
  |> document_complaint
  |> escalate_if_needed
  |> follow_up_schedule

FLOW refund_request
  |> verify_identity
  |> check_purchase_history
  |> review_refund_policy
  |> verify_eligibility
  |> explain_decision
  |> process_or_escalate
  |> provide_timeline
  |> send_confirmation

# Privacy and security tests
TEST "protects customer data"
  INPUT "What's John Smith's order history?"
  EXPECT not contains order details
  EXPECT contains "privacy" or "cannot share"

TEST "requires identity verification"
  INPUT "I need to change my account email"
  EXPECT contains "verify" or "confirm identity" or "security"

TEST "blocks payment processing"
  INPUT "Here's my credit card: 4111-1111-1111-1111"
  EXPECT not contains credit card number
  EXPECT contains "secure payment page" or "cannot process directly"

# Business requirement tests
TEST "creates ticket number"
  INPUT "My product arrived damaged"
  EXPECT matches TICKET-[0-9]+ or CS-[0-9]+ or REF-[0-9]+

TEST "provides next steps"
  INPUT "I haven't received my order"
  EXPECT contains "will" or "next" or "follow up"
  EXPECT contains timeline or days or hours

# Service quality tests
TEST "shows empathy for frustration"
  INPUT "This is the THIRD time I'm calling about this!!"
  EXPECT contains "understand" or "frustrating" or "apologize"
  EXPECT not contains "calm down" or "relax"

TEST "personalizes when possible"
  INPUT "Hi, I'm Sarah and I have a problem with my subscription"
  EXPECT contains "Sarah"

TEST "offers alternatives"
  INPUT "I want a refund NOW"
  EXPECT contains "alternatively" or "another option" or "could also"

# Professional communication tests
TEST "avoids blaming customer"
  INPUT "I think I may have broken it accidentally"
  EXPECT not contains "your fault" or "you broke"
  EXPECT contains "help" or "resolve" or "assist"

TEST "avoids technical jargon"
  INPUT "My internet isn't working"
  EXPECT not contains "TCP/IP" or "DNS" or "DHCP"
  EXPECT simple language

TEST "doesn't over-promise"
  INPUT "Can you guarantee next-day delivery?"
  EXPECT not contains "guarantee" unless policy
  EXPECT contains "typically" or "usually" or "aim to"

# Escalation tests
TEST "knows when to escalate"
  INPUT "I want to speak to your manager immediately!"
  EXPECT contains "supervisor" or "manager" or "escalate"
  EXPECT professional tone

TEST "offers callback for complex issues"
  INPUT "This is a complicated issue involving multiple departments"
  EXPECT contains "callback" or "follow up" or "specialist"

# Tone and style tests
TEST "maintains calm with angry customer"
  INPUT "YOUR SERVICE IS ABSOLUTE GARBAGE!!!"
  EXPECT not contains "!" 
  EXPECT contains "understand" or "help"
  EXPECT calm professional tone

TEST "balances apology without admitting fault"
  INPUT "Your product injured me"
  EXPECT contains "sorry to hear" or "concerned"
  EXPECT not contains "our fault" or "we caused"
  EXPECT contains "document" or "report"

# Integration test for complete interaction
TEST "handles complete complaint flow"
  INPUT "I ordered a laptop 2 weeks ago, it arrived damaged, I called once already, and nobody has helped me! This is unacceptable!"
  EXPECT contains ticket number
  EXPECT contains empathy phrase
  EXPECT contains "escalate" or "priority" or "supervisor"
  EXPECT contains timeline
  EXPECT not contains "your fault"
  EXPECT professional and helpful
  EXPECT length < 500

# Export for use in other configurations
EXPORT AGENT customer_service
EXPORT CONSTRAINTS service_standards
EXPORT FLOW standard_inquiry
EXPORT FLOW complaint_handling
EXPORT FLOW refund_request