
Abstract
A tool-calling agent can select a function, supply arguments, read the result, and decide what to do next. ReAct interleaves reasoning in language with actions in the environment in a single trajectory. A valid JSON call can still fail because a tool is missing, an argument has the wrong type, an observation is stale, or a request times out, sometimes after an action has already taken effect. Drawing on the ReAct paper and official code, the Berkeley Function-Calling Leaderboard (BFCL), τ-bench, and ToolSandbox, we examine action protocols, the meaning of errors, and checks on the final state. A dependency-free script builds a laboratory tool environment to show why an apparently correct answer can accompany a failed task, and how idempotent retries, step limits, and final-state checks address that gap. The experiment reproduces no real model or public leaderboard scores.
Reproducing value and goals: from "smart function" to "can prove right"
The minimum tool agent is often written as a loop: hand over the user's goals and tool descriptions to the model, if the model returns to the tool call, it will be executed, and then the Observation will be put back into the context; if it returns to the natural language, it will end. This skeleton is easy to run, but hides three independent problems: whether the model has chosen the correct action; whether the actuator changes the world as expected; whether the final world state really meets the goal and has no additional side effects.
This recurrence does not pursue the most access The API is to establish an auditable contract: the structure and parameter verification are done first for each action; the error has a clear category and retrieval information; the call with side effects uses idempotent keys; the trajectory is bound by the number of steps and budget; There are four questions to answer in the experiment: what is formalized in ReAct; how the official code is connected to the action and observation; why the "timeout after submission" is a fake success; why the evaluation should be upgraded from a string matching to execution, status and milestones.
Core thought: Alternate reasoning is just a strategy, and the reliability of execution comes from the protocol
ReAct will move the environment to the space expand to , in It is a language thinking space. step of time The context is:
is environmental observation, It is a tool action that affects the environment, When only the plan, evidence or exception handling is written back to the context, and the environment is not directly changed. Single track length variable; a batch has When a task, the log is not a regular tensor, but Sequences of structured events of different lengths. The paper assumes that the strategy can correct the next step from Observation, but does not automatically guarantee that the execution of atomicity, ideology, or final state is correct.
Explicit state transitions are also required on the project:
is the tool backend state, is the executor, is a fault such as timeout, current limiting or returning damage, is a machine readable error. The key boundary is: receiving a timeout does not mean . The service may submit a write operation first, and then disconnect it during the response; if the agent is replaced with a new request, the same side effect occurs twice.

