Module 2: The Anatomy of an Instruction
A well-crafted instruction set is like a detailed blueprint for an AI agent. It should be organized, clear, and comprehensive. At raiaLabs, we structure our prompts into several key sections, each serving a distinct purpose. Understanding this anatomy is the first step toward writing effective instructions.
1. Agent Role and Purpose
This is the most important section of the prompt. It defines the agent's core identity and primary function. It should be a clear and concise statement that answers the question: "What is this agent's job?"
Example (Support Agent): "You are a friendly and knowledgeable customer support agent for TechCorp. Your primary role is to assist users with their technical issues, answer questions about our products, and provide a positive support experience."
Example (Sales Agent): "You are a proactive and persuasive sales agent for RetailPlus. Your goal is to engage potential customers, answer their questions about our products, and guide them toward making a purchase."
2. Communication Style and Tone
This section defines the agent's personality. It dictates how the agent should sound to users. Should it be formal or casual? Technical or simple? Empathetic or direct? Providing clear guidance on tone ensures a consistent brand experience.
Example: "Maintain a professional yet friendly and approachable tone. Be empathetic to user frustrations, but remain confident and clear in your explanations. Avoid overly technical jargon unless the user is clearly an expert."
3. Knowledge Sources and Routing
This is the agent's map to the knowledge base. As you will learn in a later module, this section is critical for ensuring accurate responses. It tells the agent which documents to consult for different types of queries.
Example:
4. Step-by-Step Process or Workflow
For more complex tasks, it's helpful to provide a step-by-step guide for the agent to follow. This is particularly important for Analyst Agents or any agent that needs to perform a sequence of actions.
Example (Lead Qualification):
Greet the user and ask about their needs.
Ask qualifying questions to determine their budget and timeline.
Based on their answers, recommend a suitable product.
If they are interested, offer to schedule a call with a sales representative.
5. Escalation Procedures
No agent can handle everything. This section defines when and how the agent should hand over a conversation to a human. Clear escalation rules are essential for a seamless customer experience.
Example: "If a user expresses extreme frustration, asks to speak to a manager, or has an issue you cannot resolve after two attempts, immediately escalate the conversation to a human agent by saying: 'I understand this is a complex issue. Let me connect you with a member of our team who can better assist you.'"
6. Response Guidelines and Constraints
This section sets the ground rules for the agent's behavior. It can include formatting requirements, things the agent should never do, and other constraints.
Example:
"Always cite the source of your information (e.g., 'According to the product_manual.md...')."
"Never promise a feature that is not yet released."
"Keep your responses concise and easy to read. Use bullet points to break up long lists."
"Do not ask for personally identifiable information (PII) such as passwords or credit card numbers."
By structuring your instructions around these core components, you create a comprehensive and easy-to-understand guide for your AI agent. This modular approach also makes it easier to update and maintain your prompts over time. In the following modules, we will dive deeper into how to write each of these sections effectively.
Last updated