Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 3 of 6 · Concept · 15 min · revision 3

From ReAct Prompts to Native Tool Calls and Reasoning Models

Follow the move from text-based ReAct prompts to provider-native tool calls, see how reasoning models plan across tool turns, and send the model's reasoning back unchanged with each tool result.

Contentsand lesson path

What you will learn

  • Explain how ReAct-style prompting relates to native tool calling and to reasoning models that interleave thinking with tool calls, and how a framework's agent abstraction maps onto the same loop.

Prerequisites: Tool Calling

01. The ReAct Paradigm: Interleaving Thought, Action, and Observation

In late 2022, researchers from Princeton University and Google Brain published ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al.). Before ReAct, a model was usually prompted in one of two ways. With Chain-of-Thought (CoT) prompting it wrote out its reasoning step by step but never looked anything up. Or it was asked to emit actions (tool calls) without writing down why.

Chain-of-Thought helps on arithmetic and logic puzzles, but the model cannot check its premises against the outside world. When the facts it needs are not in its training data, or have changed since, it can invent records or URLs and build the rest of its answer on them.

Actions without written reasoning have the opposite problem. On tasks that need several queries in a row, a model that only emits calls tends to work by trial and error: it breaks the goal into steps poorly, loses track of what earlier results said, and can call the same endpoint again and again.

ReAct combined the two. It prompts the model to alternate written reasoning and actions in a loop:

  • Thought: the model writes, in plain language, what it has learned so far and what it needs next (e.g. "Thought: The user wants to check account eligibility, but I first need the customer profile ID to query credit scores.").

  • Action: the model writes a line in a fixed format that names a tool and its arguments (e.g. "Action: get_customer_profile[email='[email protected]']").

  • Observation: the host program reads the action line, runs the tool and appends the result to the prompt as an observation (e.g. "Observation: {'id': 'cust_912', 'status': 'active'}").

Because the model writes a thought before every action, it can keep track of the goal, check its guesses against real tool results, and change course when a tool returns an error.

02. The Transition to Provider-Native Tool Calling Protocols

To fix the brittle text parsing of early ReAct prompts, model providers added native tool calling. OpenAI function calling came first, in mid-2023, followed by Anthropic, Google Gemini and Mistral.

Under native tool calling, models are trained to emit tool calls in a format the provider recognises, and the API parses each call for you. Instead of leaving a regex to guess where parameters begin and end in free text, the API returns each call in a dedicated response field: tool_calls in OpenAI Chat Completions, function_call items in the OpenAI Responses API, tool_use blocks in Anthropic's Messages API. This removes regex extraction, but it does not by itself make the arguments valid. Without a strict or structured-output mode the model can still emit malformed JSON, miss a required field or send a value of the wrong type. OpenAI's function calling and Anthropic's tool use both offer a strict mode (strict: true on the tool definition) that constrains generation to the schema, within a supported subset of JSON Schema.

Native tool calling does not replace the ReAct loop. Each provider puts the same steps (reason, act, observe, reason again) into its own API shape. What changes is reliability: the call arrives in a dedicated structured field instead of free text. Arguments still need checking. Turn on strict mode where the provider supports it, and validate arguments in your own code (for example with jsonschema or Pydantic) before executing a tool, because a schema-valid call can still carry a value your business rules forbid.

Furthermore, native calling supports parallel tool invocations within a single turn. While classic ReAct required multiple serial conversational cycles to query several endpoints, native APIs allow the model to emit a batch of tool requests simultaneously. The client application can execute these independent tools concurrently, so N independent lookups take roughly as long as the slowest one instead of the sum of all of them. How much that saves depends on how many calls are independent and how long each takes.

Python · protocols/react_vs_native.py Comparing ReAct text parsing with native tool handling
import re
from typing import Any, Dict, List, Optional, Tuple

