Conceptio › Archive › arXiv CS
arXiv CS open access

Trace Comparison for Actionable Diagnostics and Improvement of Agentic Systems

Sergey Zeltyn et al. · arxiv_cs
arXiv CS · Papers
Open Source ↗Direct PDF ↓
artificial-intelligenceknowledge-representationreasoning
Teams build agentic systems on a frontier language model, then move to a smaller and cheaper one for production. Performance drops, and neither benchmark scores nor raw execution traces tell a developer which part of the system broke. We present comparison analytics, a capability deployed in IBM AgM
Conceptio Open Archive

Analyze & explore related research in Conceptio

Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.

Trace Comparison for Actionable Diagnostics and Improvement of Agentic Systems Sergey Zeltyn, Iftach Shoham, Dany Moshkovich, Ido Levy, Inna Skarbovsky, Roy Abitbol, Segev Shlomov∗

arXiv:2612.04118v1 [cs.SE] 2 Dec 2026

IBM Software Innovation Lab, Haifa, Israel segev.shlomov1@ibm.com

Abstract Teams build agentic systems on a frontier language model, then move to a smaller and cheaper one for production. Performance drops, and neither benchmark scores nor raw execution traces tell a developer which part of the system broke. We present comparison analytics, a capability deployed in IBM AgMentor that treats a successful run as a demonstration and finds where a failed run of the same task first departs from it. Comparing the two runs component by component localizes the earliest behavioral difference rather than the symptoms that follow from it, and pooling those differences across many runs yields recurring failure patterns with proposed changes that a developer reviews, applies and revalidates. Across three agentic systems, trace-guided changes improve task success and run-to-run reliability. In the CUGA backbone-migration experiment, they recover roughly 40% of the AppWorld performance lost when the backbone is swapped; in self-comparison, they substantially improve run-to-run consistency. The results suggest that the approach is most useful when failures reflect unreliable behavior rather than a fundamental capability gap.

Introduction An agentic system decomposes a task across specialized components, such as planning, tool selection, code generation, and recovery, each realized by prompting a language model (Wang et al. 2024). We call the language model that serves these components the system’s backbone. Developers usually build a first working version on a frontier backbone, which offers the strongest capabilities and makes it unlikely that early failures are caused by the model itself. Production changes the calculus. An agentic system issues many model calls per task, so a frontier backbone is expensive and slow, whereas a smaller or open-weight backbone cuts cost and latency and can run on constrained, private, or on-premises infrastructure (Belcak et al. 2025; Chen, Zaharia, and Zou 2024). Another approach replaces expensive LLM-based decision components with lightweight classifiers trained on execution traces (Levy et al. 2026). Swapping the backbone rarely preserves behavior. Prompts, output schemas, and control logic were written against the original model, and a smaller backbone often fails not because the task is beyond it but because the surrounding system assumes conventions the new model does not follow (Wang et al. 2026). The same difficulty arises with no backbone change at all, because agentic

systems are non-deterministic and a task that succeeds on one run can fail on the next (Atil et al. 2025). In both cases the developer asks the same question: which component broke, and what should change. A benchmark score answers neither, because it reports only that a run failed. Prior work on web agents has demonstrated the importance of component-level evaluation for identifying performance bottlenecks that end-to-end evaluation obscures (Shlomov et al. 2025). An execution trace records what happened during a run as a structured log of model calls, tool invocations, and intermediate outputs, but one failed task can span dozens of steps, and the step where the run went wrong is rarely the step where the error surfaced. Inspecting and comparing such traces across backbones, tasks, and repeated runs remains time-consuming, difficult to reproduce systematically, and hard to scale to large evaluations. Three lines of work bear on this, and each stops short of the question. Observability platforms and the OpenTelemetry GenAI conventions standardize execution traces (OpenTelemetry Project 2025; Langfuse 2026), while benchmarks and LLM judges measure outcomes (Yehudai et al. 2026; Zheng et al. 2023; Zhuge et al. 2025); judges are costly on long traces and inconsistent across benchmarks (Lù et al. 2025). Failure attribution identifies responsible components and steps, but accuracy remains low (Zhang et al. 2025; Deshpande et al. 2025), while stronger methods require replaying perturbed steps (Zhang et al. 2026), which is unavailable for previously collected telemetry. Automated repair and harness adaptation search over prompts, tools and orchestration (Chen et al. 2026; Yang et al. 2026), but optimize without explaining changes that enterprise developers must approve. Our prior work found that judges analyze failures better with matched successful and failed pairs than with failures alone (Mulian et al. 2026). We build on that insight without the cost and reproducibility limits of judgebased pairwise comparison. Appendix B discusses each line in full. We present comparison analytics, which turns telemetry that already exists into component-level diagnoses without re-executing anything. For a given task it pairs a successful run with a failed one, aligns the two step by step at the level of individual agent invocations, and compares the aligned outputs field by field. The comparison rules are specific to each agent and are synthesized once, offline, by an LLM reading

Figure 1: Comparison analytics in the IBM AgMentor developer workflow. After onboarding an agent and its evaluation, developers use comparison analytics to contrast successful and failed executions, identify recurring failure patterns, and generate evidence-backed recommendations. Candidate changes are then reviewed and re-evaluated in a closed validation loop. that agent’s prompt. From then on the trace-level comparison runs deterministically without model calls; an LLM is used only to interpret the resulting aggregate. Each pair produces a trace comparison report that highlights its first divergence, the earliest invocation whose output differs behaviorally between the two runs, while also recording subsequent divergences and their downstream effects. These reports are then aggregated, and an LLM analyzes the aggregate to cluster recurring failure modes, identify likely root causes, and propose changes. The developer chooses which changes to apply and re-runs the benchmark to confirm they help. The same machinery covers two situations. In backbone migration the two runs come from different backbones. In self-comparison both come from repeated runs of one configuration, and the question is why a task sometimes fails. The capability is deployed in AgMentor (Agent Mentor), an IBM system for assessing and improving agentic systems across their lifecycle. Developers onboard their own systems, evaluation results, execution traces, and model configurations, and comparison analytics runs as one of the analytics AgMentor supports. We evaluate on three agentic systems that differ in orchestration and trace format: CUGA (Shlomov et al. 2026a), a LangGraph ReAct agent (Yao et al. 2023; LangChain 2025), and MiroFlow (Su et al. 2026). On AppWorld (Trivedi et al. 2024), one round of trace-guided changes recovers roughly 39% of the task success CUGA loses when its Opus 4.5 backbone is replaced by GPT-OSS-120B, a statistically significant gain, and changes derived for the ReAct agent from the easy tasks also improve the larger Test-Normal and Test-Challenge sets. On GAIA (Mialon et al. 2024), self-comparison makes the ReAct agent markedly more consistent across repeated runs. Two findings matter more than the totals. First, gains concentrate on medium-difficulty tasks and are much smaller

