Prompt Engineering
BEST_PRACTICESTechniques to get the most reliable, accurate, and safe outputs from your agents.
Anatomy of a Good Prompt#
A System Prompt isn't just a persona. It's the "Operating System" for your agent. It should define constraints, output formats, and fallback behaviors.
Advanced Techniques#
Chain Of Thought (CoT)
Encourage the model to "think" before answering. This significantly improves reasoning on math and logic tasks.
Few Shot Prompting
Give examples of input/output pairs. This is the single most effective way to fix formatting errors.
Tool Specific Instructions
Give the model specific guidance on when and how to use each tool. Include parameter descriptions and usage examples.
Output Format Specification
Define exact output formats, especially for structured data. Use JSON Schema or clear formatting rules.
Error HAndling Instructions
Teach the model how to handle errors gracefully and when to ask for clarification.
SAFETY_&_GUARDRAILS_INTEGRATION#
Integrate safety instructions directly into your prompts to work with AKIOS guardrails.
PII Redaction Awareness
Content Safety Guidelines
Multi Step Reasoning Patterns#
For complex tasks, break down the reasoning process into clear steps.
Research Then Answer Pattern
Verification Pattern
Model Specific Optimizations#
GPT 4 / GPT 4 Turbo
- • Excellent at complex reasoning
- • Handles long contexts well
- • Good at following detailed instructions
- • Use for analytical and creative tasks
Claude / Claude Instant
- • Strong at safety and ethics
- • Good at following guardrails
- • Excellent at structured output
- • Use for safe, compliant applications
Gemini / Palm
- • Fast and cost-effective
- • Good at conversational tasks
- • Strong multimodal capabilities
- • Use for simple automation
LOCAL_MODELS_(LLAMA,_MISTRAL)
- • Privacy-focused (no API calls)
- • Customizable and fine-tunable
- • May need more specific prompts
- • Use for offline, secure applications
Handling Hallucinations#
THE_'I_DON'T_KNOW'_RULE
Add this to your System Prompt to reduce made-up facts: