**The Evolution from Parallel Tool Calls to ReAct Loops in AI Agents**
In a previous article, we explored the fundamentals of **tool calling** in AI models, where a model decides which functions to execute and with what arguments—without generating text alone. By the end, we had a system capable of deciding between `get_current_weather` and `convert_currency`, executing them in parallel, or skipping them entirely. This flexibility allowed answers to independent queries like “What’s the weather in Athens and how much is 100 USD in EUR?” to be handled concurrently, since each question was self-contained.
However, real-world problems often involve **dependencies** between steps. Consider this prompt:
> *“I bet my friend 100 EUR that it would rain in Athens today. If I won, how many USD is that?”*
Here, converting currency depends on whether it actually rained. This conditional logic cannot be resolved with parallel tool calls. Instead, it requires a **sequential decision-making process**, where the output of one tool informs whether—and which—another tool should be called. This is the power of the **ReAct loop**.
—
### What Is a ReAct Loop?
ReAct stands for **Reason + Act**, and it operates as a repeated three-step cycle:
1. **Reason** – The model reviews what it knows and identifies missing information.
2. **Act** – It calls a tool to retrieve that missing data.
3. **Observe** – The tool’s result is fed back into the model’s context.
Unlike single-turn tool calling, the conversation remains open. Each observation becomes new context for the next reasoning step, allowing the model to adjust its plan dynamically.
> Image source: contributor.insightmediagroup.io
Crucially, this doesn’t require new tools. The same `get_current_weather` and `convert_currency` functions from the earlier article can be reused—only the interaction pattern has changed.
—
### Why a Loop Is Necessary
In the bet example, the model cannot decide whether `convert_currency` is needed until it knows the weather outcome. Parallel tool calling would execute both actions regardless, wasting time and resources. A ReAct loop, however, evaluates after the first call:
– If **it rained**, proceed to currency conversion.
– If **it didn’t rain**, skip conversion and respond directly.
This early termination is only possible because the model reasons based on real-world observations.
—
### Implementing the ReAct Loop
We reuse the same API functions and tool schema as before, with one key addition to `get_current_weather`—it now returns `precipitation_mm`, which is essential for evaluating the bet.
“`python
tools = [
{
“type”: “function”,
“function”: {
“name”: “get_current_weather”,
“description”: “Get the current weather for a given city, including temperature and precipitation”,
“parameters”: {
“type”: “object”,
“properties”: {
“city”: {“type”: “string”},
“unit”: {“type”: “string”, “enum”: [“celsius”, “fahrenheit”]}
},
“required”: [“city”]
}
}
},
{
“type”: “function”,
“function”: {
“name”: “convert_currency”,
“description”: “Convert an amount from one currency to another”,
“parameters”: {
“type”: “object”,
“properties”: {
“amount”: {“type”: “number”},
“from_currency”: {“type”: “string”},
“to_currency”: {“type”: “string”}},
“required”: [“amount”, “from_currency”, “to_currency”]
}
}
}
]
available_functions = {
“get_current_weather”: get_current_weather,
“convert_currency”: convert_currency
}
“`
The loop itself works as follows:
“`python
messages = [
{“role”: “user”, “content”: “I bet my friend 100 EUR that it would rain in Athens today. If I won, how many USD is that?”}
]
max_iterations = 5
for i in range(max_iterations):
response = client.chat.completions.create(
model=”gpt-4o-mini”,
messages=messages,
tools=tools
)
message = response.choices[0].message
messages.append(message)
if not message.tool_calls:
print(“Final answer:”, message.content)
break
for tool_call in message.tool_calls:
func_name = tool_call.function.name
func_args = json.loads(tool_call.function.arguments)
result = available_functions[func_name](**func_args)
messages.append({
“role”: “tool”,
“tool_call_id”: tool_call.id,
“content”: json.dumps(result)
})
“`
A `max_iterations` cap prevents infinite loops—an important safeguard since models may sometimes request unnecessary follow-up information.
—
### Real Outcomes: Two Possible Paths
**Case 1: It Rains in Athens**
– The weather tool returns `precipitation_mm = 3.2`.
– The model reasons the bet is valid and calls `convert_currency`.
– Final answer confirms winnings: **108.50 USD**.
**Case 2: It Doesn’t Rain**
– The weather tool reports `precipitation_mm = 0.0`.
– The model immediately concludes the bet is lost and **skips the conversion step entirely**.
This early exit highlights a major advantage of ReAct over parallel execution: **no unnecessary API calls**.
—
### When ReAct Outperforms Parallel Calling
Parallel tool calling is ideal when all required actions are known upfront. ReAct becomes superior when:
1. **One result determines whether another call is needed** (e.g., conditional logic).
2. **Later arguments depend on earlier results** (e.g., dynamic parameter selection).
3. **Error handling or adaptation is required** (e.g., invalid input leads to a revised strategy).
That said, for straightforward, fully specified tasks, parallel calling remains faster and more efficient.
—
### Final Thoughts
Moving from parallel tool calls to a ReAct loop is a small change in code—a few lines of loop, condition, and dictionary lookup—but it unlocks **stateful, adaptive reasoning**. This pattern forms the foundation of most modern AI agents, enabling them to handle complex, multi-step tasks that depend on real-world feedback.
For scenarios involving dependencies, conditions, or dynamic planning, ReAct is not just an upgrade—it’s the right tool for the job.
—
*Thank you for reading! If you found this insightful, you might find **[pialgorithms](https://pialgorithms.io)** useful—a platform we’ve been building to help teams securely manage organizational knowledge in one place.*
*Loved this post? Connect with me on [Substack](https://substack.com) and [LinkedIn](https://linkedin.com/in/yourprofile).*
*All images by the author, unless otherwise noted.*
—
**Original article:** *The Evolution from Parallel Tool Calls to ReAct Loops in AI Agents*
Source: [https://contributor.insightmediagroup.io](https://contributor.insightmediagroup.io/wp-content/uploads/2026/07/image-5-1024×729.png)



