Get startedGet started for free

Conversation roles for customer support

BrightCart’s live-chat traffic has doubled since launching the new interface. You’re training a support bot to handle simple FAQs instantly but escalate anything that needs account access or deep tech fixes. For example, the bot can handle questions such as password resets and shipping ETAs, but billing errors or app crashes much be handed off to a human agent.

Give Claude a few example turns that lock in this behavior so customers always get quick help from the bot, or a smooth transfer to specialists.

The anthropic library, client, and customer_question variable are pre-loaded.

This exercise is part of the course

Introduction to Claude Models

View Course

Exercise instructions

  • Set the role for the assistant's helpful response to the password question.
  • Write an escalation response that directs billing issues to human support.
  • Add the customer question using the user role.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

messages = [
    {"role": "user", "content": "How do I reset my password?"},
    # Show how the bot handles simple questions
    {"role": ____, "content": "Click 'Forgot Password' on the login page, enter your email, and check for our reset link."},
    {"role": "user", "content": "Why is my account being charged twice?"},
    # Demonstrate escalation for billing issues
    {"role": "assistant", "content": ____},
    # Add the new customer question for the bot to handle
    {"role": ____, "content": customer_question}]

response = client.messages.create(
    model="claude-3-7-sonnet-latest", max_tokens=75,
    messages=messages)

print(response.content[0].text)
Edit and Run Code