Prompt Engineering
The Prompt Panel provides tools for crafting effective system prompts and context configurations for your agents.
Overview
Prompts define agent behavior:
- System Prompt: Core instructions and personality
- Context Prompt: Dynamic context added at runtime
- Model Settings: Temperature, max tokens, etc.
System Prompt
The system prompt is the foundation of your agent's behavior:
const agent = await client.agents.update('agent-123', {
systemPrompt: `You are a helpful IT support agent for Acme Corp.
Your responsibilities:
- Answer common IT questions
- Guide users through troubleshooting
- Create support tickets when needed
Guidelines:
- Be professional and patient
- Ask clarifying questions
- Escalate complex issues to human support
Available tools: memory, http_request, create_ticket`
});
Context Prompt
Context prompts add dynamic information:
const agent = await client.agents.update('agent-123', {
contextPrompt: `Current user information:
- Name: {{user_name}}
- Department: {{user_department}}
- Role: {{user_role}}
Recent tickets: {{recent_tickets}}`
});
Model Settings
Configure the underlying model behavior:
const agent = await client.agents.update('agent-123', {
model: 'claude-3-5-sonnet-20241022',
temperature: 0.7,
maxTokens: 4096
});
Prompt Structure Best Practices
1. Clear Role Definition
You are [role] for [organization].
Your primary purpose is [purpose].
2. Explicit Instructions
Your responsibilities:
- [Task 1]
- [Task 2]
- [Task 3]
You should NOT:
- [Anti-pattern 1]
- [Anti-pattern 2]
3. Context Awareness
You have access to:
- User's conversation history
- Company knowledge base
- Ticketing system
Use this information to provide personalized support.
4. Escalation Rules
Escalate to human support when:
- User explicitly requests human
- Issue involves sensitive data
- Problem persists after 3 attempts
Protected Prompts
Mark prompts as protected to prevent modification by child agents:
await client.agents.update('agent-123', {
systemPromptProtected: true
});
Testing Prompts
Use the preview feature to test prompts:
- Open the Prompts tab
- Make changes to the prompt
- Click "Preview" to test
- Iterate based on results
Next: Learn about Schema Builder for configuration fields.