Exercise: System Prompts¶
Objective¶
See how system prompts shape agent identity — the same user query produces completely different responses with different personas.
Concepts Covered¶
- System prompts for shaping agent behavior
- Independent message lists for different personas
- How the same model becomes different "agents" with different prompts
How It Works¶
The same user query ("visiting Portugal") is sent with two different system prompts — a formal travel advisor and a casual friend. Each gets an independent messages list with no shared context between them.
flowchart LR
Q["User Query:<br/>'visiting Portugal'"]
Q --> A["Formal Advisor<br/>system prompt"]
Q --> B["Casual Friend<br/>system prompt"]
A --> R1["Formal response"]
B --> R2["Casual response"]
Context sharing: None between the two calls — they are completely independent.
Interactive Message Flow¶
File¶
02_system_prompts.py— Same query, different personas via system prompts
How to Run¶
Expected Output¶
Structured logging showing the same query producing dramatically different responses based on the system prompt persona.