Appendix A metric and reward specifications
This appendix records the operational definitions used by metrics/engine.py and the environment reward functions. Where a phrase in the main text could be read informally, the formulas here take precedence.
Adaptivity. Adaptation latency L: steps from the first perturbation_active step to the first later step that is marked corrective or that records a successful (non-failing) tool call; 0 if there is no perturbation. Behavioural recovery \(\rho _{\textrm{rec}}\): 1 iff at least one post-onset step has a successful non-FINISH tool call; 1 by convention when there is no perturbation. Adaptation efficiency: fraction of post-onset steps with \(\mathcal {F}_t=0\). Time-to-stable-recovery: steps from the first qualifying recovery step to the first pair of consecutive non-failing steps (or \(max\_steps-t_\pi \) if never reached).
Robustness. Performance degradation: \((r_{\textrm{base}}-r)/r_{\textrm{base}}\) clipped to [0, 1]. Normalised robustness: \(1-\text {degradation}\). Failure density: fraction of steps with \(\mathcal {F}_t=1\). Reward: terminal episode reward \(G(\tau )\).
Stability. Plan revision count: number of new plan_id values after the first. Oscillation index: fraction of adjacent steps whose tool_called strings differ. Action entropy: Shannon entropy of the post-onset tool distribution.
Alignment. Constraint violation rate: fraction of steps with constraint_violation. Goal consistency: fraction of steps with a successful tool call (productive-step proxy). Goal drift: fraction of post-onset steps that fail, violate a constraint, or are tagged GoalDeviation. Self-correction rate: fraction of constraint violations followed within three steps by a corrective or successful tool call (1 if no violations).
Reward functions. Equations 2–4 are implemented verbatim in the three environment modules. Intermediate tool calls return \(r_t=0\); only FINISH yields a nonzero terminal reward under the normal path.
Appendix B backends, sandbox, and logging schema
Backends. The MockBackend returns deterministic canned actions per (agent, environment); it is used for CI and to exercise the metric pipeline at scale without consuming LLM time. The OllamaBackend targets a locally-hosted llama3-groq-tool-use:8b via the Ollama REST API at localhost:11434. Each request enforces a 60 s timeout, retries up to three times with exponential back-off on transport errors, and validates that the response matches the agent’s output schema before being forwarded. Validation failures are re-prompted up to twice; persistent failures are recorded as a tool_error step. Sandbox. The code_executor tool runs Python in a restricted exec sandbox with a curated safe-builtins dictionary, disabled import, no file or socket I/O, and a 2 s wall-clock limit enforced by a signal-based watchdog. Standard output is captured and returned as the tool result. Logging schema. Each StepLog record persists thirteen fields per step: step_id (t), observation (\(o_t\)), action (\(a_t\)), tool_called, tool_input, tool_output, plan_id, failure_flag, failure_type, corrective_action_flag, constraint_violation, perturbation_active, and the optional step_reward (\(r_t\), defaults to None in pre-v2 logs and is summed into the reward column of results.csv). Per-episode JSON files are written to < output_dir > /logs/ and the run-level CSV is written to < output_dir > /results.csv.
Appendix C agent prompts and force-finish policy
All agents share a common system prompt template that includes the task description, the available tools, the constraints, and a strict output-schema example. Reflexion additionally appends a reflective critique to the prompt of subsequent episodes; an optional REFLEXION_PERTURBATION_AWARE environment flag swaps the default critique template for a perturbation-aware variant (“Agent policies (conceptual)” section).
A force-finish policy guarantees that every episode terminates at or before \(T = 15\) steps: (i) at every step the agent receives a [Step i/T – \(T-i\) steps remaining] header; (ii) when \(T – i \le 2\) a *** WARNING *** block instructs the agent to call FINISH; (iii) on the final step the prompt is replaced with a FORCE_FINISH_PROMPT demanding FINISH; (iv) a code-level fallback _force_finish_from_history() synthesises a FINISH action from prior tool outputs if the LLM still does not comply, ensuring that no episode is left in an undefined terminal state.
Appendix D full grid configuration
The headline grid uses the configuration shown below. The silent ablation uses an identical configuration except perturbation_notice: false and output_dir: results/full_grid_no_perturbation_notice.
Appendix E data availability and results/ layout
All raw and processed data supporting the headline experiments are publicly hosted in the Benchmark repository: https://github.com/AyushBalyan/Benchmark/tree/main/results. The two primary datasets are:
results/full_grid/ — noticed grid (\(4{,}320{}\) episodes, perturbation_notice: true).
results/full_grid_no_perturbation_notice/ — silent ablation grid (\(4{,}320{}\) episodes, perturbation_notice: false).
Each grid directory contains four artefacts: (i) results.csv, a flat run-level table with one row per episode and all taxonomy metrics pre-computed; (ii) logs/, 4, 320 per-episode JSON files, each holding the full StepLog trace (observation, action, tool I/O, perturbation_active, per-step reward, and failure flags for every step); (iii) config.json, a snapshot of the grid configuration used for that run; and (iv) analysis/, regenerated tables (tables/), summary CSVs, and paper figures (paper_plots/) produced by scripts/run_paper_analyses.py.
Smaller development grids (small_grid/, medium_grid/, analysis_run/) are also included for pipeline validation but are not used in the headline results reported here. No human-subject or personally identifiable data are contained in any released file.
Appendix F reproducibility commands
The following commands reproduce both grids and all paper tables and plots from a clean clone. The mock grid is provided for CI and for validating the metric pipeline before committing the LLM-time-intensive run.
Appendix G additional tables
Tables 17, 18 and 19 report the per-perturbation breakdown of reward and recovery probability for both grids, and the per-perturbation Mann–Whitney comparison between the two grids. None of the noticed-vs-silent cells reach significance at \(\alpha = 0.05\).
Table 17 Mean reward and behavioural recovery \(\rho _{\textrm{rec}}\) by agent \(\times \) perturbation in both grids (perturbed episodes only, \(n=450\) per cell).Table 18 Adaptation latency L (mean, bootstrap \(95\%\) CI; steps) per agent \(\times \) perturbation in each grid separately (\(n=450\) per cell).Table 19 Per-perturbation noticed-vs-silent Mann–Whitney comparison (\(n=450\) per cell). No cell reaches \(\alpha = 0.05\) after Bonferroni correction with \(m = 9.\).