Function Calling vs ReAct Agents: Choosing an Agent Pattern
Function calling vs ReAct agents: function calling returns structured JSON tool calls, while ReAct loops through Thought, Action and Observation. Which fits?
By Galactic News Editorial · Published 2026-11-23T05:02:25+00:00 · Updated 2026-11-23T05:02:25+00:00
Function Calling vs ReAct Agents: Choosing an Agent Pattern
Function calling and ReAct are the two main patterns for giving a language model tools. Function calling returns structured tool calls defined by a JSON schema. ReAct interleaves free-text reasoning with tool calls in a Thought, Action, Observation loop. Function calling is the safer default for production. ReAct still wins for open-ended reasoning. Most real agents combine both.
The choice matters because it shapes reliability. A tool call that arrives as typed JSON can be validated, logged, and executed with confidence. A tool call parsed out of free text with a regular expression can break on a stray word. That difference decides which pattern fits your app.
How function calling works
Function calling, also called tool calling, lets a model interface with external systems through functions you define. Each function has a name, a description, and a JSON schema for its arguments. The model decides when to call a function and fills in the parameters. Your code executes the function and returns the result. The model then reasons over the result and answers.
OpenAI's documentation describes the flow in five steps. First, make a request to the model with the tools it could call. Second, receive a tool call from the model. Third, execute code on the application side with the input from the tool call. Fourth, make a second request to the model with the tool output. Fifth, receive a final response, or more tool calls. The loop continues for as many calls as the task requires.
Two details matter. First, the model never executes the tool. It requests execution. Your runtime validates the call, runs it, and returns the result. That separation is a feature, not a limitation. It enables security checks, sandboxing, retry logic, timeouts, and audit trails. Second, functions count against the model's context limit and are billed as input tokens, so large tool sets cost context. OpenAI supports tool search for deferring rarely used tools, but only on GPT-5.4 and later models.
Strict mode strengthens the pattern. Setting strict to true in the function definition turns on Structured Outputs, which guarantees the arguments match the JSON schema you provided. Without it, the structure is not guaranteed, and a validation library such as Pydantic should check arguments before use.
How ReAct agents work
ReAct, short for Reason and Act, was published in October 2022 by Shunyu Yao and colleagues from Princeton and Google, and presented at ICLR 2023. It combined two lines of work that had existed separately: chain-of-thought prompting, which improves answers by writing out intermediate reasoning, and acting, which grounds the model in the world through tools.
The pattern is a loop with three steps. Thought: the model writes free-text reasoning about what is known, what is missing, and what to do next. Action: the model calls an external tool in a fixed textual format. Observation: the tool's result is inserted into the trace by the surrounding program, not written by the model. The loop repeats until the model reaches an answer.
The paper evaluated the pattern on question answering, interactive decision-making in ALFWorld, and WebShop. The findings have held up: grounding reasoning in retrieved facts reduced the hallucinated-fact chains seen with chain-of-thought alone, and reasoning traces helped the model decompose goals and handle unexpected observations, with only a handful of in-context examples.
In LangChain, ReAct was implemented as prompt engineering plus output parsing. The ZERO_SHOT_REACT_DESCRIPTION agent type relies on the model writing Thought, Action, and Action Input lines, which LangChain parses with regular expressions, executes, and feeds back. That parsing is the pattern's weak point. It is brittle, hard to validate or audit, easy to hallucinate around, and difficult to scale reliably.
Function calling vs ReAct agents: the comparison
| Attribute | Function calling | ReAct |
|---|---|---|
| Tool call format | Structured JSON via API, typed tool-call blocks | Free text parsed with regex |
| Reasoning | Implicit, inside the model | Explicit Thought, Action, Observation trace |
| Reliability | High; schema-validated arguments | Medium; parsing can fail on odd output |
| Steps per task | Few | Many |
| Works with open models | Needs a model trained for tool use | Yes; works with plain text models |
| Production safety | High; validated, auditable calls | Medium; harder to audit |
| Best for | API integrations, predictable execution | Flexible multi-step reasoning |
The table hides one nuance. Modern tool calling absorbed the ReAct idea rather than replacing it. The model still reasons, then acts, then reasons over the result. The difference is where the protocol lives. In text ReAct, the protocol lived in the prompt and in string handling. In native tool calling, the protocol lives in the API. OpenAI introduced function calling in June 2023. Anthropic made tool use generally available in 2024. Today, tool calling is a standard capability of frontier and most open-weight chat models, including when served locally through runtimes such as vLLM or Ollama.
When to choose each pattern
Choose function calling when reliability matters more than flexibility. That covers most production work: calling APIs, fetching live data, running deterministic computations, and enterprise automation with guardrails. The structured format means your runtime can validate every call before it runs. With strict mode, arguments are guaranteed to match the schema.
Choose ReAct when the task needs open-ended reasoning and the model has no native tool support. It works with plain text models, including open-weight models served locally. It also suits research-style tasks where the next step depends on what the last observation revealed, and where an explicit reasoning trace helps debugging.
A hybrid is common in practice. The agent uses function calling for the tool work and adds an explicit reasoning step before each call. The reasoning is written as ordinary model output, not as a parsed action format, so the tool calls stay structured while the thinking stays visible. This keeps the reliability of function calling and the transparency of ReAct. It costs extra tokens for the reasoning text, so reserve it for tasks where the reasoning itself needs review.
LangChain supports both. Its OpenAI Tools agent binds tools to the model and uses native tool calling. Its ReAct agent uses prompt-driven parsing for models without function calling. The framework's own guidance is simple: if you need reliable tool calls, prefer the OpenAI Tools agent. If you need multi-step reasoning with conditional branching, use ReAct or LangGraph.
Three practical rules apply to either pattern:
- Keep execution outside the model. The model decides intent. Your code validates and executes. Never let the model touch a database, an API, or a payment directly.
- Cap the loop. ReAct agents can loop unnecessarily. Set a maximum step count and a timeout, and fail cleanly when the cap is hit.
- Log every call. Record the tool name, the arguments, and the result. Without that log, a bad agent action is impossible to trace.
Bottom line
Function calling vs ReAct agents is not a close contest for most production work. Function calling wins on reliability, validation, and auditability, and it is the default in every major provider's API. ReAct wins on flexibility and on models without native tool support, and its reasoning trace remains useful for debugging complex tasks. Start with function calling. Add an explicit reasoning step when the task needs it. The best agents use structured calls for the work and visible reasoning for the thinking, and keep execution firmly in your code either way.