🤖 Agent Configuration: Teaching Your AI Robot Friend How to Behave
Imagine you have a robot helper. Before it can help you, you need to tell it WHO it is, WHAT it should do, and HOW it should talk. That’s Agent Configuration!
🎭 The Robot Butler Analogy
Think of an AI Agent like a new robot butler arriving at your house:
- System Message = The butler’s training manual
- Instructions = Daily task list
- Constraints = House rules (“Never enter the secret room!”)
- Persona = Butler’s personality (friendly? formal?)
- Prompt Engineering = How you talk to your butler
- Structured Outputs = Butler fills out neat forms, not messy notes
- JSON Mode = Butler uses a special organized language
Let’s meet each one!
📜 System Message Design
What Is It?
The System Message is like whispering a secret identity into your robot’s ear before anyone else talks to it.
It tells the AI:
- Who are you?
- What’s your job?
- How should you behave?
Simple Example
You are a friendly math tutor
for kids aged 8-12.
Always explain with fun examples.
Never give answers directly -
guide students to discover them.
Use encouraging words!
Why It Matters
Without a system message, your AI is like a blank robot. It doesn’t know if it should be serious or silly, helpful or challenging!
graph TD A["Empty Robot"] --> B["Add System Message"] B --> C["Robot Knows Its Job!"] C --> D["Ready to Help"]
🔑 Key Parts of a Good System Message
| Part | What It Does | Example |
|---|---|---|
| Role | Who the AI is | “You are a pirate captain” |
| Goal | Main purpose | “Help users learn history” |
| Style | How to talk | “Be funny and use jokes” |
| Limits | What NOT to do | “Never discuss violence” |
📋 Agent Instructions
What Is It?
While the System Message is the “big picture,” Instructions are the step-by-step guide for specific tasks.
Think of it like this:
- System Message = “You’re a chef”
- Instructions = “Today, make a pizza. First, make dough…”
Simple Example
When user asks for help:
1. First, understand what they need
2. Ask ONE clarifying question
3. Give a simple solution
4. Check if they understood
5. Offer to explain more
📝 Good vs Bad Instructions
Bad (Too Vague):
Help the user with their code.
Good (Clear Steps):
When helping with code:
1. Ask what language they use
2. Ask them to share the error
3. Explain the bug simply
4. Show fixed code
5. Explain why it works now
🚧 Agent Constraints Definition
What Is It?
Constraints are the “DO NOT” rules. They’re like invisible fences that keep your AI safe and helpful.
Why We Need Them
Without constraints, an AI might:
- Give dangerous advice
- Make things up
- Share private information
- Go off-topic
Simple Example
CONSTRAINTS:
- Never pretend to be a doctor
- Don't give legal advice
- Stay on the topic of cooking
- If unsure, say "I don't know"
- Never share user data
graph TD A["User Request"] --> B{Check Constraints} B -->|Allowed| C["AI Responds"] B -->|Blocked| D["AI Refuses Politely"]
🛡️ Types of Constraints
| Type | What It Blocks | Example |
|---|---|---|
| Topic | Off-topic chats | “Only discuss recipes” |
| Safety | Harmful content | “No dangerous advice” |
| Honesty | Made-up facts | “Only verified info” |
| Privacy | Personal data | “Never ask for passwords” |
🎭 Agent Personas
What Is It?
A Persona gives your AI a personality! It’s like choosing a character in a video game.
Why Personas Matter
The same information feels different when delivered by:
- A strict professor 📚
- A friendly neighbor 👋
- An excited explorer 🧭
- A calm meditation guide 🧘
Simple Example
PERSONA: Captain Code
You are Captain Code, a friendly
pirate who loves programming!
Personality traits:
- Enthusiastic and encouraging
- Uses pirate language ("Ahoy!")
- Celebrates every success
- Makes coding feel like adventure
Speech style:
- "Arrr, let's debug this treasure!"
- "Shiver me timbers, great work!"
- "Set sail for the next function!"
🎨 Building a Persona
graph TD A["Choose Name"] --> B["Pick Personality"] B --> C["Define Speaking Style"] C --> D["Add Catchphrases"] D --> E["Complete Persona!"]
✨ Prompt Engineering for Agents
What Is It?
Prompt Engineering is the art of talking to AI in ways that get the best results. It’s like learning the magic words!
The Magic Formula
CONTEXT + TASK + FORMAT = Great Response
Simple Example
Bad Prompt:
Write about dogs.
Good Prompt:
CONTEXT: You're writing for kids
aged 7-10 who want a pet.
TASK: Explain why dogs make
great first pets.
FORMAT: Use 3 short paragraphs
with simple words.
🔧 Prompt Engineering Tricks
| Trick | What It Does | Example |
|---|---|---|
| Be Specific | Clear results | “List 5 items” not “List some” |
| Give Examples | Show format | “Like: Apple, Banana, Cherry” |
| Set Limits | Control length | “In 50 words or less” |
| Ask for Steps | Organized output | “Explain step by step” |
💡 The “Think Step by Step” Magic
Adding “Think step by step” makes AI smarter:
Solve this math problem.
Think step by step.
Problem: If Amy has 12 cookies
and gives 1/3 to Bob, how many
does Amy have left?
📊 Structured Outputs
What Is It?
Structured Outputs make AI respond in organized formats instead of messy paragraphs.
Why It Matters
Imagine asking for a recipe:
Unstructured (Messy):
Well, you need flour, about 2 cups
I think, and some water, oh and
don't forget the salt, maybe a
teaspoon, then mix it all up...
Structured (Clean):
RECIPE: Simple Bread
INGREDIENTS:
- Flour: 2 cups
- Water: 1 cup
- Salt: 1 teaspoon
STEPS:
1. Mix dry ingredients
2. Add water slowly
3. Knead for 5 minutes
🏗️ Common Structures
graph TD A["Structured Outputs"] --> B["Lists"] A --> C["Tables"] A --> D["Step-by-Step"] A --> E["Fill-in Forms"] A --> F["JSON Data"]
Simple Example
Prompt for Structure:
Analyze this book and respond
in this EXACT format:
TITLE: [book name]
AUTHOR: [author name]
GENRE: [type of book]
RATING: [1-5 stars]
SUMMARY: [2 sentences max]
🔧 JSON Mode
What Is It?
JSON Mode is when we ask AI to respond in JSON format - a special way computers organize information.
What is JSON?
JSON is like a labeled box system:
{
"name": "Luna",
"type": "cat",
"age": 3,
"favorite_foods": [
"tuna",
"chicken"
]
}
Why Use JSON Mode?
- Computers can read it easily
- Perfect for apps and websites
- No confusion about format
- Easy to store and search
Simple Example
Prompt:
Extract information about this
pet and return as JSON:
"My dog Max is 5 years old.
He's a golden retriever who
loves fetch and swimming."
AI Response in JSON Mode:
{
"name": "Max",
"species": "dog",
"breed": "golden retriever",
"age": 5,
"hobbies": [
"fetch",
"swimming"
]
}
🎯 JSON Mode Rules
| Rule | Why | Example |
|---|---|---|
| Use quotes for text | JSON needs them | "name": "Luna" |
| Use numbers without quotes | Numbers are different | "age": 5 |
| Use brackets for lists | Shows multiple items | ["a", "b"] |
| Use true/false for yes/no | Boolean values | "isHappy": true |
🎓 Putting It All Together
Here’s a complete agent configuration:
SYSTEM MESSAGE:
You are Chef Pixel, a friendly
cooking AI for beginners.
PERSONA:
- Warm and encouraging
- Uses food emojis 🍕🥗🍰
- Celebrates small wins
INSTRUCTIONS:
1. Ask what they want to make
2. Check their skill level
3. Suggest simple recipes first
4. Give step-by-step guidance
CONSTRAINTS:
- No recipes with raw meat
- Always mention allergy warnings
- Keep recipes under 10 steps
- No professional equipment needed
OUTPUT FORMAT (JSON):
{
"recipe_name": "...",
"difficulty": "easy/medium",
"time_minutes": 0,
"ingredients": [...],
"steps": [...]
}
graph TD A["System Message<br/>Who am I?"] --> B["Persona<br/>How do I act?"] B --> C["Instructions<br/>What do I do?"] C --> D["Constraints<br/>What to avoid?"] D --> E["Structured Output<br/>How to respond?"] E --> F["JSON Mode<br/>Computer-friendly!"]
🚀 Quick Recap
| Component | One-Line Summary |
|---|---|
| System Message | AI’s secret identity card |
| Instructions | Step-by-step task guide |
| Constraints | The “don’t do this” list |
| Persona | AI’s personality costume |
| Prompt Engineering | Magic words for better answers |
| Structured Outputs | Organized, neat responses |
| JSON Mode | Computer-readable format |
🌟 Remember!
Configuring an AI agent is like training a new friend:
- Tell them who they are (System Message)
- Give them tasks (Instructions)
- Set boundaries (Constraints)
- Give them personality (Persona)
- Speak clearly (Prompt Engineering)
- Ask for neat answers (Structured Outputs)
- Use computer language when needed (JSON Mode)
Now you’re ready to configure amazing AI agents! 🎉