on hard tasks, a pattern consistent with trace-guided adaptation being less effective when the remaining gap primarily reflects model capability. Second, recommendations are hypotheses rather than fixes: some plausible ones do not survive re-evaluation, which is why the developer stays in the loop and revalidation is part of the workflow rather than an optional check. We make three contributions. First, comparison analytics itself, deployed in AgMentor, which turns traces a team already collects into component-level divergence records and developer-reviewable changes, while performing trace-level comparison deterministically without LLM calls. Second, evidence across backbone migration and run-to-run instability that the resulting changes recover a substantial share of what is lost when a frontier backbone is swapped for a cheap one and transfer to larger task sets. Third, a scope condition that matters to a practitioner deciding whether to try it: the approach helps when the smaller backbone is capable but unreliable, not when the capability is absent, and its recommendations are hypotheses that must be revalidated. Figure 1 places comparison analytics within AgMentor’s end-to-end developer workflow, from evaluation and diagnosis through validated agent improvement.

Approach As shown in Figure 1, comparison analytics is one stage in a broader AgMentor improvement cycle; we now describe how successful and failed executions are compared to produce diagnoses and recommendations. Hypothesis. A successful execution provides a demonstration of one way the task can be completed. Our working hypothesis is that the behavioral differences between a successful and a failed execution of the same task reveal requirements that the failed execution did not satisfy, and that

these requirements can be extracted from existing execution telemetry using comparison rules derived from the application’s prompts and output schemas, without weight updates, execution replay, or search over alternative system configurations. In backbone migration, this amounts to transferring behavioral requirements observed under a stronger reference backbone to a weaker target backbone. In self-comparison, the same principle is applied to successful and failed executions of the same configuration. The hypothesis also suggests a scope condition: transfer should be most useful when failures reflect inconsistent execution of behaviors the target backbone can sometimes perform, and less useful when the remaining gap primarily reflects model capability. We examine this pattern empirically below. Setting. We take an agentic system to be a set of components c1 , . . . , cK arranged in a workflow, where a component is one prompt together with the output format that prompt asks for. In CUGA, for example, the components include TaskAnalyzer, PlanController, CodeAgent, Shortlister, and Reflection. Components are not autonomous agents; they are addressable units of the workflow and the granularity at which we localize failures. The input is a set of execution traces for a benchmark, produced under a reference configuration and a target configuration. In backbone migration, the two configurations use different backbones, with the stronger one serving as the reference. In self-comparison, both runs use the same configuration, and reference simply designates a successful run. The comparison procedure itself is identical in both settings. The procedure may also use a language model, which we call the analysis LLM to distinguish it from the backbones under study. Analysis-LLM calls are used to prepare comparison rules and to interpret and aggregate the resulting comparison reports, but not during the potentially computeintensive trace-comparison stage itself. This stage aligns and compares every relevant step of every trace deterministically, making trace-level comparison reproducible.

AgMentor Overview Comparison analytics is deployed as one analytics capability within AgMentor, an IBM-developed system for assessing and improving agentic applications across their lifecycle, from development and pre-production testing through production operation. Enterprise adoption of these systems depends on being able to show that they behave acceptably on accuracy, consistency, latency, cost, policy compliance, and robustness at the same time (Shlomov et al. 2026b; Moshkovich and Zeltyn 2025). AgMentor brings these properties into a common improvement loop that runs from discovering a system’s intended behavior, through instrumentation and testing, to issue detection, diagnosis, recommendation generation and optimization, application of changes, and revalidation. This extends prescriptive process monitoring (Zeltyn et al. 2022) to agentic systems. Two AgMentor properties matter for this paper. First, comparison analytics is customized to each agentic application during onboarding. AgMentor’s discovery step inventories the application’s prompts and output schemas and assigns

stable identities to its components. A dedicated configuration skill then uses this information to generate the applicationspecific comparison rules that determine how outputs of each component are extracted and compared. This customization is automated and can be regenerated as the application evolves. Second, once configured, comparison analytics operates on execution telemetry in a standardized representation based on the OpenTelemetry GenAI semantic conventions. This separates the comparison procedure from the underlying telemetry collection and storage infrastructure and allows the same analytics implementation to operate across deployment environments, while retaining the application-specific comparison rules generated during onboarding. Comparison analytics is one of several analytics AgMentor can combine in an improvement pipeline. The system can weigh recommendations against those from other analytics and against objectives such as cost, latency, and implementation effort, validate proposed changes through reexecution, and carry validated changes forward for developer approval. Appendix D describes the full AgMentor improvement pipeline and its relationship to the comparison-analytics method.

How Comparison Analytics Works Comparison analytics consumes two inputs prepared earlier in the AgMentor cycle and transforms them through three stages into developer-reviewable recommendations. Figure 2 summarizes the full process; the stages are described below. Input 1: comparison rules, synthesized at onboarding. A component’s output format is usually implicit in its prompt rather than declared anywhere. Once per component, offline, the analysis LLM reads the prompt, together with source code, documentation and sample logs where they are available, and produces two things: an output schema, and a short list of key fields, meaning the fields on which a difference between two outputs implies a difference in behavior. Each key field is paired with a comparison mode, a deterministic test that returns whether two values at that field should count as the same. Modes range from exact match to embedding similarity above a threshold. The same pass configures instrumentation, so that each prompt execution is captured with the attributes its comparison rules will need. Where the prompt and the source code disagree, the discrepancy is reported to the developer and the prompt takes precedence, so a component can be onboarded even when its code is unavailable. Appendix C gives the full mode list and the handling of outputs that are not valid JSON. Input 2: trace pairs, collected from benchmark runs. The benchmark is executed under each configuration, repeatedly where run-to-run variability matters and always so for self-comparison. Each step records the component invoked, its input and output, and its position in the run. For each task we then keep the outcome-discordant pairs, meaning those in which the reference run succeeded and the target run failed, since only those pairs contain a demonstration and a failure to compare against it. The number of such pairs grows with the product of the run counts, so a configurable budget selects a

only if every key field passes. Otherwise it is different, and the fields that failed are retained as evidence. Stage 2. First divergence. The aligned sequence is scanned forward for the earliest step at which sim(i) = 0. We call this the first divergence, and it is the one step the pair is reduced to. It identifies the earliest material behavioral difference between the executions, providing a candidate locus for diagnosis before downstream differences accumulate. The record keeps the component, the step, the fields that failed with the modes that rejected them, and the two outputs themselves. Comparison continues past the first divergence to characterize the resulting cascade, stopping where the runs can no longer be aligned. Stage 3. Aggregation and recommendations. The perpair records are collected into one table whose rows hold the task, the outcome, the first-divergence component and step, and the fields that failed. This table is small enough to fit in a context window that the underlying traces would exhaust, which is what makes the final step affordable. The analysis LLM reads the whole table at once, rather than one pair at a time, and returns clusters of divergences that share a signature, the root cause behind each cluster stated separately from its symptoms, and a prioritized list of changes. Reasoning over the aggregate is what makes the output actionable: a recommendation is grounded in a pattern seen across many traces and is linked back to the traces that exhibit it, instead of describing one run. The developer selects which recommendations to apply, applies them, and re-runs the benchmark. Figure 2: Comparison analytics and its inputs. Comparison rules are synthesized once per component at onboarding (1), and traces are collected by running the benchmark under each configuration (2). Each successful–failed pair is then aligned and compared deterministically (3), its first divergence is recorded (4), and the records are aggregated across pairs for an analysis LLM to turn into failure clusters, root causes, and prioritized recommendations (5). Markers 3–5 are Stages 1– 3 of the text. subset, from one representative pair per task up to exhaustive pairing. Stage 1. Alignment and step comparison. Within a pair, steps are matched by component identity, call index, and parent-span relations where the trace provides them. Matching tolerates gaps, so one retried or inserted step does not misalign everything after it, and a position where the two runs invoke different components is recorded as a structural divergence. For each aligned position i, both outputs are parsed against the component’s schema and every key field is tested under its mode: ^ tgt  sim(i) = δm f (oref (1) i ), f (oi ) , (f,m) ∈ Fc(i)

