arXiv:2611.03231cs.SENov 2026

Manuscript Offprint

arXiv:2611.03231

Specification-Driven Governance for Fairness-by-Design in Agentic Software Engineering: How Far Can We Go?

Alfonso Cannavale, Alessandra Parziale, Valeria Pontillo, Patrizio Pelliccione, Andrea De Lucia, Fabio Palomba

ALFONSO CANNAVALE, Software Engineering Lab - University of Salerno, Italy

ALESSANDRA PARZIALE, Gran Sasso Science Institute, Italy

VALERIA PONTILLO, Gran Sasso Science Institute, Italy

PATRIZIO PELLICCIONE, Gran Sasso Science Institute, Italy

ANDREA DE LUCIA, Software Engineering Lab - University of Salerno, Italy

FABIO PALOMBA, Software Engineering Lab - University of Salerno, Italy

Agentic AI is shifting developers' responsibilities from software implementation to software governance. While this paradigm improves productivity, it also raises challenges in ensuring that autonomous coding agents preserve developers' intentions. Among these, operationalizing fairness-by-design is largely unexplored, as existing approaches provide limited support for representing and propagating fairness requirements throughout agentic development workflows. In this paper, we investigate whether specification-driven development can operationalize fairness-by-design in the agentic development of machine learning systems. We study three coding agents on four machine learning applications, using four prompts that progressively operationalize fairness through nine Fairness Specification Elements, and analyze the traceability of fairness requirements across the generated artifacts, the fairness-accuracy trade-off of the resulting models, and the agents' design decisions and rationales. The results show that when fairness is operationalized, agents capture almost all fairness requirements in the specification (97.22%) and preserve most of them in the code (82.41%). However, the resulting models are not significantly fairer, as agents implement fairness as a post-hoc audit that neither shapes training nor prevents model delivery. Specifications thus make fairness traceable, but not enforceable, calling for fairness specifications that state what agents should do when requirements are not met, and for workflows that make the fairness decisions agents delegate to developers explicit.

Additional Key Words and Phrases: Fairness-by-Design; Agentic Software Engineering; Semi-Formal Specifications; Machine Learning Fairness; Empirical Software Engineering.

1 Introduction

Artificial Intelligence (AI) is reshaping software engineering through agentic AI systems, which autonomously plan and execute development tasks and interact with external tools with limited human intervention [33, 50, 66]. As development is delegated to these agents, developers increasingly govern, rather than implement, the resulting software [20]. Although this shift improves productivity [32, 44, 54], delegating engineering decisions to agents raises concerns about the trust-worthiness of the resulting software [27, 43, 47, 53, 60]. These concerns are increasingly recognized as a governance problem: for instance, 92% of organizations report governance challenges associated with AI-generated code [25], suggesting that the next frontier of agentic software engineering lies not in generating code autonomously, but in governing the agents that generate it [17].

Among the various governance challenges surrounding AI-generated software, responsible AI has emerged as a major research and industrial priority [45]. Responsible AI advocates the development of AI systems that are transparent, accountable, trustworthy, privacy-preserving, sustainable, and fair [31]. Among these principles, fairness, i.e., the absence of systematic and unjustified discrimination toward individuals or groups affected by algorithmic decisions, is particularly challenging to put into practice because it is inherently context-dependent [40, 41], often subjective [16], and

Authors' Contact Information: Alfonso Cannavale, Software Engineering Lab - University of Salerno, Fisciano, Italy, acannavale@unisa.it; Alessandra Parziale, Gran Sasso Science Institute, L'Aquila, Italy, alessandra.parziale@gssi.it; Valeria Pontillo, Gran Sasso Science Institute, L'Aquila, Italy, valeria.pontillo@gssi.it; Patrizio Pelliccione, Gran Sasso Science Institute, L'Aquila, Italy, patrizio.pelliccione@gssi.it; Andrea De Lucia, Software Engineering Lab - University of Salerno, Fisciano, Italy, adelucia@unisa.it; Fabio Palomba, Software Engineering Lab - University of Salerno, Fisciano, Italy, fpalomba@unisa.it.

characterized by multiple, sometimes incompatible, formal definitions [10, 34, 56, 59]. Moreover, fairness concerns may arise throughout the machine learning lifecycle [51, 52], making fairness a challenging software engineering problem [22].

To address this challenge proactively, research has promoted the vision of fairness-by-design [4, 7], inspired by the shift-left principle originally introduced in software security [29]: rather than treating fairness as a property to verify after model development, fairness considerations should be embedded from the earliest development stages. Most existing techniques, however, act on the model or its data rather than on the development process that produces them, as in the case of fairness-aware learning algorithms [12, 61], bias mitigation techniques [11, 58, 64], and fairness testing frameworks [13, 30, 35, 42]. Requirements engineering research has started to address this gap with approaches for eliciting and specifying fairness requirements [5, 6, 21], but these approaches mainly support developers in identifying fairness concerns, not in carrying them through development. In agentic development, this gap is critical: once fairness requirements are elicited, it is unclear how they should be represented in the specification artifacts that guide coding agents, and how they can be propagated as agents refine these artifacts into executable code.

In this context, we argue that specification-driven development [39] offers a promising foundation for addressing this challenge. Rather than directly translating a natural-language request into executable code, a specification-driven workflow progressively refines developers' intent through a sequence of intermediate artifacts, including structured specifications, implementation plans, and executable development tasks, that explicitly capture design decisions before implementation begins. Recent frameworks, such as SPECKIT,¹ embody this paradigm by explicitly structuring the interaction between developers and coding agents. Thus, these artifacts enable fairness requirements to be documented, refined, and propagated throughout development.

© Goal. In this work, we investigate whether specification-driven workflows can operationalize fairness-by-design by transforming abstract fairness requirements into explicit, assessable, and traceable development artifacts capable of guiding autonomous coding agents. We study this problem in the context of agentic development of machine learning systems, where preserving fairness requirements throughout the development process is essential to obtaining fair models.

Specifically, we investigate whether the SPECKIT workflow enables coding agents to preserve fairness requirements across specification, planning, and implementation, and how these requirements influence the resulting machine learning pipelines. We hypothesize that making fairness explicit and measurable in semi-formal specifications reduces ambiguity, improves intent preservation, and enhances the transparency and auditability of agentic decisions. We further examine whether these improvements lead to fairer machine learning models.

To evaluate this hypothesis, we design four representative development scenarios corresponding to increasing levels of fairness expressiveness. The first represents a baseline in which fairness is absent from the developer request. The second introduces fairness only implicitly, requiring the agent to infer relevant fairness concerns from the application context. The third explicitly requests fairness while leaving its interpretation to the agent. Finally, the fourth operationalizes fairness through nine Fairness Specification Elements (FSEs), which we derive from the requirements engineering literature on fairness and which define the information required to specify fairness, from the affected subjects and protected attributes to the fairness metrics and acceptance thresholds used to assess it. This progression allows us to isolate the contribution of fairness awareness, explicitness, and operationalization in guiding agent behavior.

¹The SPECKIT toolkit: https://github.com/github/spec-kit.

Specification-Driven Governance for Fairness-by-Design in Agentic Software Engineering: How Far Can We Go?

3

Our empirical evaluation involves three state-of-the-art coding agents tasked with developing machine learning solutions for four representative application domains, using the ADULT INCOME, COMPAS, DIABETES, and BANK MARKETING datasets. We assess the effectiveness of specification-driven governance from three complementary perspectives. First, we investigate process-level governance by measuring fairness traceability, namely the extent to which fairness-related information introduced in the original request is preserved across the specifications, implementation plans, and source code generated by the agents. Second, we investigate outcome-level governance by evaluating whether preserving fairness intent throughout the development process translates into fairer machine learning models while maintaining predictive performance. Third, we examine design decisions and rationales by combining a static analysis of the generated code with the manual coding of the code and design documents, to understand how agents implement fairness requirements and why they make the decisions they make.

Our results show that specification-driven workflows govern development, but not its outcome. When fairness is explicitly operationalized, agents capture nearly all requirements in specifications (97.22%) and preserve most in source code (82.41%), while domain context alone has little effect. Losses occur mainly during planning and task generation, affecting fairness intent more than quantitative criteria. Yet, preservation does not yield fairer models, with no significant differences in predictive performance or group fairness across prompt levels. Agents treat fairness as a post-hoc audit, adopting neither established mitigation techniques nor checks that block delivery when requirements are unmet. Although acknowledging these limitations, they defer responsibility to human reviewers. Thus, specifications make fairness traceable and verifiable, but not enforceable unless they also define how agents should respond to unmet requirements.

To sum up, this paper provides the following contributions.

  • To the best of our knowledge, the first empirical study on how fairness operationalization affects the preservation of fairness requirements across agent-generated artifacts and the performance and fairness of the resulting models.
  • A characterization of how coding agents implement fairness requirements and justify their decisions, showing that they treat fairness as a post-hoc audit and delegate fairness decisions to human reviewers.
  • A replication package with prompts, generated artifacts, annotations, coding sheets, and analysis scripts [9].

References (15)