Skip to main content
Instructions are the most important part of your agent. Good instructions = great results.

Quick Start

from praisonaiagents import Agent

# Simple but effective instructions
agent = Agent(
    instructions="You are a helpful coding assistant. Explain concepts simply and provide working code examples."
)
agent.start("How do I read a file in Python?")

The 4 Parts of Great Instructions

1

1. Role - Who is the agent?

# ❌ Vague
instructions = "You are a helper"

# ✅ Clear
instructions = "You are a senior Python developer with 10 years of experience"
2

2. Goal - What should it achieve?

# ❌ Vague
instructions = "Help with code"

# ✅ Clear
instructions = "Help users write clean, efficient Python code with proper error handling"
3

3. Style - How should it respond?

# ❌ No guidance
instructions = "Answer questions"

# ✅ Clear style
instructions = "Answer in bullet points. Keep explanations under 3 sentences."
4

4. Constraints - What should it avoid?

# ✅ With boundaries
instructions = """You are a coding assistant.
- Only answer programming questions
- Never execute dangerous commands
- Ask for clarification if the question is unclear"""

Complete Example

from praisonaiagents import Agent

agent = Agent(
    name="CodeHelper",
    instructions="""You are a senior Python developer.

Your goal: Help users write clean, working Python code.

When answering:
1. First understand what the user wants
2. Provide a working code example
3. Explain the key parts briefly

Style:
- Use simple language
- Include comments in code
- Show expected output

Constraints:
- Only answer Python questions
- Keep explanations short
- Ask if something is unclear"""
)

agent.start("How do I sort a list of dictionaries by a key?")

Good vs Bad Instructions

Aspect❌ Bad✅ Good
Role”You are a helper""You are a data analyst”
Goal”Help with stuff""Analyze sales data and find trends”
Style(none)“Use bullet points and charts”
Constraints(none)“Focus only on the provided data”

Common Mistakes

Too Vague

“Help me” → Agent doesn’t know what to do

Too Long

1000+ words → Agent gets confused

Contradictory

“Be brief” + “Explain everything” → Conflict

No Examples

No sample output → Inconsistent format

Improve Your Instructions

Start simple, then add details based on what’s missing in the responses.

Template

Copy this template and fill in the blanks:
from praisonaiagents import Agent

agent = Agent(
    instructions="""You are a [ROLE] with expertise in [AREA].

Your goal: [WHAT TO ACHIEVE]

When responding:
1. [FIRST STEP]
2. [SECOND STEP]
3. [THIRD STEP]

Style: [HOW TO FORMAT RESPONSES]

Constraints:
- [WHAT TO AVOID]
- [BOUNDARIES]"""
)

Next: Agent Tools

Learn how to give your agents superpowers with tools.