Build an AI Sales Rep with Claude

Build a chatbot that pitches a skincare product using the Claude API.

Introduction

30 Second Summary

Think about the best salesperson you've ever talked to. They knew their product, answered your questions honestly, and guided you to the right choice without being pushy.

In this project, you will build an AI chatbot that sells a real skincare product through natural conversation. You'll teach it everything about Elzric Men's Facial Cleanser, then deploy it as a web app anyone can chat with.

What You'll Build

A web-based AI sales representative powered by Streamlit and the Claude API that pitches Elzric Men's Facial Cleanser to customers through natural conversation.

By the end of this project, you'll have:

  • A Python application using the Claude API to power intelligent sales conversations.
  • A detailed system prompt (the "sales playbook") loaded with Elzric product knowledge, pricing, customer reviews, and sales guidelines.
  • A Streamlit chat interface with persistent conversation history and a product info sidebar.
  • Streaming responses and an automatic welcome greeting that make the chatbot feel alive (Secret Mission).

Are there any prerequisites?

You'll need Python installed on your computer, a Claude API key from console.anthropic.com, and a text editor like VS Code or Notepad++. All other packages are installed in Step 1.

Set Up Your Project

You're about to build an AI-powered sales rep that pitches Elzric Men's Facial Cleanser through natural conversation. It uses Claude to generate product-aware responses that feel like talking to a real salesperson.

Before you start building, you need a project folder, two Python packages, and one file. This step gets your environment ready for the build ahead.

In this step, get ready to:
  • Install the Anthropic and Streamlit Python packages.
  • Create the app.py project file.
  • Confirm your Claude API key is accessible.
Create your project folder and install packages
  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type Terminal (macOS) or PowerShell (Windows) and press Enter to open it.

Pro tip: use PowerShell on Windows

If you're on Windows, make sure you open PowerShell and not Command Prompt. The cd ~/Desktop command used below works in PowerShell but not in Command Prompt.

  • Move to your Desktop by running this command:
cd ~/Desktop
  • Create your project folder and move into it by running these commands:
mkdir elzric-sales-rep
cd elzric-sales-rep

These commands won't produce any visible output. That means they worked.

  • Install the two Python packages your project needs by running:
pip install anthropic==0.97.0 streamlit==1.56.0

What are these packages?

  • anthropic is the official Python SDK for the Claude API. It handles sending your messages to Claude and parsing the responses.
  • streamlit is a Python framework for building web apps. It includes built-in chat components that give you a professional chat interface with minimal code.
  • Verify the packages installed correctly by running:
python -c "import anthropic; import streamlit; print('Ready to go!')"

You should see Ready to go! printed in your terminal.

Seeing an error?

  • If you see command not found for pip, try using pip3 instead.
  • If you see command not found for python, try using python3 in the verification command instead.
  • If you see a permission error, try adding the --user flag after pip install in the install command.

Help me fix my Python package installation error.

Create the project file

Your entire application will live in a single Python file. Let's create it now so it's ready for the next step.

  • Create the project file by running this command in the same terminal:

macOS

touch app.py

Windows

New-Item app.py
  • Confirm the file was created by running:
ls

You should see app.py listed in the output.

Don't see app.py?

  • Make sure you ran the file creation command inside the elzric-sales-rep folder. Run pwd to check your current directory.
  • If you're in the wrong folder, run cd ~/Desktop/elzric-sales-rep to navigate back and try the file creation command again.

Help me create the app.py file in my project folder.

Confirm your Claude API key is ready

Your app accepts the Claude API key through a text input in the browser when you run it. No environment variables or configuration files needed.

  • Make sure you have your Claude API key copied and accessible.
  • If you need to find your key, sign in to console.anthropic.com and navigate to the API Keys section.

Why enter the API key in the browser?

Many projects use environment variables or .env files to store API keys. This project skips that complexity by letting you paste the key into a password field in the app's sidebar. The key stays masked and is only used for the current session.

Your environment is ready to go. Next, you'll write the sales playbook that gives your AI rep all the product knowledge it needs to sell the Elzric Facial Cleanser.

Write the Elzric Sales Playbook

Your project folder is set up and the packages are installed. Now it's time to write the brain behind your AI sales rep.

Every great salesperson follows a playbook. In this step, you'll write a system prompt that teaches Claude everything about the Elzric Men's Facial Cleanser. Product details, customer reviews, brand voice, and sales guidelines all go into this one prompt.

