Manuscript Offprint

arXiv:2609.06063

Explaining AI Agents Through Execution Traces

Vittoria Vineis, Fabiano Veglianti, Lorenzo Antonelli, Claudia Di Carlo, Matteo Silvestri, Gabriele Tolomei

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

AI Agents are increasingly deployed in real-world settings, where they interact with external tools and make sequential decisions with limited human oversight. This creates a pressing need for reliable and auditable explanations of what an agent did and why. However, traditional Explainable AI (XAI) methods fall short of providing the process-level transparency required for such interactive, multi-step systems, motivating a paradigm shift toward approaches specifically designed for AI Agents. To address this gap, we present a post-hoc XAI framework that transforms a lengthy agent's execution trace into a structured report and a faithful natural-language explanation explicitly grounded in its observable behavior. Because it relies solely on execution traces, the framework applies across different agent architectures, environments, and tasks. Human and automated evaluations across multiple benchmarks and architectures show that our framework produces high-quality, trace-faithful explanations while reliably identifying unsupported claims, unjustified actions, and evidence gaps, outperforming naive LLM-generated explanations.

1 Introduction

Recent advances in Agentic AI are reshaping the capabilities of AI systems by enabling autonomous goal pursuit, adaptive decision-making, and complex task execution with minimal human oversight (Acharya, Kuppan, and Divya 2025). Unlike traditional AI models, AI Agents¹ interact with external tools, maintain internal state, coordinate multiple actions, and adapt their behavior over extended execution horizons. While these capabilities unlock significant opportunities across critical domains, they also introduce new challenges for transparency, accountability, and governance (Zhu et al. 2026; Shah et al. 2026), making surface-level transparency no longer sufficient to support user trust or regula-

tory compliance (Khalid, Farooqi, and Bilal 2026). Recent studies further highlight novel failure modes, including error cascades, responsibility gaps, flawed execution monitoring, and multi-step error propagation that obscures the origins of system behavior and outcomes (Zhu et al. 2026; Shah et al. 2026), highlighting the need for a rethinking of current XAI practices.

Existing explainability approaches, in fact, were primarily designed for static, single-step predictive models and are increasingly inadequate for explaining the behavior of autonomous agents operating in dynamic environments (Chakrabarty 2025; Raza et al. 2026; Chaduvula et al. 2026). This challenge is further amplified by the interaction paradigm of Agentic AI, which introduces a complex triadic relationship among users, autonomous agents, and external digital resources, requiring explanation mechanisms that account for multi-layered interactions across interconnected systems (Ehsan et al. 2026). For these reasons, researchers have called for a shift from traditional feature-level explanations toward system-level interpretability capable of capturing agent trajectories, reasoning processes, tool interactions, and execution histories (Zhu et al. 2026; Raza et al. 2026; Collaco et al. 2026).

Emerging work advocates for explainability frameworks that treat transparency as a continuous lifecycle property and capable of answering not only what decisions were made, but also why, how, when, and by whom they were influenced (Raza et al. 2026). Similarly, other studies warn against the illusion of explainability that Chain-of-Thought disclosures may create, highlighting the need for human-centered approaches that support meaningful understanding rather than merely exposing internal reasoning traces (Ehsan et al. 2026). However, despite the growing recognition of these challenges, research at the intersection of XAI and Agentic AI remains relatively narrow in scope and is largely industry-driven, with a primary focus on tasks such as failure detection and debugging. As a result, existing approaches often fall short of addressing the broader interpretability and accountability debt incurred by these systems across diverse stakeholder groups, including regulators, deployers, and end users.

For these reasons, we introduce a post-hoc, log-grounded framework for generating faithful and auditable structured and natural-language explanations of AI agents' decisions.

¹In this paper, we use the terms AI agents and agentic AI systems interchangeably to refer primarily to LLM-based agents capable of autonomous planning and tool use. While some of the challenges and solutions discussed may also apply to other types of autonomous AI systems, such as agents based on traditional reinforcement learning, our focus is on tool-using LLM agents, which currently constitute the dominant paradigm of Agentic AI.

*Corresponding author: vineis@diag.uniroma1.it.

In this preprint version, the source code and trace dataset are available upon request.

Our approach leverages execution traces, which are often too lengthy and complex to be readily inspected or interpreted, particularly by non-technical users, to reconstruct and expose the specific sequences of actions and environmental observations that shaped an agent's behavioral trajectory and ultimately led to a given outcome. Because the framework operates exclusively on the logged interaction trace, it can be seamlessly applied across different underlying agent architectures, tool ecosystems, and task domains, enabling broad applicability to real-world AI systems.

Overall, our work makes the following contributions:

  1. A framework for end-user explainability of AI agents. We introduce a framework specifically designed to make AI agent behavior transparent and understandable to end users. To the best of our knowledge, existing approaches primarily target developer- and system-oriented objectives, such as debugging, monitoring, and failure analysis, rather than treating user-facing explanations as a primary objective. Our framework addresses this gap by defining a process for transforming agent execution traces into faithful and human-readable explanations.

  2. Two complementary trace-grounded XAI artifacts. We introduce two complementary artifacts for explaining agent behavior: (i) a structured report that provides a systematic, step-by-step representation of the agent's behavioral trajectory, and (ii) a concise natural-language narrative that communicates the relevant behavior to end users while remaining grounded in the execution trace. The structured report serves as an intermediate, auditable layer connecting the trace to the final explanation and enables precise identification of mismatches between the agent's available knowledge and its observed behavior.

  3. A taxonomy of agent behavior grounded in knowledge alignment. We develop a taxonomy that characterizes agent behavior according to the relationship between the agent's available knowledge and information acquired through interaction with the environment. The taxonomy captures aligned and mismatched knowledge states, providing a principled basis for identifying and interpreting different forms of agent behavior from execution traces.

  4. An empirical evaluation of explanation quality. We evaluate the framework across two established agentic benchmarks, three agent architectures, and two baseline approaches to generating XAI artifacts. We assess explanations along four dimensions (faithfulness, exhaustiveness, linguistic quality, and overall satisfaction) using both human evaluation and LLM-as-a-judge. Our results show that the proposed method produces structured reports that are substantially more faithful to the execution trace than those obtained by directly prompting an LLM to generate them. Furthermore, for both human and LLM evaluators, narratives grounded in our reports are judged to be more faithful and exhaustive, and receive higher overall ratings, than narratives generated by prompting an LLM to explain the execution trace.

References (25)