ReAct pattern

Reasoning + Acting — a prompting strategy where the agent interleaves reasoning (Thought) and action (Act) steps, making its decision process transparent.

Syntax

ai-agents
Thought: [reason about situation]
Action: [tool to call]
Observation: [tool result]
...repeat...

Example

ai-agents
// ReAct prompt format:
"Thought: I need to find the current price of BTC.
Action: web_search({ query: 'bitcoin price today' })
Observation: Bitcoin is currently $67,420
Thought: I now have the answer.
Final Answer: The current Bitcoin price is $67,420 USD."