Skip to main content
Self-reflection enables agents to evaluate and improve their responses in async execution, bringing full feature parity with sync agents.
The user asks for copy; the agent drafts, self-reflects, and improves the answer before replying.

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.

Configuration Options

All reflection configuration options work identically in async agents:

Best Practices

Set reasonable min_reflect and max_reflect values to balance quality with performance. Async reflection still involves multiple LLM calls.
Provide specific evaluation criteria for better reflection quality. Generic criteria like β€œIs this good?” are less effective than specific requirements.
Reflection increases response time and token usage. Monitor these metrics in production async applications.
Wrap async reflection calls in try-catch blocks to handle potential timeout or API errors gracefully.

Async Agents

Complete guide to async agent execution

Self-Reflection Concepts

Core concepts and architecture