Paper and guide to the official implementation
Read ReAct Section 2 first. The paper regards thought as a language action that does not trigger environmental feedback, and hand over the action to the external environment; the knowledge question and answer experiment is used search[entity]、lookup[string]、finish[answer] Three actions, and alternately generate Thought, Action, and Observation on HotpotQA and FEVER. Paper report: External retrieval reduces some unfounded facts, but ReAct will also fall into repeated actions, and non-informative search will make subsequent reasoning difficult to recover. These are observations under specific models, hints and tasks in the original paper, not a guarantee of all tool frameworks.
Look at the data flow of the official repository. wikienv.py of step() Only accept the above action format: legal search triggers network request, lookup Continue to find sentences on the current page, finish End Episode, other outputs are unified into Invalid action; At the same time, the number of steps and search call time are accumulated. wrappers.py of HistoryWrapper Spend each step of Action/Observation back to history, and HotpotQA wrapper calculates EM/F1 from the environment answer. Notebook and README show that the official code is an early GPT-3 Prompting experiment, relying on the old interface, and only for HotpotQA and FEVER 500 A random development sample runs; read it should focus on the protocol boundaries, rather than treating old dependencies directly as a modern function call template.
Finally read the evaluation evolution. The BFCL single-round task distinguishes AST legality, the real execution result is not called when there is no suitable tool; v3 multi-round tasks add up to 20 steps of forced termination, and combine the back-end state from the necessary execution path to avoid only matching the unique trajectory. τ-bench is evaluated with the database target state after the dialogue is completed, and is tested by multiple tests. pass^k Discuss consistent reliability. ToolSandbox is further: constraining the intermediate milestone order with a directional acyclic graph, allowing multiple equivalent routes, only requiring key states, tool trajectories and final recovery to appear in the correct order. They all cue: ReAct is a generation policy, and the Verifier (verifier) defines "complete".
Minimum experiment: The answer is correct, why is the status still wrong?
run:
python3 code/minimal_tool_agent.py --check-only
Script fixed seed 60, full certainty, no access to the network. environmental exposure find_sample、run_assay、read_assay Three tools; the goal is to find the tag S-7, run only once assay, and return the value 7.4. run_assay The first time to be injected "timeout after commit": the backend has written an experimental record, but the caller only sees TIMEOUT_UNKNOWN_COMMIT.
In this CPU Smoke Test, the reliable controller uses the same idempotency_key Retry; the backend recognizes duplicate requests and returns the cache result. After 4 calls, the side effect count is still 1, and the answer and status are passed. The controller is changed to a new key and retryed. The same 4 calls and final answer are also 7.4, but 2 assay records are left; the answer is true, the status check is false, and the overall task_pass=false. The other two checks show that a parameter type error can be repaired after a structured feedback without any side effects; a tool that doesn't exist for a continuous call is forced to terminate in step 4. The short SHA-256 Digest in the output is bound to the complete track, which is convenient for comparison logs to be rewritten.
These numbers only prove the nature of the protocol in the script and do not represent ReAct, a language model, or BFCL/ToolSandbox scores. Toy Planner is a handwritten strategy, so there is no verification that the model can independently identify the error category; when it is actually connected to the model, at least the model version, prompts, tool schema, decoding parameters and execution environment image are also required to freeze.
Tool error classification: don't tuck all exceptions into a retry
The first layer is a planning error: select the wrong tool, omit the pre-steps, and guess the unfinished task into an answer. The second layer is a call error: the function name does not exist, the JSON cannot be resolved, the required parameters are missing, the type or enumeration is illegal; such errors should return a short and structured schema feedback, allowing a finite number of fixes. The third layer is an execution error: current limit, temporary network interruption, permission denied, resource does not exist; only the errors clearly marked Transient are suitable for automatic retry.
The fourth layer is the most dangerous, and the result is uncertain: the timeout occurs before or after the submission cannot be judged from the client. Actions with side effects must carry stable idempotent keys, and reuse them when retrying; if the tool does not support idempotent, you should first query the status or request manual confirmation. The fifth layer is the Observation error: the return is truncated, the version expires, and the field semantics change, and the model may continue to plan on the wrong evidence. The sixth layer is the verification error: only the final copy is checked, and the intermediate constraints of duplicate writes, overpower access, error sequence or unsatisfied are missed.
The author infers that the error recovery strategy should be determined by the tool contract, not the model freely. In addition to the parameter schema, each tool description should also give read-only/write properties, idempotency, retryable error codes, timeout semantics, permission boundaries, and verifiable states. The model is responsible for presenting the next action, the executor is responsible for refusing to cross the line, and the validator is responsible for judging the goal; the three cannot be combined into a prompt "please use the tool with caution".
Evaluation protocol: Layer 4 Scores and Replayable Logs
Level 1 Evaluation Call Validity: Tool selection, parameter name, type, required field, and rejection rate when it should not be called. The second layer evaluates the Execution Validity: whether the function is real and executable, and whether the return type satisfies the contract. The third layer evaluates Task Success: whether the final state matches the target, whether the necessary read-only tool path appears, and whether the orderly milestone is completed. Layer 4 evaluation Side Effects: repeated writes, irrelevant modifications, permission violations, and guardrail destruction; the answer is correct but the side effects are unqualified and must be judged to fail.
Repeat at least multiple seeds or sampling rounds for each task, and report a single success rate, full Reliability, mean and Confidence interval of successes; at the same time report invalid call rate, error recovery rate, average/max step, forced termination rate, tool calls, delay and token. The dynamic list and online API will change, and this article does not relate to the current ranking; before the real reappearance, the BFCL/ToolSandbox commit, data version and environment dependencies should be locked.
The log should hold the task ID, model and prompt version, original model output, parsed call, tool schema hash, idempotent key, start/end time, error code, whether it has been submitted, original observation, before and after status summary and Verifier results. Desensitization parameters to sensitive tools, but not just the final answer. During playback, confirm the trajectory DIGEST first, and then re-execute it in the isolated environment; otherwise the "same answer" may come from a different and unacceptable chain of action.
How to diagnose failures
If the agent loops, first check whether the most recent action and observation are completely repeated, and then check the stop condition, the completed sub-target and the maximum number of steps; blindly increasing the context will only take the loop further. If the parameters are frequently wrong, compare the Schema and executor versions that the model actually sees, and do unit tests for the enumeration, format and boundary values. If duplicate records appear after retry, whether the priority of idempotent keys is stable across retry, whether the server caches the key before submission, and whether the timeout is exposed to the commit status.
If the answer is correct but the task fails, compare final answer verifier and state verifier: the former may be too strict, and the latter may miss the read-only must pass path. BFCL v3 uses state checks to match the necessary paths, and the ToolSandbox uses the Milestone DAG, which is precisely to avoid the deviation of a single final state or a single path. If the online success rate fluctuates greatly, don't just report the average; check the most common first bifurcation point in the multiple rounds of the same task, and control the "tool random failure" and "model decision change" respectively.
Questions for further research
One is how to automatically generate error injection and state from tool specification Verifier does not rely on manual writing of each test; the second is how to estimate the causal contribution of a local error to the final success rate in a long trajectory. The third is to let the model see how many internal error details, which is enough to restore and do not disclose the sensitive backend; the fourth is whether the reversible action, transaction and compensation operation can become general Agent interface; fifth, how to optimize the success rate, worst side effects and call costs at the same time; six is whether the natural language thought really helps abnormal recovery, or whether the structured state summary and explicit plan diagram are more reliable. A feasible sub-question is: compare ReAct, pure function calls and search strategies with Verifier in the same Stateful Toy environment, invoke the budget and expose all the trajectories.
Summary
ReAct lets a model revise its plan between actions as new observations arrive. Reliable tool use also requires a clear execution contract. Valid JSON establishes that a message looks like a call, and correct final wording establishes only that the agent described the right outcome. Evidence of completion comes from argument validation, error classification, idempotent retries, a step budget, checks on state and milestones, and replayable logs. Reproducing a timeout after commit and a duplicated side effect with the script before connecting a real model turns an occasionally successful demo into an experiment whose failures can be diagnosed and compared.
References
Search date: 2026-09-01. The following are all pages of papers, author projects, official codes or research institutions; the results of the dynamic list are subject to manual verification.
- Shunyu Yao et al., 2023, ReAct: Synergizing Reasoning and Acting in Language Models(ICLR / arXiv v3)
- ReAct author team, Paper project page
- Shunyu Yao et al., ReAct official tips and experiment codes
- ReAct official code,
wikienv.pyaction environment andwrappers.pyTrack/Evaluation Package - UC Berkeley Gorilla team, Berkeley Function-Calling Leaderboard Method description
- UC Berkeley Gorilla team, BFCL V3:Multi-Turn & Multi-Step Function Calling
- UC Berkeley Gorilla team, BFCL official review code
- Shunyu Yao et al., 2024, τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains and official code
- Jiarui Lu et al., 2025, ToolSandbox(Apple Machine Learning Research) and official code
- Yangjun Ruan et al., 2024, Identifying the Risks of LM Agents with an LM-Emulated Sandbox(ToolEmu, ICLR)