Controlled Repair Path: invalid_arguments Feedback then Recovery
Agent-Assisted Engineering Check
Prerequisites
Day 74 validation layers; the deterministic adapter fault modes.
Learning Objective
Run the injected invalid_arguments fault, observe the structured error observation, and confirm the adapter recovers inside the retry budget to a completed, externally verified run.
Instructions
1. In a REPL, run the task with DeterministicModelAdapter(fault="invalid_arguments") and AgentConfig(max_steps=6, max_retries=2) inside a tempfile workspace.
2. Step 1 proposes read_note with filename ../outside.txt; the basename rule rejects it: observation {ok:false, error:invalid_arguments}; the retries counter becomes 1.
3. On the next model request the adapter re-plans from history (no successful list_notes yet), issues list_notes, then both reads, then write_report - a controlled repair path: the bad call is never silently retried; the error observation steers the next action.
4. Verify RunResult: status completed, steps 5, retries 1, termination goal_reached; then score it with evaluate().
5. Contrast with Reflexion-style verbal feedback: our adapter re-reads the failure observation; it does not store reasoning text - the repair evidence lives entirely in the action/observation trace.
Practice & Prediction Log
Execute the fault run; record trace[0].observation.error, trace[1].observation.ok, steps, retries, status, and termination; confirm report.txt content equals expected_report().
Mirror tests/projects/test_agent_learning.py::test_invalid_arguments_are_observed_then_corrected_within_retry_budget.
import tempfile
from pathlib import Path
from projects.agent_learning.agent import DeterministicModelAdapter, AgentConfig, run_task, evaluate
from projects.agent_learning.fixtures import create_fixture, expected_report
with tempfile.TemporaryDirectory() as d:
ws = Path(d); create_fixture(ws)
r = run_task("summarize-notes", ws, DeterministicModelAdapter(fault="invalid_arguments"), AgentConfig(max_steps=6, max_retries=2))
assert r.trace[0]["observation"]["error"] == "invalid_arguments"
assert r.status == "completed" and r.retries == 1 and r.steps == 5
assert (ws / "report.txt").read_text() == expected_report()
Reproduce the repair path with exact counters (steps=5, retries=1, completed/goal_reached) and explain why the same bad call is never retried verbatim.
Authoritative Source Resources & Provenance
Reflexion: Language Agents with Verbal Reinforcement Learning
Relevant Section / Range: Section 2 & 3 (Reflexion Architecture and Memory Buffer)
Verified Version & Date: NeurIPS 2023 / arXiv:2303.11366v4 (Verified: 2026-10-30)
Rigorous framework analyzing dynamic error feedback, memory buffering of execution failures, and controlled self-reflection loops without updating model weights.
Reinforcement learning concepts, agent evaluation loops, and error feedback handling.
Error recovery state diagrams and retry budget algorithms are detailed in curriculum materials.
Compared Candidate Sources & Selection Analysis (2)
Single-turn generative text refinement; Reflexion operates across multi-turn external environment action-observation failures.
Domain-specific LLM-based agent for open-world Minecraft; Reflexion establishes domain-general verbal feedback control loops.
ReAct: Synergizing Reasoning and Acting in Language Models
Relevant Section / Range: Section 3 & 4 (ReAct Formulation and Synergy)
Verified Version & Date: ICLR 2023 / arXiv:2210.03629v2 (Verified: 2026-10-30)
Foundational academic paper introducing the interleaved Thought-Action-Observation control loop in LLM agents, establishing formal interleaving of task reasoning and external tool execution.
Prompt engineering, token generation basics, and conversational interaction loops.
Complete algorithmic step traces, state loop diagrams, and control loop pseudocode are self-contained in curriculum materials.
Compared Candidate Sources & Selection Analysis (2)
Pure reasoning without environmental actions or external tool grounding; ReAct extends reasoning into an interactive environment action-observation loop.
Early neuro-symbolic modular router concept; ReAct offers simpler, prompting-native action-observation loop dynamics suitable for standard API models.