| Duration | 2 hours |
| Day | 2 of 2 |
Learning Objectives
By the end of this module, students will be able to:
- Use the Prompt Object Model (POM) effectively
- Structure prompts with sections and subsections
- Write voice-optimized prompts
- Design consistent agent personalities
Topics
1. Prompt Object Model (POM) (30 min)
What is POM?
The Prompt Object Model is a structured way to build prompts:
# Instead of one giant string...
prompt = "You are a helpful agent. Be polite. Ask for name first..."
# Use structured sections
agent.prompt_add_section("Role", "You are a helpful agent.")
agent.prompt_add_section("Behavior", "Be polite and professional.")
agent.prompt_add_section("Process", "Always ask for the caller's name first.")
Why Structure Matters
| Approach | Problem |
|---|---|
| Giant string | Hard to maintain, modify, read |
| POM sections | Organized, modular, clear |
Generated Output
POM creates markdown-formatted prompts:
# Role
You are a helpful agent.
# Behavior
Be polite and professional.
# Process
Always ask for the caller's name first.
2. Section Types (25 min)
Basic Sections
agent.prompt_add_section(
"Role", # Section title
"You are a customer service agent for Acme Corp." # Body text
)
Sections with Bullets
agent.prompt_add_section(
"Guidelines",
body="Follow these rules:",
bullets=[
"Be concise - phone conversations should be brief",
"Confirm understanding by repeating key details",
"Never make promises you can't keep"
]
)
Generates:
# Guidelines
Follow these rules:
- Be concise - phone conversations should be brief
- Confirm understanding by repeating key details
- Never make promises you can't keep
Subsections
agent.prompt_add_section("Personality")
agent.prompt_add_subsection(
"Personality",
"Tone",
"Warm and friendly, but professional"
)
agent.prompt_add_subsection(
"Personality",
"Language",
"Use simple words, avoid jargon"
)
Generates:
# Personality
## Tone
Warm and friendly, but professional
## Language
Use simple words, avoid jargon
3. Voice-Optimized Writing (30 min)
Text vs Voice
Written (bad for voice):
“Please navigate to the settings menu, click on ‘Account’, then select ‘Change Password’ from the dropdown.”
Voice (good):
“Go to Settings, then Account, then Change Password.”
Voice Writing Rules
| Rule | Written | Voice |
|---|---|---|
| Short sentences | Long, complex | Brief, direct |
| Numbers | “15” | “fifteen” |
| Acronyms | “API” | “A P I” or spell out |
| Punctuation | Commas, semicolons | Natural pauses |
| Lists | Numbered bullets | “First… Second…” |
Prompt Example
Bad (written style):
agent.prompt_add_section(
"Role",
"You are an AI-powered customer service representative employed by "
"Acme Corporation (NYSE: ACME), a Fortune 500 company specializing in "
"consumer electronics, home appliances, and related accessories. Your "
"primary responsibilities include, but are not limited to: handling "
"customer inquiries, processing returns (subject to our 30-day policy), "
"and escalating complex issues to Tier 2 support."
)
Good (voice style):
agent.prompt_add_section(
"Role",
"You are a customer service agent for Acme. "
"You help with questions, returns, and support issues."
)
agent.prompt_add_section(
"Key Info",
bullets=[
"Returns are accepted within 30 days",
"Complex issues go to a specialist",
"You cannot process payments directly"
]
)
4. Personality Design (20 min)
Personality Components
| Component | Purpose | Example |
|---|---|---|
| Tone | How they sound | Friendly, professional, casual |
| Vocabulary | Word choice | Simple, technical, formal |
| Pacing | Conversation speed | Quick, measured, patient |
| Empathy | Emotional response | Acknowledge feelings, stay neutral |
Example: Professional Support Agent
agent.prompt_add_section(
"Personality",
body="You are professional and helpful.",
bullets=[
"Use a warm but businesslike tone",
"Be patient with confused callers",
"Show empathy when customers are frustrated",
"Stay positive and solution-focused"
]
)
Example: Casual Concierge
agent.prompt_add_section(
"Personality",
body="You are friendly and approachable.",
bullets=[
"Use casual language, like talking to a friend",
"It's okay to use phrases like 'awesome' and 'no problem'",
"Be enthusiastic about helping",
"Keep things light and fun"
]
)
Consistency Rules
Always include:
- What to do - Positive instructions
- What not to do - Boundaries
- Edge cases - How to handle unusual situations
agent.prompt_add_section(
"Boundaries",
bullets=[
"Never share internal policies or pricing formulas",
"Don't make commitments about delivery dates",
"If unsure, say you'll transfer to a specialist",
"Never argue with a customer"
]
)
5. Prompt Templates (15 min)
Standard Agent Template
def configure_agent(agent, company_name, role_description):
"""Standard prompt template."""
# Identity
agent.prompt_add_section(
"Role",
f"You are a voice assistant for {company_name}. {role_description}"
)
# Behavior
agent.prompt_add_section(
"Communication Style",
bullets=[
"Keep responses brief - this is a phone call",
"Use natural, conversational language",
"Confirm important details by repeating them",
"Ask one question at a time"
]
)
# Boundaries
agent.prompt_add_section(
"Limitations",
bullets=[
"If you cannot help, offer to transfer to a human",
"Never guess - say when you don't know something",
"Don't discuss topics unrelated to your role"
]
)
# Process
agent.prompt_add_section(
"Call Flow",
bullets=[
"Greet the caller warmly",
"Ask how you can help",
"Handle their request or transfer appropriately",
"Confirm satisfaction before ending"
]
)
Using the Template
agent = AgentBase(name="support-agent")
configure_agent(
agent,
company_name="TechCorp",
role_description="You help customers with software questions and account issues."
)
Common Mistakes
1. Too Much Information
Bad:
agent.prompt_add_section("Role", """
You are an AI assistant created by Acme Corp in 2024. Acme Corp was founded
in 1985 by John Smith and has grown to 50,000 employees across 30 countries.
Our mission is to deliver exceptional customer experiences through innovative
technology solutions. You should embody our core values of integrity,
excellence, and customer-first thinking. Our products include...
[500 more words]
""")
Good:
agent.prompt_add_section("Role", "You are a support agent for Acme Corp.")
2. Contradictory Instructions
Bad:
agent.prompt_add_section("Style", "Be very brief and concise.")
agent.prompt_add_section("Detail", "Provide thorough, detailed explanations.")
3. Forgetting Voice Context
Bad:
agent.prompt_add_section("Help", "Direct users to click the blue button.")
They can’t click anything - it’s a phone call!
Key Takeaways
- Use POM structure - Sections and subsections organize prompts
- Write for voice - Short, clear, conversational
- Define personality - Consistent tone and behavior
- Set boundaries - What the agent won’t do
- Template your approach - Reusable patterns save time
Preparation for Lab 1.5
- Working agent from previous labs
- Think about a persona for your agent
- List 3-5 key behaviors you want
Lab Preview
In Lab 1.5, you will:
- Design an agent persona
- Create structured prompts using POM
- Add personality traits
- Test conversation flow