ReAct (Reasoning and Acting) prompting is a paradigm that enables AI models to solve complex tasks by combining natural language reasoning with external tool interactions. It mimics human problem-solving by creating a thought-action loop where the model reasons about the problem, takes actions to gather information, observes results, and iteratively refines its approach until reaching a solution.
ReAct operates through a continuous thought-action loop:
Thought: The model reasons about the current state and plans next actions
Action: The model executes tools or queries to gather information
Observation: The model processes the results from actions
Iteration: The cycle repeats with updated understanding until goal completion
This process requires careful prompt management, including maintaining conversation history and trimming excessive content to stay within context limits.
Here’s a simple ReAct example using Latitude’s built-in tools:
Copy
Ask AI
---provider: OpenAImodel: gpt-4otemperature: 0.1tools: - latitude/search - latitude/extract---# Research Assistant with ReActI will help you research {{ research_topic }} using a systematic thought-action approach.## Instructions:Follow this ReAct pattern:1. **Thought**: Reason about what information you need2. **Action**: Use tools to gather that information3. **Observation**: Analyze the results4. **Thought**: Plan your next step based on what you learned5. Repeat until you have comprehensive informationLet me start researching {{ research_topic }}:**Thought**: I need to understand the current state and recent developments in {{ research_topic }}. Let me start with a broad search to get an overview.**Action**: I'll search for recent information about {{ research_topic }}.
For more complex tasks, create structured ReAct workflows:
Copy
Ask AI
---provider: OpenAImodel: gpt-4otemperature: 0.2tools: - latitude/search - latitude/extract - latitude/code---<step># ReAct Problem Solving FrameworkI'm tasked with: {{ complex_task }}## Initial Assessment:**Thought**: Let me break down this complex task and identify what information and actions I need to complete it successfully.1. **Problem Analysis**: What are the key components of this task?2. **Information Requirements**: What data do I need to gather?3. **Tool Strategy**: Which tools will be most effective?4. **Success Criteria**: How will I know when the task is complete?Let me begin the ReAct process:</step><step># ReAct Execution CyclePrevious context: {{ initial_assessment }}## Thought-Action Loop:**Thought 1**: Based on my analysis, I need to start by {{ first_reasoning_step }}**Action 1**: [Execute first action using appropriate tools]**Observation 1**: [Process and analyze results]**Thought 2**: Given these results, my next step should be {{ next_reasoning_step }}**Action 2**: [Execute second action]**Observation 2**: [Analyze new information]Continue this pattern until task completion...</step><step># Synthesis and ConclusionPrevious ReAct cycles: {{ execution_cycles }}## Final Synthesis:**Thought**: Now I need to synthesize all the information I've gathered and provide a comprehensive response.**Final Analysis**: [Combine all observations and reasoning]**Conclusion**: [Present final results and recommendations]**Reflection**: [Evaluate the effectiveness of the ReAct process]</step>
---provider: OpenAImodel: gpt-4otemperature: 0.3tools: - latitude/search - latitude/extract - latitude/code---# Market Research AgentResearch market opportunity for: {{ product_concept }}## ReAct Research Process:**Thought**: To assess this market opportunity, I need to gather data on market size, competition, trends, and customer needs. Let me start systematically.**Action**: Search for market size and growth data for {{ product_concept }}[Tool will execute search]**Observation**: [Analyze market size data]**Thought**: Now I need competitive intelligence. Who are the key players and what gaps exist?**Action**: Search for competitors and competitive analysis in {{ market_segment }}[Continue ReAct cycle through:]- Market trends analysis- Customer pain points research- Regulatory considerations- Technology landscape assessment**Final Market Assessment**: [Synthesized conclusion]
---provider: OpenAImodel: gpt-4otemperature: 0.1tools: - latitude/search - latitude/code - latitude/extract---# Technical Debugging AssistantDebug and solve: {{ technical_problem }}## ReAct Debugging Process:**Thought**: I need to understand this technical issue systematically. Let me gather information about the error, check documentation, and test potential solutions.**Action**: Search for common causes and solutions for {{ error_type }}**Observation**: [Analyze search results for patterns]**Thought**: Based on these patterns, let me examine the specific technical details and run some diagnostic code.**Action**: Execute diagnostic code to analyze {{ system_component }}**Observation**: [Review diagnostic results]**Thought**: The diagnostics suggest {{ hypothesis }}. Let me verify this with additional research and testing.[Continue ReAct cycle through:]- Documentation research- Code analysis- Solution testing- Validation steps**Solution**: [Present debugged solution with reasoning]
---provider: OpenAImodel: gpt-4otemperature: 0.4tools: - latitude/search - latitude/extract---# Strategic Content CreatorCreate content strategy for: {{ content_topic }}## ReAct Content Development:**Thought**: To create effective content, I need to understand the audience, analyze successful content in this space, and identify unique angles.**Action**: Research trending content and successful approaches for {{ content_topic }}**Observation**: [Analyze content trends and engagement patterns]**Thought**: Now I need to understand the target audience better and identify content gaps.**Action**: Search for audience demographics and content preferences in {{ target_market }}**Observation**: [Review audience insights]**Thought**: With this audience data, let me identify unique angles and content opportunities.[Continue ReAct cycle through:]- Competitive content analysis- SEO and keyword research- Platform-specific optimization- Content format testing**Content Strategy**: [Present comprehensive strategy]
Implement error detection and correction in ReAct loops:
Copy
Ask AI
---provider: OpenAImodel: gpt-4otemperature: 0.3tools: - latitude/search - latitude/extract - latitude/code---# Self-Correcting ReAct System## Enhanced ReAct with Error Detection:**Thought**: [Standard reasoning]**Action**: [Tool execution]**Observation**: [Standard result analysis]**Validation Thought**: Let me check if this information seems accurate and complete**Validation Action**: Cross-reference with additional sources**Validation Observation**: [Quality assessment]**Correction Thought**: [If errors detected] I need to correct my approach because [reasoning]**Correction Action**: [Alternative approach]**Correction Observation**: [Verified results]**Meta-Thought**: Evaluate the effectiveness of my ReAct process and adjust if needed[Continue with improved approach]
Conclude: Synthesize insights into coherent solution
ReAct prompting transforms AI from passive responders to active problem-solvers, enabling complex task completion through iterative reasoning and tool-assisted action cycles.