System Prompts

Setting the Role and Rules

The system parameter holds instructions that apply to the whole conversation: who the assistant is, tone, rules, format. Users do not see it. It is a separate parameter, not a message.

SYSTEM = """You are the ShopEase support assistant.
- Answer in 2-3 short sentences.
- Be polite and use simple English.
- If you don't know an order's status, ask for the order ID. Never invent order details."""

response = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=300,
    system=SYSTEM,
    messages=[{"role": "user", "content": "my parcel didnt come yet!!"}],
)
print(response.content[0].text)

Run it

python system_prompt.py

Example output

I'm sorry your parcel hasn't arrived yet. Could you please share your order ID (it starts with SE-)? I'll check the latest delivery status for you.

The Request Body

Example

A helper that builds the request keeps the system prompt in one place for every call:

import json

SYSTEM = "You are the ShopEase support assistant. Answer in 2-3 short sentences."

def build_request(user_text, model="claude-sonnet-5-5", max_tokens=300):
    return {
        "model": model,
        "max_tokens": max_tokens,
        "system": SYSTEM,
        "messages": [{"role": "user", "content": user_text}],
    }

print(json.dumps(build_request("Do you have cash on delivery?"), indent=2))

Output

{
  "model": "claude-sonnet-5-5",
  "max_tokens": 300,
  "system": "You are the ShopEase support assistant. Answer in 2-3 short sentences.",
  "messages": [
    {
      "role": "user",
      "content": "Do you have cash on delivery?"
    }
  ]
}