where Fc(i) is the key-field list of the component invoked at position i, f (o) is the value that field takes in output o, and δm ∈ {0, 1} is the test for mode m. A step counts as similar

Evaluation Experimental Setup We evaluate trace comparison for two settings: backbone migration and self-comparison of repeated runs under the same configuration. For backbone migration, we run CUGA on 128 AppWorld (Trivedi et al. 2024) CUGA regression test tasks (43 Easy, 40 Medium, 45 Hard), using Claude Opus 4.5 as the reference model and GPT-OSS-120B as the target. AppWorld exercises multi-step API use, planning, tool selection, and code generation. We also apply the procedure to a ReAct agent, using GPT-5.4 as the reference and GPT-OSS120B as the target. Recommendations are derived from TestEasy, the 43 difficulty-level-1 tasks, which are drawn from both Test-Normal and Test-Challenge; the resulting agent is then evaluated on the full Test-Normal and Test-Challenge sets, of which the 43 diagnosis tasks form under 8%. For self-comparison, we evaluate a LangGraph ReAct agent on GAIA (Mialon et al. 2024) Levels 1 and 3 and MiroFlow, a multi-agent deep-research system, on Level 1. Both use Claude Sonnet 4.6, with 10 runs per task. Claude Opus 4.6 is used as the analysis model for CUGA, ReAct AppWorld and GAIA. All experiments follow the same loop: run the benchmark, analyze successful and failed traces, apply the resulting recommendations, and rerun the same tasks. On AppWorld, Claude Code (effort: Max) first produces an implementation plan from the report (Appendix E) and then applies it; the

model configuration remains fixed. We evaluate both reports generated separately for each difficulty split and one report over the full AppWorld run. Only tasks with both successful and failed runs enter GAIA self-comparison. For AppWorld, we report task success rate and use McNemar’s exact test on paired before–after outcomes. For GAIA, accuracy is the mean success rate across the 10 runs, while consistency measures how consistently an agent succeeds across repeated executions of its tasks. If k is the number of executions, the consistency score is the ratio passk /mean@k, where passk (Yao et al. 2025) is the fraction of tasks that succeeded on all k runs and mean@k is the fraction of all executions that succeeded. For CUGA and GAIA, the post-fix evaluation reruns tasks used for diagnosis and therefore measures the effectiveness of the diagnose– fix–verify workflow. The ReAct AppWorld experiment additionally evaluates the resulting changes on Test-Normal and Test-Challenge tasks.

when the target backbone can perform the required behavior but does so unreliably, rather than when the remaining gap primarily reflects model capability. We next ask whether the reports need to be generated separately by difficulty. A single report over all 128 tasks reaches 46.1% (+10.2 pp), compared with 45.3% (+9.4 pp) for the split-by-split procedure. The difference is one task. In this experiment, therefore, splitting the analysis provides no measurable advantage over a single report, making the latter the simpler workflow for developers. The improvement is also not limited to CUGA. On AppWorld Test-Easy, applying the procedure to ReAct increases success from 65.1% to 72.1% (+7.0 pp). Without further adaptation, the modified agent also improves on Test-Normal set from 45.0% to 55.4% (+10.4 pp) and on Test-Challenge from 26.0% to 34.0% (+8.0 pp). This provides evidence that the resulting changes generalize beyond the tasks used to generate the recommendations.

Results

Table 1: AppWorld success rates before and after traceguided improvement. For CUGA, Reference uses Opus 4.5; for ReAct, Reference uses GPT-5.4. Before and After use GPT-OSS-120B for both agents. The last CUGA row uses one report over all 128 tasks instead of per-split reports.

What changed. For CUGA, the reports exposed recurring failures at several layers of the system rather than isolated task-specific mistakes. They identified a find_tools isolation rule that was stated in the prompt but not enforced, a premature-finalization classifier that lacked the task context needed to judge whether execution was actually complete, and underspecified guidance about supporting tools and unconfirmed capabilities. The corresponding changes therefore went beyond prompt editing: the parser now enforces tool isolation, the classifier receives the task and subtask it is judging, and turns that describe intended actions without emitting code trigger a directive retry. The reports also showed that context tolerated by Opus 4.5 could distract GPT-OSS-120B, so the CodeAgent now receives only shortlisted tool signatures rather than the full tool documentation. In addition, the Shortlister was made configurable to include required downstream APIs, and final-answer formatting was moved to a dedicated node rather than left to the CodeAgent. Together, these changes illustrate the intended use of comparison analytics: recurring trace divergences are translated into concrete modifications to prompts, parsers, routing logic, and workflow structure, which are then re-evaluated against the benchmark.

Backbone migration. Replacing Opus 4.5 with GPT-OSS120B reduces CUGA’s AppWorld success rate from 60.2% to 35.9%, a 24.3-point drop. After one round of trace-guided changes, GPT-OSS-120B reaches 45.3% (+9.4 pp), recovering 39% of the lost performance. Seventeen tasks switch from failure to success while five regress; the overall improvement is significant under McNemar’s exact test (p = 0.017). The gains vary substantially by difficulty. Medium improves from 27.5% to 45.0% (+17.5 pp), leaving only a 2.5-point gap to Opus 4.5; this improvement is also significant (p = 0.016). Easy improves by 9.3 points, from 62.8% to 72.1%. Hard improves by only 2.2 points, from 17.8% to 20.0%. The breakdown identifies an important empirical boundary: trace-guided changes nearly close the migration gap on Medium tasks but recover little on Hard tasks. This pattern is consistent with the approach being most effective

Self-comparison. Self-comparison addresses a different problem: instability without changing the backbone, which remains Claude Sonnet 4.6 throughout. For the ReAct agent on GAIA Level 3, accuracy increases from 34.0% to 39.2% (+5.2 pp), while consistency rises from 47.0% to 81.2% (+34.2 pp). The effect is therefore much larger on run-to-run stability than on mean task success. This result matches the intended role of self-comparison: the analysis starts from tasks for which the same configuration succeeds on some runs and fails on others, making inconsistent behavior itself the diagnostic signal. After the resulting changes, ReAct Level 3 becomes substantially more stable while also improving average accuracy. For deployed agents, this reduction in stochastic failure can be important even when the change in mean accuracy is more modest. The change behind this gain came from one recurring divergence: comparison analytics associated repeated web-

