|
| 1 | +# Roleplaying Personas with LLMs |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Experience Notation enables LLMs to participate in structured roleplaying by anchoring behaviour, traits, and emotional context within a formal model. This guide focuses on prompting LLMs to **act out roles inside journeys**, using complete `.expn` files that include both `Persona:` blocks and related `Event:` steps. |
| 6 | + |
| 7 | +Unlike basic persona prompts, this approach places characters inside a sequence of experiences — making their reactions, decisions, and expressions more grounded and meaningful. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Why Roleplay Inside `.expn`? |
| 12 | + |
| 13 | +* Adds believability and depth to user modelling |
| 14 | +* Supports simulations, usability walkthroughs, and agent testing |
| 15 | +* Anchors behaviour to concrete steps and UI interactions |
| 16 | +* Promotes consistency across multi-step flows |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Prompt Strategy: React Within a Step |
| 21 | + |
| 22 | +Ask the model to respond from the perspective of a persona *at a specific step* of a journey. |
| 23 | + |
| 24 | +### Example Prompt: Simulate Step Experience |
| 25 | + |
| 26 | +```plaintext |
| 27 | +Here is an Experience Notation journey: |
| 28 | +
|
| 29 | +Persona: Apprehensive Student |
| 30 | + Traits: { tech_savvy=false, age=17 } |
| 31 | + Experience: Nervous about using online platforms |
| 32 | +
|
| 33 | +Event: Course Onboarding |
| 34 | + Step: Start registration |
| 35 | + User: Apprehensive Student |
| 36 | + Action: Visits course portal |
| 37 | + UI-Element: Landing Page |
| 38 | +
|
| 39 | +Prompt: |
| 40 | +As the persona above, describe how they feel in the 'Start registration' step. |
| 41 | +``` |
| 42 | + |
| 43 | +### Sample Output |
| 44 | + |
| 45 | +```plaintext |
| 46 | +"I’m unsure where to begin. There’s a lot going on visually, and I worry I might click the wrong thing." |
| 47 | +``` |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Prompt Strategy: Roleplay Conversation from Journey |
| 52 | + |
| 53 | +Provide a `.expn` with at least two personas and a relevant `Event:` block. Then ask the model to simulate a realistic interaction based on the journey. |
| 54 | + |
| 55 | +### Example Prompt: Dialogue Simulation from Journey |
| 56 | + |
| 57 | +```plaintext |
| 58 | +Experience Notation: |
| 59 | +
|
| 60 | +Persona: Support Agent |
| 61 | + Traits: { empathy=high } |
| 62 | + Experience: Calm and professional |
| 63 | +
|
| 64 | +Persona: Confused User |
| 65 | + Traits: { tech_savvy=false } |
| 66 | + Experience: Lost in the navigation process |
| 67 | +
|
| 68 | +Event: Request Assistance |
| 69 | + Step: User opens help window |
| 70 | + User: Confused User |
| 71 | + Action: Clicks on the help button |
| 72 | + UI-Element: Header Navigation |
| 73 | +
|
| 74 | + Step: Agent engages |
| 75 | + User: Support Agent |
| 76 | + Action: Starts a live chat greeting |
| 77 | + UI-Element: Chat Window |
| 78 | +
|
| 79 | +Prompt: |
| 80 | +Write a realistic conversation between these two personas during the 'Request Assistance' event. |
| 81 | +``` |
| 82 | + |
| 83 | + |
| 84 | +### Sample Output |
| 85 | + |
| 86 | +```plaintext |
| 87 | +Chat Window – Live Support Conversation |
| 88 | +
|
| 89 | +Support Agent: |
| 90 | +Hello there! You’re through to course support. I’m here to help — what seems to be the trouble today? |
| 91 | +
|
| 92 | +Confused User: |
| 93 | +Hi, sorry… I’m trying to register for a course, but I can’t figure out where to go. The page has so many buttons and I’m not sure what I’m doing. |
| 94 | +
|
| 95 | +Support Agent: |
| 96 | +That’s absolutely fine — you’re not the only one who feels that way. I’ll guide you through it step by step. Could you tell me what you see on your screen right now? |
| 97 | +
|
| 98 | +Confused User: |
| 99 | +There’s a big banner at the top, and some menu links. I clicked something earlier and it took me to a different page, but now I can’t find where I was. |
| 100 | +
|
| 101 | +Support Agent: |
| 102 | +No worries — let’s get you back on track. Look at the top of the page; do you see a menu item that says “Courses” or “Register”? Confused User: Yes! There’s a “Courses” tab. |
| 103 | +
|
| 104 | +Support Agent: |
| 105 | +Perfect. Please hover your mouse over that and a drop-down menu should appear. You’ll want to click “New Student Registration”. |
| 106 | +
|
| 107 | +Confused User: |
| 108 | +Okay… I clicked it. Yes, now it says “Step 1: Create an Account”. |
| 109 | +
|
| 110 | +Support Agent: |
| 111 | +Brilliant — you’re in the right place. From here, just fill in your name and email, and let me know if anything is unclear along the way. I’m right here with you. |
| 112 | +
|
| 113 | +Confused User: |
| 114 | +Thank you… I really wasn’t sure what to do. This helps a lot. |
| 115 | +
|
| 116 | +Support Agent: |
| 117 | +You’re very welcome — take your time, and don’t hesitate to message me again if you get stuck. You’ve got this. |
| 118 | +
|
| 119 | +``` |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +## Tips for Effective Roleplay |
| 124 | + |
| 125 | +* Always pair `Persona:` with related `Event:` and `Step:` context |
| 126 | +* Use `Experience:` and `Metrics:` to influence tone and sentiment |
| 127 | +* Ask the model to focus on a single step or simulate transitions |
| 128 | +* Use `Adaptation:` to reflect behavioural evolution over time |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +Continue to [Generating Narrative From Journeys](narrative-generation.md) to explore how `.expn` models can be created directly through structured prompt engineering. |
0 commit comments