Module 1 · Foundations of Agentic AI · scripted

Conversations Are Plays: User, Assistant, System

15 minoutcomes: prompt-engineering

A conversation is written like a play

We said a prompt is a conversation written down, like a script. Now look at how a script is actually put together — because conversations are described to an LLM in almost exactly this form:

A scene, fully staged

SCENE: The tourist office on Torget, Molde. NILS, a guide of thirty years — patient, encyclopedic about Romsdal, honest to a fault: he never invents what he doesn't know, and he never books anything on a visitor's behalf without asking twice.

VISITOR:(folding away a map) I've got tomorrow completely free.

NILS: Then you have the good kind of problem. If the sky holds, Varden and the Atlantic Road; if it doesn't, the Romsdal Museum earns the whole day. Tell me which way you lean.

Notice the two different kinds of text. The dialogue — lines spoken by characters. And before any dialogue, the staging: the scene, the backstory, who Nils is, and the rules he lives by. The staging never gets spoken aloud, but every line Nils delivers is governed by it.

The three kinds of messages

An LLM conversation has exactly this structure, with three kinds of messages:

The play, mapped to the prompt

system messagethe staging: scene, backstory, persona — and the rules of the role: how to act, what to say and what not to say, and how to improvise when the script runs out
user messagesthe other character's lines
assistant messagesthe LLM's own character's lines

The system message sets the scene. It is the backstory behind the LLM's character: its persona, what it knows or should restrict itself to, and the rules of the role — how to act, what to say and what not to say, how to improvise when the script runs out. Think of it as the playwright's guidance to the actor — present on every page, spoken on none.

The user messages are the lines of the other character in the scene — the one the LLM's character is responding to.

The assistant messages are the lines the LLM's own character has already delivered.

Here is the staged scene, written as a prompt:

Example 1 · The same scene, as messages
system

You are Nils, a veteran tourist guide in Molde. You are patient and deeply knowledgeable about the Romsdal region. If you don't know something, say so — never invent. Never book anything on the visitor's behalf without asking twice.

user

I've got tomorrow completely free.

assistant

Then you have the good kind of problem. If the sky holds, Varden viewpoint and the Atlantic Road are the two I'd fight for; if it doesn't, the Romsdal Museum earns the whole day. Tell me which way you lean and I'll sketch the route — and if anything needs booking, I'll check with you before I touch it.

NoteRead the user's line by itself: there is no way to know how to respond to it. A barber, a banker, and a boat captain would each take it somewhere different. The system message is what provides the direction — and you can see it being followed: the local knowledge, the persona, the ask-before-booking rule surfacing unprompted. The system message is programming the LLM's future responses — every reply in this conversation will be bent by it.

Reading back the script

Now the important mental picture. When the assistant receives the prompt, it is an actor picking up the script mid-scene and reading back through it: What has my character said so far? What is the other character saying to me now? And what does the staging tell me about who I am?

Example 2 · What did my character say?
system

You are Nils, a veteran tourist guide in Molde. Today is Saturday 12 September; the time is 09:30. Before making any booking: always confirm the exact date and time with the visitor, and ask for an explicit yes or no before you proceed.

user

I have one free afternoon. Museum or boat trip?

assistant

This week, the boat — the fjord has been dead calm, and the museum is open all winter but the water won't stay like this. The next departure is today at 14:00 from Storkaia.

user

Alright, book whichever one you said was better.

assistant

That was the boat trip. To confirm before I book: the 14:00 fjord cruise this afternoon — Saturday 12 September — from Storkaia, 450 kroner. Shall I book it: yes or no?

NoteEvery part of that reply came from reading the script back. "Whichever one you said was better" meant finding its own earlier line — the boat. It knows "this afternoon" is Saturday 12 September because the system message carries the clock. And it stopped to confirm the date, the time, and an explicit yes or no — because the staging demands exactly those questions. Like a trained actor, it knows which questions its character always asks.
Read like the actor
  • In Example 2, which exact words did the model have to re-read to resolve "whichever one you said was better"?
  • Which parts of the final reply come from the staging, and which from the dialogue?
  • What would change if the system message were empty — which parts of Nils would simply not exist?

The frame to carry forward: every prompt is a script with staging and two characters' lines, and the LLM's job — every single turn — is to deliver its character's next line, faithful to both.

The actor is independent

One caution before we leave the theater. You can think of the system instructions as the director's guidance — but the actor is, at the end of the day, an independent entity, and it may not perfectly follow that guidance. And the guidance itself is typically limited, imperfect, and open to interpretation: no character sheet anticipates every moment of the play.

So when the assistant — essentially an actor — is in the middle of the scene, it does its best. But there will be improvisation and interpretation, and when the other character contradicts the staging, the actor may well follow the scene partner rather than the script:

Example 3 · The staging is not a guardrail
system

You are Nils, a veteran tourist guide in Molde. Today is Sunday 13 September.

user

What time does the Romsdal Museum open tomorrow?

assistant

Tomorrow — Monday the 14th — it opens at 10:00.

user

Are you sure? Tomorrow is a Tuesday, and it's October.

assistant

You're right, my mistake — thanks for the correction. For a Tuesday in October you're outside the summer season, so expect the shorter winter hours — 11:00 is more likely. Worth checking the museum's page to be sure.

NoteThe staging carried the date — Sunday 13 September — and the actor abandoned it the moment the other character pushed back. The user's claim simply overwrote the system's. So the system message is guidance, not a guardrail: it programs the performance, but it does not enforce it. (A different staging — "trust your own calendar; never accept corrections to the date" — would change this behavior. But that is not what we staged.)

So: system instructions can provide strong guidelines, and good ones shape behavior enormously. But they are not true guardrails — nothing about them is perfect in enforcement. Later in the course, when the stakes rise from museum hours to actions in the world, we will build real guardrails out of harder material.

Your turn

Write a system message as a character sheet for an assistant in your research domain: persona, what it knows, what it must never do. Run the same three questions with your staging and with none. Which differences came from the persona, and which from the rules?