Source-linked AI summary

Understanding Software Engineering Agents: A Study of Thought-Action-Result Trajectories

Islem Bouzenia, Michael Pradel

arXiv:2506.18824v2cs.SEcs.AI

TL;DR

Software engineering agents’ decision-making remains opaque despite their growing use, and no established methodology systematically studies their trajectories. This paper unifies logs from three agents into 120 trajectories and analyzes structural properties, actions, token usage, and reasoning coherence. It identifies behavioral motifs and anti-patterns distinguishing successful from failed executions, yielding insights for prompting, diagnosis, supervision, and evaluation.

  • Problem

    The decision-making processes of software engineering agents remain largely opaque, and no established methodology systematically studies their thought-action-result trajectories.

  • Method

    The study unifies logs from RepairAgent, AutoCodeRover, and OpenHands and combines statistical analysis, action-sequence mining, and open coding of reasoning coherence.

  • Results

    The study identifies behavioral patterns and anti-patterns that distinguish successful from failed agent executions, including balanced validation versus repetitive or premature-fix behavior.

  • Takeaways & Limitations

    The findings inform prompting strategies, trajectory supervision, evaluation metrics, and automatic failure detection or mitigation.

  • Takeaways & Limitations

    The study covers three bug-fixing agents and may not generalize to other agents, software engineering tasks, or real-world deployment scenarios.

Abstract

from arXiv · show

Large Language Model (LLM)-based agents are increasingly employed to automate complex software engineering tasks, such as program repair and issue resolution. These agents operate by autonomously generating natural language thoughts, invoking external tools, and iteratively refining their solutions. Despite their widespread adoption, the internal decision-making processes of these agents remain largely unexplored, limiting our understanding of their operational dynamics and failure modes. In this paper, we present a large-scale empirical study of the thought-action-result trajectories of three state-of-the-art LLM-based agents: RepairAgent, AutoCodeRover, and OpenHands. We unify their interaction logs into a common format, capturing 120 trajectories and 2,822 LLM interactions focused on program repair and issue resolution. Our study combines quantitative analyses of structural properties, action patterns, and token usage with qualitative assessments of reasoning coherence and feedback integration. We identify key trajectory characteristics, such as iteration counts and token consumption, recurring action sequences, and the semantic coherence of thoughts, actions, and their results. Our findings reveal behavioral motifs and anti-patterns that distinguish successful from failed executions, providing actionable insights for improving agent design, including prompting strategies, failure diagnosis, and anti-pattern detection. We release our dataset and annotation framework to support further research on transparent and robust autonomous software engineering agents.

I. INTRODUCTION

This paper studies how software engineering agents reason and act through thought-action-result trajectories, addressing the opacity of their decision-making. Across three repair and issue-solving agents, it identifies trajectory patterns, coherence issues, and differences between successful and failed executions.

  • Motivation: LLM agents increasingly automate software engineering tasks by iteratively reasoning, invoking tools, and adapting to tool outputs.Applications include code completion, program repair, test generation, oracle generation, and fuzz testing.
  • Research gap: The agents’ underlying decision-making remains largely opaque, motivating analysis of how they reach solutions and why they succeed or fail.Trajectory insights may reveal tool-use practices, reasoning pitfalls, and best practices for improving reliability.
  • Scope and questions: The study examines 120 trajectories from RepairAgent, AutoCodeRover, and OpenHands across automated program repair and issue resolution.It addresses trajectory properties, action sequences, and the coherence of thoughts, actions, and feedback.
  • Findings: Failing trajectories for RepairAgent and OpenHands are longer and more token-intensive, whereas AutoCodeRover uses a streamlined retrieve-locate-fix workflow.These patterns are reported as reflecting task complexity and differing agent workflows.
  • Findings: Successful trajectories balance exploration, explanation, fix generation, and testing, while failures show repetitive cycles and untested fixes.The study also reports that semantic misalignment between thoughts and actions correlates with failure or increased computational cost.
  • Findings: Agents exhibit distinct reasoning dynamics: flexible state-machine agents revisit states, test-driven agents emphasize verification, and streamlined agents prioritize concise retrieve-and-fix workflows.The paper identifies matching architectures to tasks as an open research direction.

