Skip to main content
Enable agents to evaluate their own responses and iteratively improve quality through self-reflection.

Quick Start

1

Simple Enable

Enable reflection with defaults:
2

With Configuration

Configure reflection behavior:

Configuration Options

max_iterations bounds parse-error retries too. If a reflection response persistently fails to parse (a structured-output refusal, a content-filter block, or a truncation), the agent stops after this many failed passes instead of looping. See the Reflection troubleshooting guide for the exact log line and next steps.

Common Patterns

Pattern 1: High-Quality Responses

Pattern 2: Different Model for Reflection


Best Practices

Balance quality with response time. 2-3 iterations is usually sufficient.
Customize the reflection prompt to evaluate domain-specific criteria.
More iterations and stronger models improve quality but increase cost and latency.

Self Reflection

Learn about self-reflection features

PlanningConfig

Configure planning mode