We examine backbone-migration recovery, generalization to extended task sets, and reduction of run-to-run instability. Split

Tasks Reference Before After Gain (pp)

CUGA Easy Medium Hard Overall

43 40 45 128

93.0 47.5 40.0 60.2

62.8 27.5 17.8 35.9

72.1 45.0 20.0 45.3

+9.3 +17.5 +2.2 +9.4

Overall (single)

128

60.2

35.9

46.1

+10.2

ReAct Easy Test Normal Test Challenge

43 168 417

93.5 92.9 89.9

65.1 45.0 26.0

72.1 55.4 34.0

+7.0 +10.4 +8.0

Accuracy Agent

Consistency

Level Before After Before After

ReAct L1 ReAct L3 MiroFlow L1

72.0 34.0 65.0

– 39.2 66.0

86.0 47.0 58.0

– 81.2 60.8

Table 2: GAIA accuracy and consistency before and after trace-guided changes. Values are percentages. ReAct Level 1 has no post-fix result because no modification was applied.

of shortlisted tools as though it determined their execution order. In addition, a plausible recommendation reproduced a completion-state mechanism that CUGA developers had previously evaluated and found to increase execution cost without improving accuracy. This cross-check is not a formal estimate of diagnostic accuracy, since the issue repository is incomplete and was not built as an annotation set. It does show that the analytics detects real application weaknesses, while the disagreements show why its outputs cannot be treated as ground truth.

Deployment Lessons and Path Forward search divergence with a missing source-prioritization and convergence policy, and recommended that the agent extract the answer once the target document had been reached rather than continue searching. MiroFlow Level 1 shows a smaller effect. Accuracy increases from 65.0% to 66.0%, and consistency from 58.0% to 60.8%. ReAct Level 1 was not modified, so we report only its baseline performance. The contrast across settings shows that trace-guided changes do not produce uniform gains: the largest effect in these experiments is the reduction in inconsistent behavior for ReAct Level 3.

Pilot Deployment and Engineering Validation Integration and Engineering Validation Comparison analytics is deployed as part of the AgMentor improvement workflow described above; Appendix A shows the developer-facing interface. AgMentor can run comparison analytics on its own, without its other analytics, which is the mode used in the experiments reported in this paper. AgMentor is used by several teams inside IBM, including the CUGA team; CUGA in turn has several significant users within the company. Beyond benchmark improvement, we examined whether comparison analytics identifies problems that CUGA developers had recorded independently. We cross-referenced 30 CUGA-related findings against the CUGA issue repository. Repeated findings across experimental configurations reduced these to 19 distinct findings, of which ten matched open issues, three matched issues already resolved, two were new, and four were judged doubtful. The matches with open issues covered failure families such as pagination and looping, incomplete shortlisting, read-before-write grounding, and incorrect completion behavior. In one particularly direct case, the finding that the agent should verify the target item set before bulk mutation matched an existing read-before-write issue and cited the same benchmark tasks that developers had recorded as evidence. The two new findings, failure to verify ambiguous entities before selection and failure to enumerate application scope before operations spanning multiple applications, led to new CUGA issues. Both had escaped notice even though CUGA developers routinely analyze failure logs with coding agents such as Claude Code and Codex. The cross-check also exposed limitations of automated diagnosis and recommendation. The four doubtful findings proposed mechanisms that did not match the way CUGA actually executes; for example, some treated the ordering

Several lessons emerged from integrating comparison analytics into AgMentor. First, a successful trace is a useful behavioral reference, but not a gold execution plan. Different successful runs may follow different valid trajectories, so comparison should focus on material component behavior rather than exact imitation. Accordingly, comparison rules operate on component-specific output fields and behavioral properties rather than textual equality. Second, the most useful engineering unit is a recurring pattern across trace pairs, not an isolated divergence. The first divergence indicates where two executions first differ materially, while later divergences show how the difference propagates. Neither proves causality by itself. Aggregating evidence across tasks helps separate recurring component weaknesses from execution-specific variation and produces issues at a more actionable granularity. Third, diagnosis and recommendation have different reliability requirements. Repeated evidence for a problem does not guarantee that a proposed modification will fix it. Recommendations may target the wrong mechanism, overfit the observed traces, or introduce regressions elsewhere, as the CUGA cross-check above illustrates. AgMentor therefore treats recommendations as hypotheses and validates them through re-execution, including regression checks outside the targeted failure cluster. Two limitations also became clear. First, comparison analytics cannot compensate for capabilities the backbone lacks: our largest gains came where the target backbone could solve a task but did so inconsistently, so backbone migration is a system-adaptation problem, but system adaptation is not a substitute for model capability. Second, the method depends on sufficiently complete and correctly attributed telemetry. Component identities, outputs, and comparison fields must be recoverable from the application and its traces. AgMentor reduces this burden by discovering prompts and schemas and generating comparison rules automatically, but those rules must be regenerated and checked as the application evolves. The next deployment stage is broader validation across additional agent architectures, development teams, and evaluation environments, together with continuous evaluation of model and configuration changes. Wider deployment should track developer-confirmed findings, unsupported diagnoses, recommendations that survive regression testing, and the cost of onboarding and analysis. Overall, our results show that comparison analytics can turn existing execution traces into actionable, developer-validated improvements for agentic systems.

References Atil, B.; Aykent, S.; Chittams, A.; Fu, L.; Passonneau, R. J.; Radcliffe, E.; Rajagopal, G. R.; Sloan, A.; Tudrej, T.; Ture, F.; Wu, Z.; Xu, L.; and Baldwin, B. 2025. Non-Determinism of “Deterministic” LLM System Settings in Hosted Environments. In Proceedings of the 5th Workshop on Evaluation and Comparison of NLP Systems (Eval4NLP), 135–148. Association for Computational Linguistics. Belcak, P.; Heinrich, G.; Diao, S.; Fu, Y.; Dong, X.; Muralidharan, S.; Lin, Y. C.; and Molchanov, P. 2025. Small Language Models are the Future of Agentic AI. arXiv preprint arXiv:2506.02153. Bonagiri, A.; Borkar, D.; Anderias, G. J.; Rafatirad, S.; and Homayoun, H. 2026. CausalFlow: Causal Attribution and Counterfactual Repair for LLM Agent Failures. arXiv preprint arXiv:2605.25338. Cemri, M.; Pan, M. Z.; Yang, S.; Agrawal, L. A.; Chopra, B.; Tiwari, R.; Keutzer, K.; Parameswaran, A.; Klein, D.; Ramchandran, K.; Zaharia, M.; Gonzalez, J. E.; and Stoica, I. 2025. Why Do Multi-Agent LLM Systems Fail? In Advances in Neural Information Processing Systems 38 (NeurIPS 2025), Datasets and Benchmarks Track. Chen, L.; Zaharia, M.; and Zou, J. 2024. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance. Transactions on Machine Learning Research. Chen, M.; Wang, J.; Liu, Z.; Wang, Y.; Zheng, H.; and Wang, Q. 2026. From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws. arXiv preprint arXiv:2606.06324. Deshpande, D.; Gangal, V.; Mehta, H.; Krishnan, J.; Kannappan, A.; and Qian, R. 2025. TRAIL: Trace Reasoning and Agentic Issue Localization. arXiv preprint arXiv:2505.08638. Hu, S.; Lu, C.; and Clune, J. 2025. Automated Design of Agentic Systems. In The Thirteenth International Conference on Learning Representations (ICLR). Khattab, O.; Singhvi, A.; Maheshwari, P.; Zhang, Z.; Santhanam, K.; Vardhamanan, S.; Haq, S.; Sharma, A.; Joshi, T. T.; Moazam, H.; Miller, H.; Zaharia, M.; and Potts, C. 2024. DSPy: Compiling Declarative Language Model Calls into State-of-the-Art Pipelines. In The Twelfth International Conference on Learning Representations (ICLR). LangChain. 2025. LangGraph: Building Stateful, MultiActor Applications with LLMs. https://github.com/ langchain-ai/langgraph. Accessed: 2026-11-24. Langfuse. 2026. Langfuse: Open Source LLM Observability and Application Tracing. https://langfuse.com/docs/ observability/overview. Accessed: 2026-11-24. Lavi, O.; Rabinovich, E.; Shlomov, S.; Boaz, D.; Ronen, I.; and Tavor, A. A. 2021. We’ve Had This Conversation Before: A Novel Approach to Measuring Dialog Similarity. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, 1169–1177. Levy, I.; Shlomov, S.; Yaeli, A.; Mashkif, N.; Adi, A.; Goldshtein, Y.; Shapira, E.; and Choshen, L. 2026. TabAgent:

