Quick Start
1
Basic Async Reflection
Enable reflection in async agents with simple boolean flag:
2
Custom Reflection Criteria
Configure reflection with custom criteria for async agents:
How It Works
Self-reflection in async agents follows the same process as sync agents:Feature Parity
Prior to PR #1704, async agents had limited reflection support:Before PR #1704: Only legacy custom-LLM async branch supported reflection; the default OpenAI async path skipped it entirely.After PR #1704: Self-reflection works uniformly in both sync and async agents on all execution paths, including the default unified-dispatch path.
Parse-error parity (PR #4253): The async path always bounded parse-error retries at
max_reflect. The sync path did not β a reflection response that persistently failed to parse (a structured-output refusal, a content-filter block, or a truncation) looped forever. PR #4253 closes that gap: sync now terminates at max_reflect on parse errors, like async, and returns the un-reflected answer.This is termination parity, not call-count parity β the sync loop still issues one extra primary completion per reflection round, so sync and async do not cost the same under a persistent-refusal scenario.Configuration Options
All reflection configuration options work identically in async agents:Best Practices
Choose Appropriate Limits
Choose Appropriate Limits
Set reasonable
min_reflect and max_reflect values to balance quality with performance. Async reflection still involves multiple LLM calls.Custom Criteria
Custom Criteria
Provide specific evaluation criteria for better reflection quality. Generic criteria like βIs this good?β are less effective than specific requirements.
Monitor Performance
Monitor Performance
Reflection increases response time and token usage. Monitor these metrics in production async applications.
Error Handling
Error Handling
Wrap async reflection calls in try-catch blocks to handle potential timeout or API errors gracefully.
Related
Async Agents
Complete guide to async agent execution
Self-Reflection Concepts
Core concepts and architecture