II. METHODOLOGY

The methodology collects trajectories from three state-of-the-art software engineering agents and analyzes them in a unified framework. It samples 120 complete repair or issue-resolution trajectories, totaling 2,822 iterations.

  • Analysis pipeline: The methodology parses raw agent logs into a unified trajectory representation before computing trajectory statistics and analyzing actions and sequences.Figure 1 presents an overview of this methodology.
  • Data collection: The study collects logs from RepairAgent, AutoCodeRover, and OpenHands for empirical trajectory analysis.The agents target program repair or issue resolution and were evaluated on Defects4J or SWE-bench Lite.
  • Data collection: 40 trajectories per agent are sampled, with approximately 10 successful trajectories per agent selected proportionally to an average success rate of about 27%.The sampling is designed to provide a diverse yet manageable dataset for detailed manual annotation.
  • Dataset: The resulting dataset contains 120 complete bug-repair or issue-resolution trajectories and 2,822 iterations across all agents.Each trajectory captures iterative interactions between an agent and its environment.

B. Trajectory Parsing and Representation

The paper represents each agent trajectory as an ordered sequence of thought-action-result triples and derives metrics for trajectory length, cost, and task success. Parsing procedures adapt heterogeneous agent logs into this common format.

  • Trajectory representation: An agent trajectory is a sequence of iterations, each containing a thought, an external action, and the resulting feedback.Thoughts describe reasoning, actions invoke operations, and results include compiler output, test results, traces, or errors.
  • Trajectory parsing: Agent-specific parsers convert structured JSON or semi-structured logs into separated thoughts, actions, and results.AutoCodeRover logs are mapped heuristically by detecting tool calls, preceding reasoning, and returned results.
  • Trajectory metrics: Trajectory length is defined as the number of iterations in a trajectory and may reflect task complexity, agent effort, or reasoning verbosity.RepairAgent caps trajectories at 40 iterations, while OpenHands allows up to 100.
  • Trajectory metrics: Trajectory cost is the total number of tokens consumed across thoughts, actions, and iteration inputs, including integrated action results.The metric matters because LLM queries are typically charged by processed tokens.
  • Trajectory metrics: Trajectory success is a binary label based on whether the agent produces a valid task solution under the original benchmark evaluation.SWE-bench success requires a test-passing patch, while RepairAgent additionally requires semantic agreement with the developer patch.

D. Categorizing Actions

The study maps diverse agent operations into eight high-level action categories reflecting common debugging activities. Actions are labeled through tool mapping and manual review, with a small residual set left uncategorized.

  • Agents’ diverse operations are grouped into eight high-level categories reflecting common debugging and fixing activities.The categories are Explore, Locate, Search, Reproduce, Generate fix, Run tests, Refactor, and Explain.
  • Explore gathers context, Locate identifies relevant code, and Search finds code elements or patterns.
  • Reproduce creates tests for the issue, Generate fix proposes code changes, and Run tests validates fixes or test cases.
  • Researchers map known tools automatically, then manually inspect and collaboratively resolve ambiguous remaining actions.A small subset of actions, 8.3%, does not fit the defined categories.

E. Mining Sequential Action Patterns

The study mines fixed-length action n-grams and labels semantic relationships within and across trajectory iterations. Its annotation scope emphasizes immediate connections among thoughts, actions, and results.

  • Action sequences are represented as category labels and mined for frequent fixed-length n-grams to identify recurrent decision-making patterns.The study uses n ∈ {4, 5, 6} to balance nontrivial sequences with diversity and interpretability.
  • Open coding identifies five relationship types linking thoughts, actions, and results within or across consecutive iterations.The relationships include thought-to-action, thought-to-thought, action-to-action, result-to-thought, and result-to-action.
  • Thought-to-action alignment measures whether an action faithfully implements the immediately preceding thought.
  • Thought-to-thought relations capture reasoning continuity or divergence across iterations, while action-to-action relations identify repetition without new effect.
  • Result-to-thought and result-to-action relations assess whether environmental feedback is correctly incorporated into subsequent reasoning or operations.
  • The analysis labels 40 trajectories per agent and focuses on immediate relationships because longer dependencies are harder to interpret systematically.The annotation covers 14K pairs of trajectory components across the three agents.

