AgentXRay: White-Boxing Agentic Systems via Workflow Reconstruction
Abstract
Large Language Models have shown strong capabilities in complex problem solving, yet many agentic systems remain difficult to interpret and control due to opaque internal workflows. While some frameworks offer explicit architectures for collaboration, many deployed agentic systems operate as black boxes to users. We address this by introducing Agentic Workflow Reconstruction (AWR), a new task aiming to synthesize an explicit, interpretable stand-in workflow that approximates a black-box system using only input--output access. We propose AgentXRay, a search-based framework that formulates AWR as a combinatorial optimization problem over discrete agent roles and tool invocations in a chain-structured workflow space. Unlike model distillation, AgentXRay produces editable white-box workflows that match target outputs under an observable, output-based proxy metric, without accessing model parameters. To navigate the vast search space, AgentXRay employs Monte Carlo Tree Search enhanced by a scoring-based Red-Black Pruning mechanism, which dynamically integrates proxy quality with search depth. Experiments across diverse domains demonstrate that AgentXRay achieves higher proxy similarity and reduces token consumption compared to unpruned search, enabling deeper workflow exploration under fixed iteration budgets.
Lay Summary
Modern AI agents combine large language models with planning, tool use, and multi-step coordination to perform complex tasks. As these systems become more capable, an increasing number of them are deployed as black boxes: users observe their inputs and outputs, but the internal decision process—which tools are called, in what order, by which specialized roles—remains hidden. This opacity limits trust, makes debugging difficult, and prevents users from adapting these systems to new domains. We introduce a new task called Agentic Workflow Reconstruction, which seeks to recover an interpretable, editable surrogate workflow for a black-box agent using only its observable input-output behavior. Our method, AgentXRay, treats this as a combinatorial search over sequences of agent roles and tool calls. To navigate the resulting search space efficiently, we use Monte Carlo Tree Search guided by a pruning mechanism that concentrates computation on the most promising candidate workflows. Across five domains—software development, data analysis, education, scientific computing, and 3D modeling—AgentXRay recovers workflows that closely match the behavior of the original systems. The reconstructed workflows are transparent and can be inspected, modified, or debugged, offering a practical path toward more controllable and accountable AI agents.