# 1. Classic ReAct: Parsing raw regex from model completion text
def parse_classic_react(completion_text: str) -> Optional[Tuple[str, str]]:
    # The action must start a line, as the ReAct prompt asks
    pattern = r"^Action:\s*([a-zA-Z0-9_]+)\[(.*?)\]"
    match = re.search(pattern, completion_text, re.MULTILINE | re.DOTALL)
    if match:
        return match.group(1), match.group(2)  # Highly fragile regex
    return None

# 2. Native protocol: each call arrives in a structured field.
#    The arguments are still a JSON string to parse and validate.
def handle_native_tool_calls(assistant_message: Any) -> List[Dict[str, Any]]:
    # One entry per call: every call id needs its own tool result
    calls = getattr(assistant_message, "tool_calls", None) or []
    return [
        {
            "call_id": call.id,
            "tool_name": call.function.name,
            "raw_json_args": call.function.arguments,
        }
        for call in calls
    ]

03. Reasoning Models: Keeping the Thinking in the History

Reasoning models (for example OpenAI's GPT-6 models with a reasoning.effort setting, or Claude models with adaptive thinking) changed agent design again. In earlier chat models, intermediate reasoning was verbalized directly as visible assistant tokens or ReAct Thought: prefixes within the public message transcript.

Reasoning models are trained, largely with reinforcement learning, to produce internal reasoning tokens before they write user-facing text or a tool call. That reasoning lets the model compare strategies, plan several steps, anticipate edge cases and double-check arguments before it takes an action that cannot be undone.

For agent builders, reasoning models add a context rule: when you send a tool result back, also send back the reasoning that the provider returned with that tool call, unchanged. Anthropic's Messages API requires the thinking blocks of the assistant message that made the call to be passed back complete and unmodified. OpenAI's Responses API asks you to pass back the reasoning items returned with function calls, or to chain requests with previous_response_id, so the model can continue its reasoning after the call. If you drop them, the model loses the plan it made before the call: it may plan again, which costs tokens and can change its course.

Reasoning also changes the cost of a run. Reasoning tokens are billed as output tokens and add latency to every call that uses them. Providers expose an effort setting to control how much the model reasons (reasoning.effort in OpenAI's Responses API, output_config.effort on Claude). Spend high effort on high-stakes tool decisions, such as executing a payment, changing security groups or altering a database schema, and use low effort or a smaller model for simple lookups and data transformations.

04. Practice questions

Practice check · 3 questions

ReAct paradigm, native tool calls, and reasoning models check

Three scenario-based questions evaluating ReAct mechanics, native protocol upgrades, and reasoning model context preservation.

Q1. Under one Thought, the model writes two lines: `Action: get_order[id=812]` and then `Action: get_invoice[id=812]`. What does the lesson's `parse_classic_react` return?
Q2. An agent that uses `parse_classic_react` stops calling tools after a model upgrade. The new model writes its action as inline markdown code, with a backtick before `Action:` and another after the closing bracket. Why does the run break?
Q3. Where is a large reasoning budget most likely to pay for itself in an agent?
Practice only: not graded, not saved, not evidence.

05. Apply it

Try these in an agent you build:

  • Use the provider's structured tool-call fields instead of text-parsing ReAct prompts, so you no longer depend on regex extraction.
  • Let the model reason before tool calls (on reasoning models, through the provider's effort setting), so it can plan the action first.
  • When you return a tool result, pass back the thinking blocks or reasoning items that came with that tool call, unchanged.
  • Track reasoning tokens against tool-result tokens, to spot an agent that thinks for a long time about simple tasks.
  • Turn on strict mode where available, and still parse and validate every call's arguments before running the tool; return validation errors to the model as a tool result.

06. Review prompt

Explain how the ReAct paradigm combined Chain-of-Thought prompting with external tool execution. Contrast classic regex-based ReAct parsing with modern provider-native tool calling protocols, and describe why preserving internal reasoning states across turns is critical for reasoning models.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check