Quick Start
Level 2 — Config class (tune iterations and LLM)
Use
ReflectionConfig to control how many review passes run and which LLM critiques.How It Works
| Phase | What happens |
|---|---|
| 1. Draft | Agent generates initial response |
| 2. Evaluate | Reflection checks quality against criteria |
| 3. Improve | Agent rewrites based on self-critique |
| 4. Deliver | Final polished response returned to user |
Configuration Options
Full list of options, types, and defaults —
ReflectionConfig| Option | Type | Default | Description |
|---|---|---|---|
min_iterations | int | 1 | Minimum reflection passes (always runs at least once) |
max_iterations | int | 3 | Maximum reflection passes |
llm | str | None | None | LLM for reflection (defaults to agent’s LLM) |
prompt | str | None | None | Custom reflection evaluation prompt |
Common 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