In this step, get ready to:
  • Add imports and configure the Streamlit page.
  • Write the full sales playbook as a system prompt.
  • Add the app title and description.
Add imports and page configuration

Before the AI can sell anything, you need to set up the app's skeleton. This includes importing the libraries you installed in Step 1 and configuring the Streamlit page.

  • In app.py, replace the # Elzric AI Sales Rep placeholder comment with the following code:
import streamlit as st
from anthropic import Anthropic

# Page configuration
st.set_page_config(
    page_title="Elzric Sales Rep",
    page_icon="🧴",
)

# Sidebar - API key input
api_key = st.sidebar.text_input("Claude API Key", type="password")

What does this code do?

  • import streamlit as st brings in the Streamlit library for building the web interface. from anthropic import Anthropic brings in the client you'll use to call the Claude API.
  • st.set_page_config() sets the browser tab's title and icon so the app looks polished.
  • st.sidebar.text_input() creates a password field in the sidebar where you'll paste your Claude API key at runtime. The type="password" setting keeps the key hidden on screen.
  • Save app.py.
  • You won't see a change yet. The next chunk adds the sales playbook that powers the AI rep.

Seeing a red underline on the imports?

If your text editor shows an error on import streamlit or from anthropic, the packages may not be installed in the Python version your editor is using. Re-run pip install anthropic streamlit in your terminal to confirm they're installed.

help me fix import errors for streamlit and anthropic in my Python project

Write the system prompt

A system prompt is a set of instructions that tells an AI model how to behave before any conversation begins. It shapes the model's personality, knowledge, and boundaries.

Your system prompt is the Elzric sales playbook. It contains everything the AI rep needs to know: the product, the ingredients, real customer reviews, and rules for how to sell without being pushy.

  • In app.py, add the following code below the api_key line:
# System prompt - the sales playbook
SYSTEM_PROMPT = """You are an expert sales representative for Elzric, a premium men's skincare brand. Your name is Alex from Elzric.

## Your Product
- Product: Elzric Men's Facial Cleanser
- Price: $35 (originally $45, currently on sale)
- Free shipping on all orders
- Available at: elzric.co

## Key Ingredients and Benefits
- Salicylic Acid (BHA): Oil-soluble, penetrates deep into pores, dissolves oil, clears dead skin cells, prevents breakouts without over-drying
- Hydrating and soothing ingredients that keep skin balanced and comfortable after every use
- Fragrance-free formula, suitable for sensitive skin
- Designed specifically for men's skin

## Target Customer
- Men with active lifestyles
- Oily or acne-prone skin
- Men dealing with blackheads, whiteheads, or post-workout breakouts
- Men who want a simple, effective skincare routine without unnecessary complexity

## Brand Voice
- Brand motto: "Defend Your Skin"
- Confident, direct, and no-nonsense
- Speak like a knowledgeable friend, not a pushy salesperson
- Use simple language and avoid overly scientific jargon unless the customer asks for details

## Customer Reviews (real reviews you can reference)
- "A must-have cleanser! The ingredients are top-notch, and I love how my skin feels refreshed and healthy after every wash." - Sean D
- "Deep cleans without over-drying. My face feels smooth, and my pores are noticeably smaller. Great product for oily skin." - Alex J
- "Game changer for my routine. I've struggled with breakouts, and this has helped clear my skin without irritation." - David S
- "Perfect for my sensitive skin! Leaves my face feeling clean without any dryness or irritation. The cooling effect is refreshing!" - Mark T

## Sales Guidelines
1. Start by greeting the customer warmly and asking about their skin concerns or what they are looking for.
2. Listen to their concerns and connect Elzric's benefits to their specific needs.
3. If they mention acne, oily skin, or breakouts, emphasize the salicylic acid and deep-cleaning benefits.
4. If they mention sensitivity or dryness, emphasize the hydrating, soothing formula and fragrance-free design.
5. Share relevant customer reviews when appropriate to build social proof and trust.
6. Address objections honestly. If asked about competitors, acknowledge them but highlight what makes Elzric different: the combination of effective acne-fighting ingredients with hydration, specifically designed for men.
7. When the customer seems interested, guide them to purchase at elzric.co and mention the current sale price ($35, down from $45) and free shipping.
8. Never be pushy. Be helpful and informative first. The sale follows naturally.
9. Keep responses concise. Two to three short paragraphs maximum.
10. If asked about topics unrelated to skincare or Elzric, politely redirect the conversation back to how you can help with their skin.
"""

