Reflexion-Guided Self-Correcting Tool Agents under API Selection and Execution Failures
DOI:
https://doi.org/10.66372/JGER.V2I1.2Keywords:
API-Bank, tool-augmented language models, function calling, Reflexion, self-correction, API selectionAbstract
Tool-using language agents fail through coupled errors: an incorrect API choice changes the available argument schema, while correct tool selection still fails when dialogue state, identifiers, temporal values, or required fields are bound incorrectly. This study evaluates a Reflexion-guided correction pipeline on a four-file API-Bank evaluation package containing 1,012 records, including 534 API-call targets from 261 dialogues. The first-pass agent ranks the provided API schemas with BM25 over the latest four dialogue events and binds arguments with deterministic local extraction rules. A benchmark feedback gateway rejects calls that are not execution-equivalent to the target and records a structured diagnosis. The repair agent then reconstructs the active trajectory segment, reselects the API with a state machine and global library ranking, and rebinds arguments using fold-local episodic profiles, value lexicons, and defaults. All memory objects were fitted in five GroupKFold splits grouped by dialogue, preventing any dialogue from contributing to its own repair memory. First-pass tool accuracy was 61.80%, strict call accuracy was 29.03%, and execution-normalized success was 36.52%. The gated correction pipeline reached 93.82% tool accuracy, 58.61% strict call accuracy, and 70.41% execution-normalized success. It repaired 181 of 339 initial failures and preserved all 195 initially successful calls, producing a 33.90-point paired gain (95% bootstrap confidence interval: 29.96–38.01; exact McNemar p=6.53×10⁻⁵⁵). Level-3 trajectories gained 44.44 points, and controlled failure injection yielded repair success from 67.04% for wrong tools to 100% for observed stale-state errors. The results show that trajectory state and argument reflection provide complementary gains and that value grounding remains the dominant residual failure.