Distilling LLM Agent Components into Cheap Classifiers. arXiv preprint arXiv:2602.16429. Lù, X. H.; Kazemnejad, A.; Meade, N.; Patel, A.; Shin, D.; Zambrano, A.; Stańczak, K.; Shaw, P.; Pal, C. J.; and Reddy, S. 2025. AgentRewardBench: Evaluating Automatic Evaluations of Web Agent Trajectories. In Proceedings of the 2nd Conference on Language Modeling (COLM). Mialon, G.; Fourrier, C.; Wolf, T.; LeCun, Y.; and Scialom, T. 2024. GAIA: A Benchmark for General AI Assistants. In International Conference on Learning Representations, 9025–9049. Moshkovich, D.; and Zeltyn, S. 2025. Taming Uncertainty via Automation: Observing, Analyzing, and Optimizing Agentic AI Systems. In 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE), 3840–3844. IEEE. Mulian, H.; Zeltyn, S.; Levy, I.; Galanti, L.; Yaeli, A.; and Shlomov, S. 2026. AgentFixer: From Failure Detection to Fix Recommendations in Agentic Systems. In Proceedings of the 2026 International Workshop on Agentic Engineering, 96–103. OpenTelemetry Project. 2025. AI Agent Observability – Evolving Standards and Best Practices. https: //opentelemetry.io/blog/2025/ai-agent-observability/. Accessed: 2025-09-22. Shlomov, S.; Oved, A.; Marreed, S.; Levy, I.; Akrabi, O.; Yaeli, A.; Strąk, Ł.; Koumpan, E.; Goldshtein, Y.; Shapira, E.; et al. 2026a. From Benchmarks to Business Impact: Deploying IBM Generalist Agent in Enterprise Production. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 40, 40423–40431. Shlomov, S.; Shoham, I.; Oved, A.; Levy, I.; Marreed, S.; Ship, H.; Akrabi, O.; Zeltyn, S.; Yaeli, A.; and Mashkif, N. 2026b. Governance by Construction for Generalist Agents. In Proceedings of the ACM Conference on AI and Agentic Systems, 1280–1287. Shlomov, S.; Wiesel, B.; Sela, A.; Levy, I.; Galanti, L.; and Abitbol, R. 2025. From grounding to planning: Benchmarking bottlenecks in web agents. In ECAI 2025: 28th European Conference on Artificial Intelligence 25-30 October 2025, Bologna, Italy-Including 14th Conference on Prestigious Applications of Intelligent Systems (PAIS 2025) Proceedings, 4815–4822. SAGE Publications, 1 Oliver’s Yard, 55 City Road, London, EC1Y 1SP. Su, S.; Xing, S.; Dong, X.; Zhong, M.; Wang, B.; Zhu, X.; Chen, Y.; Wang, W.; Deng, Y.; Zhu, P.; et al. 2026. MiroFlow: Towards High-Performance and Robust Open-Source Agent Framework for General Deep Research Tasks. arXiv preprint arXiv:2602.22808. Trivedi, H.; Khot, T.; Hartmann, M.; Manku, R.; Dong, V.; Li, E.; Gupta, S.; Sabharwal, A.; and Balasubramanian, N. 2024. AppWorld: A Controllable World of Apps and People for Benchmarking Interactive Coding Agents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 16022– 16076.

Wang, L.; Ma, C.; Feng, X.; Zhang, Z.; Yang, H.; Zhang, J.; Chen, Z.; Tang, J.; Chen, X.; Lin, Y.; Zhao, W. X.; Wei, Z.; and Wen, J.-R. 2024. A Survey on Large Language Model Based Autonomous Agents. Frontiers of Computer Science, 18(6): 186345. Wang, Y.; Liu, Q.; Wang, Z.; Li, Z.; Wei, W.; Liu, Y.; and Bao, Y. 2026. PromptBridge: Cross-Model Prompt Transfer for Large Language Models. In Proceedings of the 3rd Conference on Language Modeling (COLM). Yang, C.; Zhao, X.; Wu, T.; and Kästner, C. 2026. Better Harnesses, Smaller Models: Building 90% Cheaper Agents via Automated Harness Adaptation. arXiv preprint arXiv:2607.08938. Yao, S.; Shinn, N.; Razavi, P.; and Narasimhan, K. 2025. τ -bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. In The Thirteenth International Conference on Learning Representations (ICLR). Yao, S.; Zhao, J.; Yu, D.; Du, N.; Shafran, I.; Narasimhan, K. R.; and Cao, Y. 2023. ReAct: Synergizing Reasoning and Acting in Language Models. In The Eleventh International Conference on Learning Representations. Yehudai, A.; Eden, L.; Li, A.; Uziel, G.; Zhao, Y.; Bar-Haim, R.; Cohan, A.; and Shmueli-Scheuer, M. 2026. A Survey on Evaluation of LLM-based Agents. In Findings of the Association for Computational Linguistics: ACL 2026, 26690– 26714. San Diego, California, United States: Association for Computational Linguistics. ISBN 979-8-89176-395-1. Yuksekgonul, M.; Bianchi, F.; Boen, J.; Liu, S.; Lu, P.; Huang, Z.; Guestrin, C.; and Zou, J. 2025. Optimizing Generative AI by Backpropagating Language Model Feedback. Nature, 639(8055): 609–616. Zeltyn, S.; Shlomov, S.; Yaeli, A.; and Oved, A. 2022. Prescriptive process monitoring in intelligent process automation with chatbot orchestration. arXiv preprint arXiv:2212.06564. Zhang, G.; Wang, J.; Chen, J.; Zhou, W.; Wang, K.; and Yan, S. 2026. AgenTracer: Who Is Inducing Failure in the LLM Agentic Systems? In International Conference on Learning Representations, 11377–11399. Zhang, S.; Yin, M.; Zhang, J.; Liu, J.; Han, Z.; Zhang, J.; Li, B.; Wang, C.; Wang, H.; Chen, Y.; and Wu, Q. 2025. Which Agent Causes Task Failures and When? On Automated Failure Attribution of LLM Multi-Agent Systems. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, 76583–76599. PMLR. Zhao, A.; Huang, D.; Xu, Q.; Lin, M.; Liu, Y.-J.; and Huang, G. 2024. ExpeL: LLM Agents Are Experiential Learners. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, 19632–19642. AAAI Press. Zheng, L.; Chiang, W.-L.; Sheng, Y.; Zhuang, S.; Wu, Z.; Zhuang, Y.; Lin, Z.; Li, Z.; Li, D.; Xing, E. P.; Zhang, H.; Gonzalez, J. E.; and Stoica, I. 2023. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. In Advances in Neural Information Processing Systems, volume 36, 46595–46623. Zhuge, M.; Zhao, C.; Ashley, D. R.; Wang, W.; Khizbullin, D.; Xiong, Y.; Liu, Z.; Chang, E.; Krishnamoorthi, R.; Tian,

