Typed Retry Trajectories: Structuring Agent Context for Tool-Use Recovery
Abstract
Agents often need to recover from failed or uncertain actions, using information from earlier steps to decide their next action. However, these histories often combine task instructions, external results, errors, constraints, feedback, and earlier actions in a single text representation, leaving the model to infer the role and reliability of each part. We introduce typed retry trajectories, a structured representation that separates an agent’s decision context into four parts: instruction, data, requirement, and execution. The instruction part states the task goal. The data part contains observations, tool results, earlier actions, and other external information. The requirement part contains rules, limits, and verifier feedback. The execution part describes the next proposed action. We implement this schema in LLMON (Hind et al., 2026), a general-purpose markup language that allows the definition of arbitrary tags or concepts. We leverage a fine-tuned LLMON model pretrained on tags such as instr, data, and exec, and extend it by defining retry-specific tags (e.g., goal, stopping_criteria) and mapping them to LLMON’s existing tags. We evaluate typed action trajectories on the repair of failed tool-use cases from τ-bench (Yao et al., 2024). We compare the same model and the same trajectory information in three formats: typed, plain JSON, and prose logs. Typed formats improve F1 for predicting the next tool-call name by 0.088 (JSON) and 0.060 (prose logs). The structured format also improves tool selection and tool-argument accuracy. These results show that separating instructions, observations, rules, and actions can help agents recover from failed tool calls. More broadly, typed retry trajectories provide a practical way to distinguish trusted task instructions and constraints from external information that may be incomplete, incorrect, or unsafe. This distinction is not limited to tool-use recovery; it can also support other agent actions, including memory writes, record updates, message sending, and delegation to other agents.
Then back it, or bet against it.
Related papers
Open the market on this paper to see 7 more related papers.