Skip to main content
Reflection enables agents to critically evaluate their outputs and iteratively improve them before delivering the final response.

Quick Start

1

Enable Reflection

2

With Configuration


How Reflection Works

Streaming behaviour: Reflection regeneration always runs non-streaming, even when stream=True on the agent. The final answer still streams normally. This keeps AgentTeam and sync LLM adapters reliable during regeneration passes.

The Reflection Process


Configuration Options


Reflection Depth

Light Reflection

Standard Reflection

Thorough Reflection


Custom Reflection Prompts

Customize what the agent evaluates:

When to Use Reflection

✅ Use Reflection For

  • Content writing
  • Code generation
  • Technical documentation
  • Research summaries
  • Customer-facing content

❌ Skip Reflection For

  • Real-time chat
  • Simple lookups
  • Time-critical responses
  • Trivial questions

Reflection vs Planning


Best Practices

More iterations = better quality but slower. Use max_iterations=3 for most tasks, increase for critical content.
Generic reflection may miss domain-specific issues. Customize the prompt for your use case.
Use planning to break down the task, then reflection to ensure quality output.
Yes. Only the intermediate reflection passes are forced to non-streaming; the framework handles this for you and the final response still streams when stream=True.

Planning

Think before acting

Guardrails

Validate outputs