Quick Start
1
Level 1 — Bool (simplest)
Turn on self-review with a single flag.
2
Level 2 — Config class (tune iterations and LLM)
Use
ReflectionConfig to control how many review passes run and which LLM critiques.3
Level 3 — Config with a custom review prompt
Pass a domain-specific
prompt to steer what the self-review checks for.How It Works
Configuration Options
Full list of options, types, and defaults —
ReflectionConfigCommon Patterns
Pattern 1 — Quality-focused writing
Pattern 2 — Factual accuracy check
Best Practices
When to use reflection
When to use reflection
Enable reflection for writing tasks, technical explanations, and any output where quality matters more than speed. Skip it for simple lookups, calculations, or real-time applications.
Set max_iterations to control cost
Set max_iterations to control cost
Each reflection pass costs an additional LLM call. Set
max_iterations=1 for light review, 2 for thorough review, and only go to 3 for high-stakes content. The default is 3.Use a custom prompt for domain-specific review
Use a custom prompt for domain-specific review
Default reflection uses general quality criteria. Pass a
prompt tailored to your domain — e.g., “Check for HIPAA compliance language” for medical agents or “Verify all code is PEP 8 compliant” for coding agents.Related
Planning — plan before acting on complex requests
Self-Reflection Deep Dive — advanced reflection patterns

