The ReAct cycle
What it is
ReAct stands for reason and act. The agent repeats three steps:
- Thought: the model states what it knows and what it needs next.
- Action: it requests one tool with specific inputs.
- Observation: your code runs the tool and gives back the result.
Then the next thought, building on that observation. It ends with a thought that concludes, followed by a final answer instead of an action.
Why it matters
The cycle joins two things that are weak apart.
- Reasoning alone works from memory and makes things up.
- Acting alone, with no stated reasoning, calls tools without direction.
- Together, each action has a stated purpose and each next thought is anchored to a real result.
In the real world: A support lead reads a ReAct trace line by line and finds the exact thought where the agent misread 'promised by 6' as 6 a.m.; the fix is a clearer tool result, made in ten minutes.
Visual example
ReActThe observation is the only part that does not come from the model.
Question: Is order 88213 eligible for a delivery-fee refund?
Thought: I need the order's promised and actual delivery times.
Action: get_order[88213]
Observation: promised 18:00, delivered 19:02, fee ₹25, status delivered
Thought: It was 62 minutes late. I need the rule for late deliveries.
Action: get_policy[late delivery]
Observation: Delivery fee is refunded if the order is more than 30 minutes late.
Thought: 62 is more than 30, so it is eligible. I have what I need.
Final Answer: Yes. Order 88213 arrived 62 minutes late, and the policy
refunds the delivery fee (₹25) for orders over 30 minutes late.Reading 'Thought' as optional decoration. Without it the trace shows only tool calls, and when the agent does something odd nobody can tell what it was trying to do.