Y.; Shi, Y.; Chandra, V.; and Schmidhuber, J. 2025. Agentas-a-Judge: Evaluate Agents with Agents. In Proceedings of the 42nd International Conference on Machine Learning (ICML), volume 267 of Proceedings of Machine Learning Research, 80569–80611. PMLR.

Appendix A

Developer Interface

Figure 3 shows AgMentor as an agent developer sees it at the Analyze stage. The strip across the top tracks the four stages of the improvement cycle for the onboarded application: Onboard, which discovers components and generates the comparison rules; Run, which executes the benchmark and reports how many evaluation slots completed; Analyze, which reads the traces and produces recommendations; and Improve, which records the developer’s decisions on them. A pre-flight line above the strip reports the health of the execution containers and the model gateway, so that infrastructure problems can be told apart from agent failures before a pipeline is resumed. The results panel summarizes one analysis run: the number of recommendations, the number of producers, meaning the analytics plugins that authored them, the number of distinct benchmark tasks named as targets, and a log of every plugin that ran with its status and duration. Comparison analytics is one producer alongside others, such as a prompt improver and a failure-mechanism analyzer, and plugins that failed or were skipped are listed explicitly rather than silently omitted. Each row of the recommendation table gives the recommendation, its producer, the fix type, the number of tasks it claims to fix, and the identifiers of those tasks, which link back to the evidence traces; opening a row shows the full record with rationale and fix strategy. The target count supports targeted validation of the recommendation, while broader benchmark re-execution can be used to detect regressions outside the targeted tasks. The developer keeps or discards each recommendation, and the Improve stage carries the kept ones forward for application and re-evaluation.

B

Related Work in Full

Observability and evaluation. The OpenTelemetry GenAI semantic conventions and the platforms built on them capture model calls, tool use, intermediate decisions, errors and system state in a standard form (OpenTelemetry Project 2025; Langfuse 2026), and recent work extends this into an operations pipeline for agentic systems (Moshkovich and Zeltyn 2025). A parallel line makes outcomes measurable, through task-success metrics and agent benchmarks (Yehudai et al. 2026) and through LLM judges that read a trajectory and classify it. Together these tell a developer that a run failed and let them inspect what happened, but neither says which component to change. Judges do not close that gap on their own. They are costly on long traces and sensitive to context length, prompt wording and non-determinism, and prior work shows that they misclassify trajectories and behave inconsistently across benchmarks (Lù et al. 2025).

Figure 3: AgMentor developer interface at the Analyze stage. The stage strip tracks Onboard, Run, Analyze, and Improve for the onboarded application. The results panel summarizes one analysis run, and each recommendation row names its producer, fix type, and target tasks, opening to the full record with rationale and fix strategy. Failure attribution. Attribution takes a failed trajectory and names the responsible component and the decisive step. The Who&When benchmark shows how hard this is, reporting 53.5% accuracy at naming the responsible agent and 14.2% at naming the step (Zhang et al. 2025). TRAIL reports similarly low accuracy for localizing errors in GAIA and SWE-bench traces (Deshpande et al. 2025), and the MAST taxonomy attributes many multi-agent failures to system design and coordination rather than to model capability alone (Cemri et al. 2025). Stronger results come from counterfactual replay, which re-executes a perturbed step and observes whether the outcome flips (Zhang et al. 2026; Bonagiri et al. 2026). Replay establishes causality soundly, but it needs a replayable environment and repeated executions, which are unavailable when the evidence is telemetry already collected from evaluation or production runs. It also returns a verdict about one trajectory rather than a change a developer can make. Automated repair and adaptation. A third line changes the system instead of explaining it. Automated repair and harness adaptation search over prompts, tool sets and orchestration and keep the variants that score better, recovering a large

fraction of frontier performance on smaller backbones (Chen et al. 2026; Yang et al. 2026; Khattab et al. 2024; Yuksekgonul et al. 2025; Hu, Lu, and Clune 2025). These methods assume a search budget and an executable benchmark, and they optimize without explaining, so the developer sees a better score without seeing which behavior changed. In enterprise settings that is often the blocking issue, because a change to a deployed agent has to be understood and approved before it ships. Contrastive analysis. One result from the repair line points back at attribution: presenting a judge with a matched pair of successful and failed trajectories for the same task yields better failure analysis than inspecting the failure alone (Mulian et al. 2026). ExpeL similarly distills reusable insights by contrasting successful and failed trajectories (Zhao et al. 2024). That is the result this paper builds on. What it leaves open is that the comparison itself is handed to the judge, so it inherits the cost, context-length and reproducibility limits above, and the full analysis is repeated for every pair. Comparison analytics keeps the contrastive framing and makes the comparison deterministic, so only the interpretation of the pooled result requires a model call.

C

Comparison Specification Details

This appendix provides additional specification details for comparison analytics, including comparison modes, output normalization, pair selection, and alignment. Key fields and comparison modes. The specification produced for a component consists of its inferred output schema and a list of key fields. Each key field is a path into the schema, resolving either to a single value or element-wise across a list of objects, and carries one comparison mode. A mode is a deterministic predicate on two values returning 1 when they count as the same and 0 otherwise. The available modes are exact match, fuzzy string match, semantic similarity by embedding cosine above a threshold, approximate numeric equality, and field presence. Related similarity measures have been explored for dialog comparison (Lavi et al. 2021). The list is chosen to be as short as possible while retaining every field on which a difference implies a behavioral difference. Fields that vary freely without changing what the system does, such as an explanatory preamble, are excluded, which is what prevents cosmetic wording differences from registering as divergences. Outputs that are not valid JSON. Where a component emits text that does not parse against its schema, onboarding also synthesizes a normalizer, a deterministic function that projects the raw output onto the schema. Normalizers are generated once alongside the specification and run inside the deterministic comparison stage.