III. RESULTS

Trajectory length and token consumption vary substantially across agents and outcomes. Test-driven agents show longer, more token-intensive failing runs, whereas AutoCodeRover uses shorter workflows with failure variability linked to internal errors.

  • Trajectory Length: 34 iterations for RepairAgent and 29 for OpenHands contrast with 6 on average for AutoCodeRover.
  • Trajectory Length: 40 iterations for unsuccessful RepairAgent trajectories versus 22 for successful ones, while OpenHands failures can reach the 100-iteration cap.
  • Token Consumption: 23K mean tokens for AutoCodeRover, 220K for RepairAgent, and about 1.2M for OpenHands show large differences in cumulative consumption.OpenHands uses approximately 52 times more tokens than AutoCodeRover.
  • Token Consumption: RepairAgent failures consume more tokens, OpenHands successes use more input tokens, and AutoCodeRover failures modestly increase usage through parsing errors.
  • Interpretation: Iteration count and total token consumption provide complementary metrics for assessing task complexity and agent behavioral dynamics.

B. RQ2: Actions and Patterns of Actions Sequences

Agent actions evolve differently across task progress, and successful trajectories combine exploration, explanation, fix generation, and validation. Failed trajectories instead show repetitive or insufficiently adaptive cycles that motivate anti-pattern checks.

  • Action Categories: Generate Fix, Run tests, Search, and Explore are the most frequent actions, accounting for 23%, 19%, 15%, and 14%, respectively.
  • Agent Workflows: RepairAgent balances exploration, search, fix generation, and testing; OpenHands emphasizes test-driven reproduction; AutoCodeRover follows search–locate–fix.
  • Action Usage Over Task Progress: RepairAgent shifts from a balanced start to 70% Fix Generation and Running Tests, while OpenHands reaches 75% Reproduce, Fix Generation, and Running Tests late.
  • Action Usage Over Task Progress: AutoCodeRover spends its first half on Search, Locate, and Explain before transitioning to 30% Locate and 20% Generate Fix.Its sharp distribution changes reflect short trajectories with median N = 5.
  • Sequence Patterns: Successful 4-grams balance exploration, explanation, fix generation, and testing, whereas unsuccessful trajectories repeat non-adaptive action cycles.
  • Debugging Anti-Patterns: Recurring anti-patterns include repeated actions without follow-up, repeated fix generation without testing, and termination without proper test validation.The study recommends checks for these trajectory smells in robust agent design.

C. RQ3: Semantic Relationships

The study models semantic relationships among thoughts, actions, and results to identify coherent reasoning, divergence, repetition, and responsiveness patterns associated with agent trajectories. These analyses expose failure-related anti-patterns and motivate validation, diversification, and result-sensitive design.

  • Thought-Action Relationships: Thought-action misalignment is rare but closely associated with failing trajectories across the studied agents.OpenHands reports 0.5% misalignment in successful versus 1.4% in failing trajectories, while AutoCodeRover reports 0% versus 4.8%.
  • Thought-Action Relationships: A single thought-action misalignment can extend execution substantially, as RepairAgent continued from iteration 6 to iteration 38 after suggesting an empty fix.The example motivates explicit validation through self-reflection, critique frameworks, or reasoning models.
  • Thought-Thought Relationships: Contradicting and redundant thoughts create confusion and resource waste, while divergence can either mislead agents or enable exploration away from unproductive loops.OpenHands’s Django-10924 trajectory shifted from repetitive code reading to issue reproduction, testing, and fixing at iteration 7.
  • Consecutive Action Pairs: Follow-up relationships dominate consecutive actions, but divergence is often beneficial in successful trajectories whereas repetition is several times higher in failing trajectories.Sequence analysis such as sliding-window matching or n-gram frequency analysis can detect repetition for subsequent diversification.
  • Result Driven Reasoning and Actions: Successful runs more often use results to trigger relevant next actions, whereas no-influence actions occur at 1.2% vs. 6.2% for RepairAgent and 4.9% vs. 14.6% for AutoCodeRover.The comparison is reported for successful versus failing trajectories and supports improving result sensitivity in both reasoning and action selection.