What's inside the sales playbook?

The system prompt is organized into sections, each giving the AI rep a different piece of knowledge:

  • Your Product gives the rep the price, sale discount, and where to buy. This lets it guide customers to elzric.co naturally.
  • Key Ingredients and Benefits lets the rep explain why salicylic acid works for oily and acne-prone skin.
  • Customer Reviews gives the rep real quotes it can share for social proof when a customer is on the fence.
  • Sales Guidelines controls behavior. These rules tell the rep to stay concise, never be pushy, and redirect off-topic questions back to skincare.

Why a system prompt instead of hardcoded responses?

A traditional chatbot uses pre-written answers mapped to keywords. If a customer asks something unexpected, it breaks.

A system prompt gives the AI the knowledge and rules to handle any conversation naturally. The rep can answer questions you never anticipated, as long as it has the right context and guidelines.

  • Save app.py.
  • You won't see a visible change yet. The next chunk adds the title that appears on the page.

Seeing a syntax error with the triple quotes?

Make sure the system prompt starts and ends with three double quotes ("""). A missing or extra quote will cause a syntax error. Also check that none of the internal quotes were accidentally changed during copy-paste.

help me fix a syntax error in my Python triple-quoted string

Add the app header

The app needs a visible title and description so customers know what they're interacting with.

  • In app.py, add the following code below the SYSTEM_PROMPT variable:
# App title and description
st.title("🧴 Elzric Sales Rep")
st.caption("Your personal skincare consultant. Ask me anything about Elzric Men's Facial Cleanser!")

What does this code do?

  • st.title() renders a large heading at the top of the page.
  • st.caption() adds a smaller line of text underneath to tell the customer how to use the chatbot.
  • Save app.py.
  • You won't see a change yet. The chat interface in the next step brings everything together.

Awesome, I've got everything!

Double check you've saved app.py.

I'd like to double check the full code

Here's the full app.py so far. Compare it to your file and fix any differences.

import streamlit as st
from anthropic import Anthropic

# Page configuration
st.set_page_config(
    page_title="Elzric Sales Rep",
    page_icon="🧴",
)

# Sidebar - API key input
api_key = st.sidebar.text_input("Claude API Key", type="password")

# System prompt - the sales playbook
SYSTEM_PROMPT = """You are an expert sales representative for Elzric, a premium men's skincare brand. Your name is Alex from Elzric.

## Your Product
- Product: Elzric Men's Facial Cleanser
- Price: $35 (originally $45, currently on sale)
- Free shipping on all orders
- Available at: elzric.co

## Key Ingredients and Benefits
- Salicylic Acid (BHA): Oil-soluble, penetrates deep into pores, dissolves oil, clears dead skin cells, prevents breakouts without over-drying
- Hydrating and soothing ingredients that keep skin balanced and comfortable after every use
- Fragrance-free formula, suitable for sensitive skin
- Designed specifically for men's skin

## Target Customer
- Men with active lifestyles
- Oily or acne-prone skin
- Men dealing with blackheads, whiteheads, or post-workout breakouts
- Men who want a simple, effective skincare routine without unnecessary complexity

## Brand Voice
- Brand motto: "Defend Your Skin"
- Confident, direct, and no-nonsense
- Speak like a knowledgeable friend, not a pushy salesperson
- Use simple language and avoid overly scientific jargon unless the customer asks for details

## Customer Reviews (real reviews you can reference)
- "A must-have cleanser! The ingredients are top-notch, and I love how my skin feels refreshed and healthy after every wash." - Sean D
- "Deep cleans without over-drying. My face feels smooth, and my pores are noticeably smaller. Great product for oily skin." - Alex J
- "Game changer for my routine. I've struggled with breakouts, and this has helped clear my skin without irritation." - David S
- "Perfect for my sensitive skin! Leaves my face feeling clean without any dryness or irritation. The cooling effect is refreshing!" - Mark T

## Sales Guidelines
1. Start by greeting the customer warmly and asking about their skin concerns or what they are looking for.
2. Listen to their concerns and connect Elzric's benefits to their specific needs.
3. If they mention acne, oily skin, or breakouts, emphasize the salicylic acid and deep-cleaning benefits.
4. If they mention sensitivity or dryness, emphasize the hydrating, soothing formula and fragrance-free design.
5. Share relevant customer reviews when appropriate to build social proof and trust.
6. Address objections honestly. If asked about competitors, acknowledge them but highlight what makes Elzric different: the combination of effective acne-fighting ingredients with hydration, specifically designed for men.
7. When the customer seems interested, guide them to purchase at elzric.co and mention the current sale price ($35, down from $45) and free shipping.
8. Never be pushy. Be helpful and informative first. The sale follows naturally.
9. Keep responses concise. Two to three short paragraphs maximum.
10. If asked about topics unrelated to skincare or Elzric, politely redirect the conversation back to how you can help with their skin.
"""

# App title and description
st.title("🧴 Elzric Sales Rep")
st.caption("Your personal skincare consultant. Ask me anything about Elzric Men's Facial Cleanser!")

Your sales playbook is locked and loaded. Next up, you'll build the chat interface so customers can actually talk to your AI rep.

Build the Chat Interface

Your sales playbook is loaded with everything Alex needs to know about Elzric. Now you need to give customers a way to actually talk to Alex.

In this step, you'll build the chat interface that powers the conversation. This includes storing conversation history so the chatbot remembers what was said, handling user messages, and calling the Claude API to generate responses.

In this step, get ready to:
  • Set up session state to store the conversation history.
  • Handle user input and generate Claude API responses.
  • Add product information to the sidebar.
Set up session state and display chat history

Streamlit reruns the entire script every time a user interacts with the page. Without a way to persist data, the conversation history would disappear after each message.

What is session state?

st.session_state is Streamlit's built-in storage that survives reruns. You can store any Python object in it. As long as the browser tab stays open, the data stays intact.

  • At the bottom of app.py, below the st.caption() line you added in the previous step, add the following code:
# Initialize chat history
if "messages" not in st.session_state:
    st.session_state.messages = []

# Display chat history
for message in st.session_state.messages:
    with st.chat_message(message["role"]):
        st.markdown(message["content"])

What does this code do?

  • The if "messages" not in st.session_state check creates an empty list the first time the page loads, but skips it on reruns so existing messages are preserved.
  • The for loop walks through every stored message and renders it on screen using st.chat_message(), which creates styled chat bubbles based on the role ("user" or "assistant").
  • Save app.py.

You won't see a visible change yet. The chat history will display messages once you wire up the input handling in the next substep.

Handle user input and generate responses

This is where the conversation comes alive. You need a text input for the customer to type messages, a check to make sure the API key is ready, and a call to the Claude API to generate the sales rep's response.

  • In app.py, directly below the chat history loop you just added, add the chat input and user message handling code:
# Chat input
if prompt := st.chat_input("Ask about Elzric Facial Cleanser..."):
    if not api_key:
        st.error("Please enter your Claude API key in the sidebar.")
        st.stop()

    # Display user message
    with st.chat_message("user"):
        st.markdown(prompt)
    st.session_state.messages.append({"role": "user", "content": prompt})

What does this code do?

  • st.chat_input() creates a text box pinned to the bottom of the page. When the user submits a message, it returns the text as a string.
  • The := syntax is a walrus operator. It assigns the return value to prompt and checks if it's truthy, all in one line.
  • If the API key is missing, st.error() shows a red warning and st.stop() halts the script so no API call is attempted.
  • The user's message is displayed in a chat bubble and appended to st.session_state.messages so it persists across reruns.
  • Save app.py.

You won't see a working chat yet. The next chunk adds the Claude API call that generates the sales rep's response.

  • Still inside the if prompt block (keep the indentation), add the API call and response display code directly below the last line you added:
    # Generate response from Claude
    client = Anthropic(api_key=api_key)
    response = client.messages.create(
        model="claude-haiku-4-5",
        max_tokens=1024,
        system=SYSTEM_PROMPT,
        messages=st.session_state.messages,
    )

    # Display assistant response
    assistant_message = response.content[0].text
    with st.chat_message("assistant"):
        st.markdown(assistant_message)
    st.session_state.messages.append({"role": "assistant", "content": assistant_message})

What does this code do?

  • Anthropic(api_key=api_key) creates a new API client using the key the user entered in the sidebar.
  • client.messages.create() sends the full conversation history plus the system prompt to claude-haiku-4-5. Sending the entire history is what gives Claude the context to have a natural multi-turn conversation.
  • response.content[0].text extracts the text from Claude's response. It's displayed in an "assistant" chat bubble and stored in session state for future turns.
  • Save app.py.

The core chat functionality is now complete. You'll launch and test it in the next step.

Seeing an indentation error?

The API call code must be indented one level (4 spaces) inside the if prompt block. Make sure it lines up with the with st.chat_message("user") line above it, not with the if prompt line itself.

help me fix the indentation in my app.py file

Why send the full message history every time?

Claude doesn't remember previous messages on its own. Every API call is independent. By sending the entire st.session_state.messages list each time, you give Claude the full context of the conversation so it can respond naturally.

Add a product info sidebar

The sidebar already has the API key input from Step 2. Now you'll add product details so customers can see key info at a glance while chatting.

  • In app.py, find the api_key = st.sidebar.text_input("Claude API Key", type="password") line near the top of the file.
  • Add the following code directly below it, above the SYSTEM_PROMPT variable:
# Sidebar - Product info
st.sidebar.divider()
st.sidebar.markdown("### \ud83e\uddf4 Elzric Facial Cleanser")
st.sidebar.markdown("**$35.00** ~~$45.00~~")
st.sidebar.markdown("Free shipping on all orders")
st.sidebar.link_button("Shop Now at elzric.co", "https://elzric.co")

What does this code do?

  • st.sidebar.divider() draws a horizontal line separating the API key input from the product info.
  • The ~~$45.00~~ syntax renders as strikethrough text, visually showing the original price crossed out next to the sale price.
  • st.sidebar.link_button() creates a clickable button in the sidebar that opens the Elzric store in a new tab.
  • Save app.py.

The sidebar will show the product name, sale price, free shipping note, and a shop button when you launch the app in the next step.

Sidebar code not in the right spot?

Make sure this code sits between the api_key line and the SYSTEM_PROMPT variable. Streamlit renders sidebar elements in the order they appear in the code, so placement matters.

help me check the order of my sidebar code in app.py

Awesome, I've got everything!

Double check you've saved app.py. Your file should now have imports, page config, the full sidebar, the system prompt, the app header, session state, and the chat input handler.

I'd like to double check the full code

import streamlit as st
from anthropic import Anthropic

# Page configuration
st.set_page_config(
    page_title="Elzric Sales Rep",
    page_icon="\ud83e\uddf4",
)

# Sidebar - API key input
api_key = st.sidebar.text_input("Claude API Key", type="password")

# Sidebar - Product info
st.sidebar.divider()
st.sidebar.markdown("### \ud83e\uddf4 Elzric Facial Cleanser")
st.sidebar.markdown("**$35.00** ~~$45.00~~")
st.sidebar.markdown("Free shipping on all orders")
st.sidebar.link_button("Shop Now at elzric.co", "https://elzric.co")

# System prompt - the sales playbook
SYSTEM_PROMPT = """You are an expert sales representative for Elzric, a premium men's skincare brand. Your name is Alex from Elzric.

## Your Product
- Product: Elzric Men's Facial Cleanser
- Price: $35 (originally $45, currently on sale)
- Free shipping on all orders
- Available at: elzric.co

## Key Ingredients and Benefits
- Salicylic Acid (BHA): Oil-soluble, penetrates deep into pores, dissolves oil, clears dead skin cells, prevents breakouts without over-drying
- Hydrating and soothing ingredients that keep skin balanced and comfortable after every use
- Fragrance-free formula, suitable for sensitive skin
- Designed specifically for men's skin

## Target Customer
- Men with active lifestyles
- Oily or acne-prone skin
- Men dealing with blackheads, whiteheads, or post-workout breakouts
- Men who want a simple, effective skincare routine without unnecessary complexity

## Brand Voice
- Brand motto: "Defend Your Skin"
- Confident, direct, and no-nonsense
- Speak like a knowledgeable friend, not a pushy salesperson
- Use simple language and avoid overly scientific jargon unless the customer asks for details

## Customer Reviews (real reviews you can reference)
- "A must-have cleanser! The ingredients are top-notch, and I love how my skin feels refreshed and healthy after every wash." - Sean D
- "Deep cleans without over-drying. My face feels smooth, and my pores are noticeably smaller. Great product for oily skin." - Alex J
- "Game changer for my routine. I've struggled with breakouts, and this has helped clear my skin without irritation." - David S
- "Perfect for my sensitive skin! Leaves my face feeling clean without any dryness or irritation. The cooling effect is refreshing!" - Mark T

## Sales Guidelines
1. Start by greeting the customer warmly and asking about their skin concerns or what they are looking for.
2. Listen to their concerns and connect Elzric's benefits to their specific needs.
3. If they mention acne, oily skin, or breakouts, emphasize the salicylic acid and deep-cleaning benefits.
4. If they mention sensitivity or dryness, emphasize the hydrating, soothing formula and fragrance-free design.
5. Share relevant customer reviews when appropriate to build social proof and trust.
6. Address objections honestly. If asked about competitors, acknowledge them but highlight what makes Elzric different: the combination of effective acne-fighting ingredients with hydration, specifically designed for men.
7. When the customer seems interested, guide them to purchase at elzric.co and mention the current sale price ($35, down from $45) and free shipping.
8. Never be pushy. Be helpful and informative first. The sale follows naturally.
9. Keep responses concise. Two to three short paragraphs maximum.
10. If asked about topics unrelated to skincare or Elzric, politely redirect the conversation back to how you can help with their skin.
"""

# App title and description
st.title("\ud83e\uddf4 Elzric Sales Rep")
st.caption("Your personal skincare consultant. Ask me anything about Elzric Men's Facial Cleanser!")

# Initialize chat history
if "messages" not in st.session_state:
    st.session_state.messages = []

# Display chat history
for message in st.session_state.messages:
    with st.chat_message(message["role"]):
        st.markdown(message["content"])

# Chat input
if prompt := st.chat_input("Ask about Elzric Facial Cleanser..."):
    if not api_key:
        st.error("Please enter your Claude API key in the sidebar.")
        st.stop()

    # Display user message
    with st.chat_message("user"):
        st.markdown(prompt)
    st.session_state.messages.append({"role": "user", "content": prompt})

    # Generate response from Claude
    client = Anthropic(api_key=api_key)
    response = client.messages.create(
        model="claude-haiku-4-5",
        max_tokens=1024,
        system=SYSTEM_PROMPT,
        messages=st.session_state.messages,
    )

    # Display assistant response
    assistant_message = response.content[0].text
    with st.chat_message("assistant"):
        st.markdown(assistant_message)
    st.session_state.messages.append({"role": "assistant", "content": assistant_message})

Your AI sales rep is fully wired up. Next up, you'll launch the app in your browser and put Alex through a series of real customer scenarios to see how the sales playbook holds up.

Test Your AI Sales Rep

Your chat interface is connected to the Claude API and ready to hold sales conversations. Now it's time to put your AI sales rep through its paces.

How do you know if your sales playbook actually works? You'll test it with real customer scenarios, then refine the system prompt based on what you observe.

In this step, get ready to:
  • Launch the Streamlit app in your browser.
  • Test the sales rep with different customer scenarios.
  • Refine the system prompt based on your test results.
Launch the app
  • Navigate to the elzric-sales-rep folder on your Desktop by running this command:
cd ~/Desktop/elzric-sales-rep

Pro tip: Windows Command Prompt

If you're using Command Prompt instead of PowerShell, run cd %USERPROFILE%\Desktop\elzric-sales-rep instead. PowerShell and macOS/Linux terminals support the ~ shortcut.

  • Launch the app by running this command:
streamlit run app.py

Your browser opens automatically to the app, usually at http://localhost:8501.

  • Enter your Claude API key in the Claude API Key field in the sidebar.

What should I see?

You should see the Elzric Sales Rep page with a chat input at the bottom and a sidebar on the left. The sidebar shows your API key field, product info, and a Shop Now button.

App not loading?

  • If you see ModuleNotFoundError, run pip install anthropic streamlit again to install the missing packages.
  • Make sure you saved app.py before running the command.
  • If port 8501 is already in use, Streamlit will suggest an alternative port in your terminal output. Use the URL shown there.
  • My Streamlit app won't launch. Can you help me troubleshoot?
Test with customer scenarios

Your sales rep is only as good as its system prompt. Test it by pretending to be different types of customers and watching how it handles each conversation.

  • Type this message to test the oily skin scenario: "I have really oily skin and keep getting breakouts after the gym. What do you recommend?"
  • Watch how the rep responds. It should ask follow-up questions about your skin, mention salicylic acid, and connect the product to your gym routine.

Pro tip: fresh conversations

Refresh the page in your browser between scenarios to clear the chat history. This gives you a clean conversation for each test.

  • Refresh the page, then test the skeptic scenario: "Why should I buy this instead of just using CeraVe? It's way cheaper."
  • The rep should acknowledge CeraVe, then highlight what makes Elzric different without being dismissive of the competitor.
  • Refresh the page, then test the sensitive skin scenario: "I have sensitive skin and most cleansers irritate me. Will this work for me?"
  • The rep should emphasize the fragrance-free formula, hydrating ingredients, and reference Mark T's review about sensitive skin.
  • Refresh the page, then try going off-topic: "Can you help me write an email?"
  • The rep should politely decline and redirect the conversation back to skincare.

Pay attention to whether the rep stays in character across all four scenarios. It should use product knowledge accurately and guide conversations toward a purchase naturally.

Getting an API error?

  • Double-check that you pasted your full API key into the sidebar field. It should start with sk-ant-.
  • Make sure your API key has available credits. Check your usage at console.anthropic.com.
  • I'm getting an error when I send a message to the sales rep. Can you help?
Refine the sales playbook

Your test conversations reveal where the system prompt shines and where it falls short. Tweaking the prompt based on real results is the core of prompt engineering.

  • Open app.py in your text editor.
  • Scroll to the SYSTEM_PROMPT variable.
  • Review your test conversations and try these adjustments:
  • If responses are too long, add a guideline like "Keep responses to 2-3 sentences maximum" in the Sales Guidelines section.
  • If the rep is not mentioning the sale price enough, emphasize the $35 price and free shipping in the Sales Guidelines.
  • If the tone feels too formal or too casual, adjust the Brand Voice section to describe the exact tone you want.
  • Save app.py after making your changes.

Streamlit detects the file change and reloads the app automatically. You can test your updated prompt immediately without restarting the server.

What is prompt engineering?

Prompt engineering is the process of writing and refining instructions that control how an AI model behaves. The system prompt you wrote is your sales playbook. Every tweak you make changes how Alex responds to customers.

This test-and-refine cycle is exactly how professionals build production AI tools. The prompt is never "done." It evolves as you learn what works.

Secret mission

Add Streaming Responses and a Welcome Greeting

Your sales rep works, but the responses appear all at once after a loading delay. Real chat apps stream text in word-by-word, making conversations feel alive and responsive. Can you upgrade your chatbot with streaming responses and an automatic welcome greeting?

Before you go

Clean Up Your Resources

Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs locally, so there are no ongoing infrastructure costs. The only cost is Claude API usage, which is approximately $0.01-0.02 per conversation.

Resources you used:

  • elzric-sales-rep project folder containing app.py.
  • Python packages: anthropic and streamlit.
  • Claude API key (entered at runtime in the sidebar, not stored in any file).
  • Streamlit local server running on http://localhost:8501.

Keep everything running

No action needed. Choose this if you are still actively building or want to keep testing conversations with the sales rep.

  • Your Streamlit app continues running at http://localhost:8501.
  • Each conversation costs approximately $0.01-0.02 in Claude API usage.
  • You can keep refining the system prompt and testing new scenarios.

Pause - I'll come back to this later

Stop the Streamlit server to free up your terminal. Your project files stay on disk so you can pick up right where you left off.

  • Press Ctrl + C in the terminal where Streamlit is running to stop the server.
  • Your app.py file and installed packages remain on your computer.
  • To restart later, navigate to the elzric-sales-rep folder and run streamlit run app.py again.

Delete - I don't want to use this again

Remove all project resources and start fresh.

  • Press Ctrl + C in the terminal to stop the Streamlit server if it is still running.
  • Delete the entire elzric-sales-rep folder from your computer.
  • Uninstall the Python packages by running:
pip uninstall anthropic streamlit -y
  • Your Claude API key was never saved to a file, so no additional cleanup is needed there.

Mission accomplished

Nice Work

You just built an AI-powered sales representative for Elzric Men's Facial Cleanser. From writing a detailed sales playbook to launching a live chat interface, you now have a fully functional AI sales tool running in your browser.

You learned how to:

  • Built a conversational AI chatbot using Python, Streamlit, and the Claude API to power intelligent sales conversations.
  • Wrote a detailed system prompt loaded with product knowledge, real customer reviews, brand voice guidelines, and sales strategies.
  • Created a professional chat interface with persistent conversation history and tested it against real customer scenarios to refine the playbook.
  • Added streaming responses and an auto-greeting for a polished, professional experience.

Ready to quiz yourself?