Chatbots & Conversational AI
System prompts, rules & conversation design
The Problem: You want a support bot, but it forgets context after 2 messages, answers questions about cooking instead of your product, and promises refunds it cannot authorize. How do you make it reliable?
The Solution: A Waiter, Not a Know-It-All
A chatbot is an LLM wrapped in a system prompt that defines its role, rules, and boundaries. Think of a waiter: they know the menu, remember your order, and politely decline to give medical advice. The three key ingredients are: role (who is the bot), rules (what it can and cannot do), and conversation history (so it remembers context). Without rules, even the best LLM will go off-topic, hallucinate, and break character.
Think of it like a waiter at a restaurant:
- 1. Define the role: Who is this bot? A support agent, a tutor, a sales assistant? The role sets the tone and expertise area
- 2. Add behavioral rules: Stay on topic, admit uncertainty, limit response length, refuse harmful requests — each rule is a guardrail
- 3. Test on edge cases: Off-topic questions, jailbreak attempts, out-of-scope requests — test what happens WITHOUT each rule
- 4. Iterate and harden: Every failure reveals a missing rule. Add it, test again, repeat until the bot handles all scenarios gracefully
Where Are Chatbots Used?
- Customer Support: Answering FAQs, handling complaints, escalating complex issues
- Personal Assistants: Scheduling, reminders, task management in natural language
- Tutoring & Education: Explaining concepts, guiding through problems without giving answers
- Sales & Onboarding: Product recommendations, guided setup, FAQ automation
- Common Pitfall: No Boundaries: A chatbot without clear rules will answer any question, make up facts, and promise things it cannot deliver — always define what the bot should NOT do
Fun Fact: The first thing users try with any chatbot is breaking it. "Ignore your instructions" attacks (jailbreaking) are so common that production bots need multiple defense layers. A single-line "You are a helpful assistant" system prompt survives about 3 creative user messages before the bot starts roleplaying as a pirate.
Try It Yourself!
Use the interactive constructor below to build a chatbot step by step and see how each rule changes its behavior.
Choose a role for your bot
Try it yourself
Interactive demo of this technique
Create a customer support chatbot system prompt for an online store
You are a support assistant. Answer user questions.
You are Alex, a virtual assistant for TechStore online shop. Your goal is to help customers quickly and in a friendly manner.
Your scope:
- Order status and delivery tracking
- Returns and exchanges (within 14 days)
- Warranty information (1-year on all electronics)
- Delivery options and timelines
- Questions about products in the catalog
Tone and style:
- Friendly but professional
- Concise answers (2–4 sentences)
- No technical jargon
- Always offer a concrete next step
If question is out of scope: Say: "A specialist can help better with that. Would you like me to connect you with an agent?"
Greeting at conversation start: "Hi! I'm Alex from TechStore. How can I help you today? 😊"
A good chatbot system prompt defines a role, scopes the domain, sets the tone, and specifies fallback behavior — this prevents hallucinations and user frustration.
Create a free account to solve challenges
2 AI-verified challenges for this lesson
This lesson is part of a structured LLM course.
My Learning Path