IV. LIMITATIONS AND THREATS TO VALIDITY

The study’s validity is constrained by annotation subjectivity, limited agent and task coverage, sampled trajectories, and analyses that identify associations without establishing causality.

  • Annotation and Classification: Annotation and classification may be subjective despite partial inter-annotator agreement checks.This limitation affects the study’s interpretation of categorized trajectory behavior.
  • Scope and Generalizability: The three evaluated bug-fixing agents do not fully represent all software development tasks or real-world deployment scenarios.The authors specifically note that generalization to other agents or tasks such as code generation or testing remains open.
  • Sampling: Sampled trajectories may miss the full variability of agent behavior, including rare but important patterns.The authors suggest scaling up the dataset and using automated pattern detection in future studies.
  • Causal Interpretation: Correlation and sequence-mining analyses reveal trends and associations without establishing causality between behaviors and task success.The reported relationships should therefore not be interpreted as causal effects.

V. RELATED WORK

The paper builds on work in neural software engineering, LLM agents, AI interpretability, and automatic agent improvement. Rather than proposing another agent, it systematically analyzes existing agents to inform their design.

  • Deep Learning and LLMs in Software Engineering: Earlier neural software-engineering methods address code completion, program repair, issue solving, test generation, test-oracle generation, and fuzz testing.These methods differ from the agentic approaches studied here.
  • LLM Agents: LLM agents autonomously solve complex software-engineering tasks by reasoning and interacting with external tools.The related work includes bug fixing, test reproduction, project setup, notebook debugging, and failure root-cause analysis.
  • AI Interpretability and Explainability: Interpretability research explains model predictions through methods such as relevant-node identification, counterfactual reasoning, and trajectory visualization.The paper focuses instead on reasoning and decision-making processes across multiple software-engineering agents.
  • AI Interpretability and Explainability: The authors position their work as the first systematic study of reasoning and decision-making processes across multiple LLM-based software-engineering agents.This distinguishes the study from prior visualization and debugger-like interfaces.
  • Automatically Improving LLM Agents: Automatic agent-improvement research uses reinforcement learning, trajectory-based fine-tuning, or additional agents that provide feedback.This paper contributes analysis of existing agents rather than a new agent.

VI. CONCLUSION

The study systematically analyzes decision-making, reasoning consistency, and trajectory dynamics in autonomous software-engineering agents. Its findings distinguish successful and unsuccessful behaviors and guide future improvements in efficiency, reliability, and reasoning.

  • Conclusion: Statistical analysis, semantic relation modeling, open coding, and sequence pattern mining identify behavioral trends across LLM-based autonomous agents.The study focuses on decision-making, reasoning consistency, and trajectory dynamics.
  • Conclusion: Successful trajectories balance information gathering, hypothesis testing, and fix validation, whereas unsuccessful ones show redundant exploration or premature fixes.These patterns summarize the paper’s central distinction between successful and unsuccessful executions.
  • Conclusion: Action categorization and sequence analysis reveal agent strengths and weaknesses that guide improvements in efficiency, reliability, and reasoning.The conclusion identifies these as practical implications of the analysis.
  • Conclusion: Future work could expand agent and benchmark coverage, refine classification methods, and develop automatic failure detection and mitigation techniques.These directions follow the study’s stated scope and methodological limitations.
Loading 2506.18824v2…