Improving LLM Outputs with ReACT and ReWOO

In the evolving landscape of LLM prompt engineering, various strategies have emerged to help language models tackle complex, multi-step tasks. Among these approaches, two patterns stand out for their contrasting philosophies: ReACT (Reasoning and Acting) and ReWOO (Reasoning Without Observation).

A Tale of Two Paradigms

ReACT (Reasoning and Acting) embodies the "think-as-you-go" approach – an iterative dance between reasoning and action that mirrors how humans often work through complex problems.

ReWOO (Reasoning Without Observation) takes the opposite stance – a "plan-then-execute" methodology that separates the thinking phase from the action phase entirely.

Both are powerful prompting strategies with distinct requirements and outcomes. Understanding when to apply each can significantly impact your agent's performance, cost-efficiency, and reliability. But which approach is the best? The answer, as we'll discover, depends heavily on your specific use case, computational constraints, and performance requirements.

Understanding ReACT: The Adaptive Thinker

ReACT operates on a simple yet powerful principle: interleave reasoning with action. The pattern follows a cyclic flow:

  1. Think - Analyse the current situation and decide what to do next
  2. Act - Take an action (use a tool, make an API call, etc.)
  3. Observe - Process the results of the action
  4. Repeat - Continue until the task is complete

ReACT in Action: A Real Example

Let's say you ask an agent: "Find the current weather in Paris and recommend what to wear."

A ReACT agent might work like this:

Thought: I need to find the current weather in Paris first.
Action: search_weather("Paris, France")
Observation: Current weather is 15°C, light rain, humidity 78%

Thought: Now I know it's cool and rainy. I should recommend appropriate clothing.
Action: generate_clothing_recommendation(temperature=15, conditions="light rain")
Observation: Generated recommendation

Thought: I have all the information needed to provide a complete answer.
Action: format_final_response()

The Strengths of ReACT

The Challenges of ReACT

Understanding ReWOO: The Strategic Planner

ReWOO takes a radically different approach by completely separating the planning phase from execution. The pattern works in three distinct stages:

  1. Planner - Generate a complete execution plan with all necessary tool calls
  2. Worker - Execute the plan by making all the planned tool calls in parallel
  3. Solver - Synthesise all the results into a final answer

ReWOO in Action: The Same Example

For the Paris weather question, a ReWOO agent would approach it like this:

Planning Phase

Plan:
- Tool Call 1: search_weather("Paris, France") → #E1
- Tool Call 2: generate_clothing_recommendation(temperature=#E1.temperature, conditions=#E1.conditions) → #E2
- Final: Combine weather data from #E1 and recommendations from #E2

Execution Phase

Executing Tool Call 1: search_weather("Paris, France")
Executing Tool Call 2: generate_clothing_recommendation(temperature=15, conditions="light rain")

Synthesis Phase

Combining results to generate final response...

The Strengths of ReWOO

The Challenges of ReWOO

Architecture Considerations: Building for Your Needs

When deciding between ReACT and ReWOO, consider these architectural factors:

For ReACT-Favouring Scenarios

Choose ReACT when you have:

For ReWOO-Favouring Scenarios

Choose ReWOO when you have:

Hybrid Approaches: The Best of Both Worlds

The most sophisticated agent systems don't choose one pattern exclusively. Instead, they employ dynamic pattern selection based on task characteristics:

async def select_execution_pattern(
    task: Task,
    context: Context
) -> ExecutionPattern:
    complexity = analyse_task_complexity(task)
    uncertainty = assess_environment_uncertainty(context)
    resources = check_available_resources()

    if complexity.low and uncertainty.low:
        return ReWOOPattern()
    elif uncertainty.high or resources.limited:
        return ReACTPattern()
    else:
        return HybridPattern()  # Custom blend based on specific needs

Some systems even implement ReACT-in-ReWOO patterns, where the overall workflow is planned using ReWOO principles, but individual components use ReACT for adaptive execution.

Making the Choice: A Decision Framework

To help you choose the right pattern for your use case, ask yourself these key questions:

  1. How predictable are your workflows?

    • Predictable workflows: Choose ReWOO
    • Unpredictable workflows: Choose ReACT
  2. How critical is execution speed?

    • Very critical: Choose ReWOO
    • Less critical: Choose ReACT
  3. How robust are your tools?

    • Highly robust: Choose ReWOO
    • Error-prone: Choose ReACT
  4. What's your computational budget?

    • Limited budget: Choose ReWOO
    • Flexible budget: Choose ReACT
  5. How important is adaptability?

    • Very important: Choose ReACT
    • Less important: Choose ReWOO

Conclusion: Context is King

The ReACT vs ReWOO debate isn't about finding a universal winner – it's about understanding the trade-offs and choosing the right tool for the job. ReACT excels in dynamic, uncertain environments where adaptability trumps efficiency. ReWOO dominates in well-defined scenarios where performance and predictability are paramount.

The most successful AI agent implementations recognise that this isn't an either-or decision. By understanding the strengths and limitations of each pattern, and potentially implementing hybrid approaches, you can build agents that are both robust and efficient.

As you design your next AI agent, remember: the best architecture is the one that matches your specific requirements, constraints, and goals. Whether that's the adaptive flexibility of ReACT, the efficient planning of ReWOO, or a hybrid approach that combines the best of both worlds, the choice should be driven by your unique context rather than trending preferences.

The future of AI agents lies not in choosing sides, but in choosing wisely.

← Previous Article

Second Mesh Secures Innovate UK funding

Second Mesh has been awarded funding from Innovate UK to develop secure and trusted AI tools for high stakes and regulated sectors such as education.

Next Article →

The ART of getting AI Agents to pick the right tool

An exploration into the ART framework- Automatic Reasoning and Tool-use with embeddings.