tection; and Stage 3 in Diagnosis and Recommendation Generation. The improvement cycle begins with Discovery of the application’s intended behavioral model, followed by the Definition of Custom Analytics and KPIs. The application is then Instrumented, after which benchmark suites and evaluation methods are onboarded to enable repeated Testing. The resulting telemetry drives Measurement of observed behavior and its comparison against the intended model, enabling Issue Detection, then Diagnosis and Root Cause Analysis, Recommendation Generation, Optimization, and finally Fix Application and Re-testing. This paper concerns the development phase, where the application and evaluation assets are under direct developer control, though the telemetry analyzed may originate in production and the resulting changes be applied in a subsequent release. Discovery. AgMentor analyzes code and configuration to discover components, workflows, tools, prompts and their relationships, building a persistent behavioral model reused throughout the pipeline. For comparison analytics it identifies every prompt in the codebase, including system prompts, task prompts, tool descriptions and templates, and assigns each a persistent component identity, which is what lets later stages attribute telemetry back to the component that produced it. In the same pass it recovers each component’s output schema from source code, corroborating the schema inferred from the prompt during onboarding, and reports discrepancies to the developer.

Pair-selection budget. For a task t, let Rtref and Rttgt be the run sets under the two configurations. The candidate pool is every cross pair in which the reference run succeeded and the target run failed, so its size grows with |Rtref | · |Rttgt | summed over tasks. Three selection policies are supported: one representative pair per task, a sampled quota per task, and exhaustive pairing, each bounded by a global cap. Exhaustive pairing surfaces more divergences at higher cost, and sampled policies keep a run cheap. Where the cap admits fewer tasks than are available, tasks are chosen to be maximally dissimilar in their formulations, so a restricted budget still spans heterogeneous task types.

Definition of Custom Analytics and KPIs. Enterprise applications need domain-specific metrics beyond the built-in ones, so AgMentor exposes an Analytics SDK for defining custom analytics, KPIs and their processing logic, together with agentic skills that help configure them during onboarding. Comparison analytics is one such custom analytics. A dedicated configuration skill reads the prompt inventory and output schemas from Discovery and generates the comparison rules, fixing which attributes are extracted from telemetry for each prompt and the mode assigned to each. The configuration is regenerated on demand, so the analytics needs no manual customization and remains robust to prompt and schema drift.

Alignment. Steps are matched by component identity, call index, and parent-span relations where the instrumentation records them. Matching admits gaps in either sequence, so a retried or inserted step does not shift every subsequent position. A position at which the two runs invoke different components is recorded as a structural divergence, and comparison of the pair terminates at the first point where alignment can no longer be established, which is typically a structural divergence.

Instrumentation. A built-in skill captures prompts, responses, execution context, workflow structure, metadata and evaluation results in the standardized representation. For comparison analytics the generated configuration matches each prompt execution to its extraction and comparison rules, so the information needed downstream is captured consistently across every execution.

D

AgMentor Improvement Pipeline

This appendix maps the two inputs and three stages of comparison analytics (Approach section) onto the AgMentor improvement pipeline: Input 1 spans Discovery, Definition of Custom Analytics, and Instrumentation; Input 2 spans Testing and Measurement; Stages 1–2 are realized in Issue De-

Testing. Benchmark suites are executed repeatedly against functional and non-functional requirements, including accuracy, consistency, latency, cost, robustness and policy conformance, while accounting for non-determinism. Comparison analytics draws on accuracy and consistency. For backbone migration the suite runs under each configuration. For self-comparison, repeated execution under one configuration yields both successful and unsuccessful runs of the same task.

Measurement. Raw traces become quantitative assessments, with built-in and custom analytics applied to every execution and KPIs aggregated across repeated runs. For comparison analytics this computes per-task accuracy and consistency, which then gate the analysis. In backbone migration, tasks are eligible for comparison when at least one reference execution succeeds and at least one target execution fails. In self-comparison, tasks are eligible when the same configuration produces both successful and failed executions. Issue Detection. Behaviors associated with degraded performance are identified and prioritized, emitting structured issues with supporting evidence. For comparison analytics this realizes pair selection, alignment and first-divergence detection. Each selected pair is walked step by step and the resulting divergences emitted as issues for diagnosis. Diagnosis and Recommendation Generation. Diagnosis combines execution telemetry, the behavioral model, evaluation results and issue information to explain the patterns responsible for degraded performance. The distinguishing property of comparison analytics here is that it reasons over all issues together rather than pair by pair. Recommendation Generation turns the diagnosed causes into changes that preserve intended functionality, produced within the same diagnosis and recommendation stage, so each cluster arrives with the concrete prompt-level and behavioral changes expected to eliminate its cause. Optimization and Validation. Because a complex system is analyzed by several complementary analytics, Optimization weighs recommendations from all of them against business objectives, balancing accuracy, consistency, latency, cost and implementation effort. Validation re-executes the benchmark suite on the modified system and evaluates it through the same measurement pipeline, so the resulting telemetry confirms that the intended metrics improved without regressions. Partial pipelines. AgMentor can execute complete or partial improvement pipelines, so an individual analytics can be evaluated on its own or in combination with others. This is what allows the contribution of comparison analytics to be assessed in isolation while preserving its integration in the broader workflow, and it is the mode used for the experiments in this paper.

E

Process Prompts

This section collects the artifacts defining each stage of our improvement loop. Pairs of traces for the same task, one successful and one failed, are aligned and compared field by field, yielding a trace-comparison report (Figure 4) that records the first divergence: the earliest disagreeing step, its agent, and the offending fields. The first divergence is the primary signal; later differences are kept as evidence of how it propagates. First divergences are then aggregated across tasks into failure clusters (Figure 5), each with an affected agent, examples, severity, and recommended actions, and consolidated into a comparison report (Figure 7) organized as clusters, root causes, and remediation actions with explicit

cross-references between them. That report is handed to an implementing coding agent using the prompt in Figure 6, which grants full repository access and requires the agent to map each finding to concrete files and functions while explicitly forbidding code changes at this stage, keeping diagnosis separate from repair. Figure 8 shows an excerpt of the resulting plan.

Figure 4: Example Trace-Comparison Report Format. Task: <task description> Successful trace: <trace id> Failed trace: <trace id> Step 1: Successful agent: TaskAnalyzer Failed agent: TaskAnalyzer Field: relevant_apps Successful value: [...] Failed value: [...] Comparison mode: exact_match Result: different First divergence: Agent: TaskAnalyzer Step: 1 Failed fields: relevant_apps Interpretation: incorrect or misspelled app selection

