We’ve moved to a new documentation platform for an improved experience. Explore ithere
Skip to main content
Version: 2.0.0

Reasoning Modes Guide

Purpose

This guide helps you understand how to interact effectively with agents operating under different reasoning modes ReAct, Reflection, and CodeAct. Each mode offers distinct strengths and is suited for specific types of queries.


1. ReAct Mode (Reasoning + Acting)

What is ReAct?

ReAct (Reason + Act) enables the agent to think step-by-step and take real-world actions using tools like Web Search, RAG (Retrieval-Augmented Generation), and File Attachments.

It decides which tool to use by analyzing the user's query and routes it to the appropriate tool dynamically, based on the task at hand.

What ReAct Can Do:

  • Think step-by-step to solve multi-part queries.
  • Route queries to the best-suited tool (e.g., WebSearch, RAG, Attachments).
  • Use tools to retrieve or process external information.

What ReAct Cannot Do:

  • Execute code or scripts.
  • Generate or manipulate downloadable files (e.g., Excel, PDFs).
  • Perform deep iterative revisions on its own outputs.

Correct Usage:

User: “What is the latest update on AI regulation in the EU?”
Agent (ReAct): Uses WebSearch and RAG tools to gather and summarize current information.

Incorrect Usage:

User: “Execute this Python script and return the result.”
Problem: ReAct does not support code execution. Use CodeAct instead.


2. Reflection Mode

What is Reflection?

Reflection enhances the agent’s intelligence by enabling it to evaluate its own answers, spot errors, and revise responses over multiple iterations.

It combines deep thinking with the ability to use tools (same as ReAct: WebSearch, RAG, Attachments), making it highly effective for tasks that need both external information and internal reasoning.

What Reflection Can Do:

  • Reflect on and revise previous answers.
  • Use external tools just like ReAct (e.g., search, documents).
  • Improve answer quality through self-assessment.
  • Provide more thoughtful and accurate responses.

What Reflection Cannot Do:

  • Execute or write live code.
  • Generate downloadable files like Excel, PDFs.
  • Perform real-time computations or data analysis.

Correct Usage:

User: “What are the key arguments in favor of renewable energy?”
Agent (Reflection): Provides a response, rethinks the logic, and returns a refined, structured answer.

Incorrect Usage:

User: “Create a plot of sales data from this Excel file.”
Problem: Reflection does not execute code or analyze structured data. Use CodeAct.


3. CodeAct Mode

What is CodeAct?

CodeAct allows the agent to generate, execute, and refine code to solve problems. It's ideal for tasks requiring logic, computation, data manipulation, or output generation.

CodeAct also supports:

  • Generating and downloading files (e.g., CSVs, Excel)
  • Plotting graphs
  • Analyzing uploaded structured data

What CodeAct Can Do:

  • Write and run Python code.
  • Analyze uploaded files like Excel, CSV.
  • Generate plots and charts.
  • Create downloadable data files.

What CodeAct Cannot Do:

  • Access the internet or search the web.
  • Use external tools like WebSearch or RAG.
  • Perform real-time information retrieval.

Correct Usage:

User: “Plot a line graph of temperatures from this CSV file.”
Agent (CodeAct): Analyzes the file, writes and runs code, returns the graph.

Incorrect Usage:

User: “Search GitHub for Langfuse examples.”
Problem: CodeAct can’t perform web searches. Use ReAct.


Summary

FeatureReActReflectionCodeAct
Step-by-step reasoningYesYesYes
Use of external toolsYes (Web, RAG, Attachments)Yes (same tools as ReAct)No
Self-reflection and revisionNoYesNo
Code execution & file creationNoNoYes
Data analysis & plottingNoNoYes

💡 Tip: Before you ask a question, check the active reasoning mode of the agent. Selecting the right mode ensures you get the most relevant and useful response.

  • Use ReAct for: live searches, reading from uploaded files, or when external tools are required.
  • Use Reflection for: complex logic problems that may require answer refinement.
  • Use CodeAct for: coding tasks, data analysis, graphing, and generating downloadable content.