When the Trigger Fails: Metamorphic Testing of Tool-Calling AI Agents
Resumo
Software agents built on foundation models depend on the prompt, the Trigger component, as their primary instruction interface, yet this component appears in roughly 1% of the test cases across the agent ecosystem. Recent literature calls for metamorphic testing of prompt behavior, but that call remains unanswered for the agentic case. We propose and evaluate a catalog of metamorphic relations over the Trigger, under the premise that transformations preserving the meaning of the prompt (paraphrase, typing noise, and language switching) should not alter the agent’s behavior, defined by the selected tool and its arguments; when they do, a silent behavioral regression is revealed. Across 1,600 controlled invocations of two open models run locally, over 40 tool-calling tasks with five runs each, violations prove prevalent and strongly concentrated in language switching (English→Portuguese), which alters behavior in up to 41% of the tasks against fewer than 11% for paraphrase and noise; the inconsistency falls chiefly on the arguments rather than on the selected tool; and the test discriminates between the two configurations evaluated (Wilcoxon, 𝑝 = 0.025), even after discounting an intrinsic flakiness affecting about 30% of the tasks. We release a reproducible framework with the relations, the data, and the analysis scripts, along with guidelines for integrating prompt regression testing into the development workflow.
Referências
Florian Angermeir, Maximilian Amougou, Mark Kreitz, Andreas Bauer, Matthias Linhuber, Davide Fucci, Fabiola Moyón C., Daniel Mendez, and Tony Gorschek. 2025. Reflections on the Reproducibility of Commercial LLM Performance in Empirical Software Engineering Studies. arXiv:2510.25506 [cs.SE] [link]
Berk Atil, Sarp Aykent, Alexa Chittams, Lisheng Fu, Rebecca J. Passonneau, Evan Radcliffe, Guru Rajan Rajagopal, Adam Sloan, Tomasz Tudrej, Ferhan Ture, Zhe Wu, Lixinyu Xu, and Breck Baldwin. 2025. Non-Determinism of "Deterministic" LLM Settings. arXiv:2408.04667 [cs.CL] [link]
T. Y. Chen, S. C. Cheung, and S. M. Yiu. 2020. Metamorphic Testing: A New Approach for Generating Next Test Cases. arXiv:2002.12543 [cs.SE] [link]
Tsong Yueh Chen, Fei-Ching Kuo, Huai Liu, Pak-Lok Poon, Dave Towey, T. H. Tse, and Zhi Quan Zhou. 2018. Metamorphic Testing: A Review of Challenges and Opportunities. ACM Comput. Surv. 51, 1, Article 4 (Jan. 2018), 27 pages. DOI: 10.1145/3143561
Zhenpeng Chen, Chong Wang, Weisong Sun, Xuanzhe Liu, Jie M. Zhang, and Yang Liu. 2026. Promptware Engineering: Software Engineering for Prompt-Enabled Systems. arXiv:2503.02400 [cs.SE] [link]
Steven Cho, Stefano Ruberto, and Valerio Terragni. 2025. LLMorph: Automated Metamorphic Testing of Large Language Models. In 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 4102–4105. DOI: 10.1109/ase63991.2025.00385
Steven Cho, Stefano Ruberto, and Valerio Terragni. 2025. Metamorphic Testing of Large Language Models for Natural Language Processing. In 2025 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 174–186. DOI: 10.1109/icsme64153.2025.00025
I. de Zarzà, J. de Curtò, Jordi Cabot, Pietro Manzoni, and Carlos T. Calafate. 2026. Semantic Invariance in Agentic AI. arXiv:2603.13173 [cs.AI] [link]
Aayush Gupta. 2026. ReliabilityBench: Evaluating LLM Agent Reliability Under Production-Like Stress Conditions. arXiv:2601.06112 [cs.AI] [link]
Hassan Hamad, Yingru Xu, Liang Zhao, Wenbo Yan, and Narendra Gyanchandani. 2025. ToolCritic: Detecting and Correcting Tool-Use Errors in Dialogue Systems. arXiv:2510.17052 [cs.AI] [link]
Mohammed Mehedi Hasan, Hao Li, Emad Fallahzadeh, Gopi Krishnan Rajbahadur, Bram Adams, and Ahmed E. Hassan. 2026. An Empirical Study of Testing Practices in Open Source AI Agent Frameworks and Agentic Applications. arXiv:2509.19185 [cs.SE] [link]
Andong Hua, Kenan Tang, Chenhe Gu, Jindong Gu, Eric Wong, and Yao Qin. 2025. Flaw or Artifact? Rethinking Prompt Sensitivity in Evaluating LLMs. arXiv:2509.01790 [cs.CL] [link]
Shehroz Khan, Abdullah Mughees, Gaadha Sudheerbabu, Tanwir Ahmad, and Dragos Truscan. 2026. Multi-Agent LLM-based Metamorphic Testing for REST APIs. arXiv:2605.28321 [cs.SE] [link]
Shishir G Patil, Huanzhi Mao, Fanjia Yan, Charlie Cheng-Jie Ji, Vishnu Suresh, Ion Stoica, and Joseph E. Gonzalez. 2025. The Berkeley Function Calling Leaderboard (BFCL): From Tool Use to Agentic Evaluation of Large Language Models. In Forty-second International Conference on Machine Learning. [link]
Harishwar Reddy, Madhusudan Srinivasan, and Upulee Kanewala. 2025. Metamorphic Testing for Fairness Evaluation in Large Language Models: Identifying Intersectional Bias in LLaMA and GPT. arXiv:2504.07982 [cs.CL] [link]
Angelika Romanou, Mark Ibrahim, Candace Ross, Chantal Shaib, Kerem Oktar, Samuel J. Bell, Anaelia Ovalle, Jesse Dodge, Antoine Bosselut, Koustuv Sinha, and Adina Williams. 2026. Brittlebench: Quantifying LLM robustness via prompt sensitivity. arXiv:2603.13285 [cs.LG] [link]
Channdeth Sok, David Luz, and Yacine Haddam. 2025. MetaRAG: Metamorphic Testing for Hallucination Detection in RAG Systems. arXiv:2509.09360 [cs.CL] [link]
Shunyu Yao, Noah Shinn, Pedram Razavi, and Karthik Narasimhan. 2024. 𝜏-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. arXiv:2406.12045 [cs.AI] [link]
Jiayi Yuan, Hao Li, Xinheng Ding,Wenya Xie, Yu-Jhe Li,Wentian Zhao, KunWan, Jing Shi, Xia Hu, and Zirui Liu. 2025. Understanding and Mitigating Numerical Sources of Nondeterminism in LLM Inference. arXiv:2506.09501 [cs.CL] [link]
Zheng Zheng, Zenghui Zhou, Yinwang Xu, Daixu Ren, and Tsong Yueh Chen. 2026. Bidirectional Empowerment of Metamorphic Testing and Large Language Models: A Systematic Survey. arXiv:2605.13898 [cs.SE] [link]