Figure 5: Example Failure-Cluster Record. { "cluster_name": "Shortlister -- Tool misselection and ranking errors", "affected_agent": "Shortlister", "description": "Shortlister selected tools that were related to the task but insufficient for completing the full workflow.", "representative_examples": [ "Wishlist task where product search was selected instead of wishlist retrieval", "Spotify task where playlist listing was selected but update endpoint was omitted" ], "severity": "high", "recommended_actions": [ "Add workflow-aware intent-to-tool mapping", "Require Shortlister to include downstream APIs needed for task completion", "Add reranking based on required fields and workflow prerequisites" ] }

Figure 6: Prompt Given to the Implementing Coding Agent. You are tasked with analyzing a trace analysis report from an <benchmark_name> benchmark run and producing a detailed improvement plan for the CUGA agent codebase. Do NOT make any code changes yet -- only produce a plan. ## Inputs 1. **Trace analysis report:** "Path/to/report" 2. **Trace comparison report:** "Path/to/report" 3. **Prompt used To Compare By:** "Path/to/prompt" 4. **CUGA agent repo:** you have full access to the codebase at "Path/to/repo" ## Your Task ### Step 1 -- Understand the codebase Explore the CUGA agent repo thoroughly. Read the main entry points, agent loop, tool definitions, prompt templates, and any config files. Build a clear mental model of how the agent currently works. ### Step 2 -- Read the report Read the trace analysis report in full. Identify every finding, failure pattern, bottleneck, and recommendation it contains. ### Step 3 -- Cross-reference findings with the code For each finding in the report, locate the exact file(s), function(s), or prompt(s) in the codebase that are responsible. Be specific -- include file paths and line numbers where possible. ### Step 4 -- Produce an improvement plan Write a structured improvement plan as a markdown document saved to ‘improvement_plan.md‘ at the root of the repo. The plan must include: **Executive Summary** A short paragraph summarizing the most impactful changes and the expected overall improvement. **Findings → Root Cause Mapping** A table or list mapping each report finding to its root cause in the code. **Proposed Changes** For each proposed change: - Title and priority (Critical / High / Medium / Low) - Which finding(s) it addresses - Exact files and functions that would be modified - A clear description of what would change and why - Any risks or tradeoffs to be aware of **Recommended Implementation Order** A sequenced list of changes in the order they should be implemented, with a brief rationale for the ordering (e.g. dependencies between changes, highest ROI first). **Out of Scope** Anything the report mentions that you are deliberately not addressing, and why. ## Constraints - No constraints on scope -- you have full freedom to propose any changes you believe will improve the agent. - Do NOT implement any changes. The output of this task is the plan only. - Be specific and actionable. Vague suggestions like "improve prompting" are not acceptable -- every item must reference concrete code locations. - Can’t change configuration

Figure 7: Example Comparison Report on AppWorld. # Failure Clusters ## Premature Shortlister invocation after CodeAgent tool discovery **Severity:** high In the majority of failed traces, after the CodeAgent performs tool discovery (calling ‘find_tools‘), the next step routes to the Shortlister agent instead of the Reflection agent. In successful traces, the CodeAgent’s tool discovery output is first evaluated by the Reflection agent before proceeding. This pattern appears in 12+ comparisons (1, 2, 3, 4, 5, 8, 11, 12, 15, 18, 19, 20) and represents the most common failure mode. **Examples:** - Comparison 1: CodeAgent discovers Gmail tools → Failed goes to Shortlister, Successful goes to Reflection - Comparison 4: CodeAgent discovers Spotify tools → Failed goes to Shortlister, Successful goes to Reflection - Comparison 11: CodeAgent discovers Amazon tools → Failed goes to Shortlister, Successful goes to Reflection - Comparison 19: CodeAgent discovers Supervisor tools → Failed goes to Shortlister, Successful goes to Reflection --## CodeAgent content verbosity difference causing routing divergence **Severity:** high The failed model’s CodeAgent frequently produces different content at the initial tool discovery step. In some cases it outputs explanatory text ("I need to discover...") while the successful model outputs empty or minimal content. In other cases the pattern is reversed. This content difference, while seemingly minor, correlates with downstream agent routing failures (Reflection vs Shortlister). **Examples:** - Comparison 1: Successful trace has empty content, Failed trace has "I need to discover Gmail tools..." - Comparison 4: Successful trace has empty content, Failed trace has "I need to discover Spotify tools..." - Comparison 19: Successful trace has empty content, Failed trace has "We need to discover the Supervisor API tools..." - Comparison 10: Successful trace has descriptive content, Failed trace has empty content --## Incorrect application identification in TaskAnalyzer **Severity:** medium In some tasks, the failed model’s TaskAnalyzer identifies incorrect or missing relevant applications, leading to cascading failures in decomposition and execution. This causes wrong task decomposition structures and incorrect agent routing downstream. **Examples:** - Comparison 7: Failed trace identifies only [’venmo’] instead of [’venmo’, ’phone’], missing the phone app needed for contact resolution - Comparison 9: Failed trace identifies [’amazon’, ’supervisor’] instead of just [’amazon’], adding an unnecessary supervisor dependency - Comparison 14: Failed trace identifies [’file_system’, ’gmail’] instead of [’gmail’, ’file_system’, ’phone’], missing the phone app needed to resolve manager’s email ---

Figure 8: Example Implementation Plan (Partial). ## Recommended Implementation Order 1. **Change #1 -- ‘app_matcher‘ prompt expansion.** Zero code risk, single file, and it’s the root of the highest-severity cascading failure (missing apps → under-decomposition). Ship first and re-run the benchmark to see how much of clusters #1/#2/#7 collapse on their own before investing in the heavier structural validator (#3). 2. **Change #2 -- ‘find_tools‘ bounded timeout + retry.** Independent of #1, addresses a separate high-severity cluster (#3) with a self-contained code change in one helper module. Do this in parallel with #1 since they don’t interact. 3. **Change #4 -- Reflection mandatory pagination check.** Independent, promptonly, addresses cluster #8 directly. Low risk, do early. 4. **Change #3 -- Task Decomposition coverage validator.** Do this *after* #1 ships and is measured -- if #1 alone fixes most missing-app cases, the validator’s retry path will fire rarely, which is the goal (a safety net, not a primary mechanism). Implementing it before measuring #1 makes it harder to isolate which change drove the improvement. 5. **Change #5 -- Shortlister tie-break rule.** Lower confidence of impact; do after the higher-confidence changes land so its effect can be measured in isolation. 6. **Change #6 -- extra Task Decomposition example.** Cheap, do opportunistically alongside #1 (same file family) or defer -- non-blocking. 7. **Change #7 -- investigate loop/retry stall.** Schedule as a research spike once the above changes are in and a fresh trace comparison run is available, since some Comparison-34/39-style cases may already disappear as a side effect of #1/#3. Rationale for this ordering: changes 1, 2, and 4 are independent, low-risk, and each targets a distinct high-severity cluster -- they should ship together and be measured against a fresh benchmark run before adding the heavier validator (#3), so the plan doesn’t conflate "app matching got better" with "the validator’s retry masked a still-broken app matcher."

Related documents

Record · ID 1835995 · SHA-256 ddd9887553ea7527
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Bring this data into your agent: Connect via MCP or API · 20 free credits to start · no card required
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive