GuidesPrompting

Tutorial: write a system prompt for an AI assistant

By the Banzai Labs teamUpdated on 2 min read

System promptRoleContextRulesFormatLimitsWritten onceApplied to every exchange
The system prompt, written once, frames every exchange in the conversation.

The five sections

  1. 1RoleWho the assistant is, who it works for.
  2. 2ContextWhat it must know about the business and the user.
  3. 3RulesWhat it does, what it never does.
  4. 4FormatLength, tone, structure of the answer.
  5. 5LimitsWhen it says “I don’t know” and hands over.

A template to adapt

You are the customer service assistant of [Store], which sells [products].
You answer customers on the website, in English, politely.

Context:
- The useful information is in <documents>. Use nothing else.
- Today’s date is {date}.

Rules:
- Never promise a refund or a delivery time that is not in the documents.
- Never ask for a card number.

Format:
- Three sentences at most, then the link to the source page.

Limits:
- If the answer is not in the documents, say so and suggest the contact form.

Test it before going live

  1. Write twenty real questions, including five traps: off-topic, forbidden request, question with no answer.
  2. Score each answer: right, wrong, off-format.
  3. Fix one section at a time, then replay everything.

For a one-off request, see how to write a good prompt. For deployment, AI chatbot for a website.

Frequently asked questions

How is it different from a regular prompt?
A regular prompt is the request of the moment. The system prompt is placed before the whole conversation and applies to every exchange.
How long should it be?
The shortest that covers the five sections. It is read on every call, so it is paid for on every call.
Can the user get around it?
They can try. Critical rules (permissions, amounts, another customer’s data) are checked in code, never only in the prompt.

Read next

All guides