INSIGHTS / ARTICLE

Using AI to write GxP test scripts: what the draft Annex 22 allows and what stays with people

Generative AI can produce a first version of a test script in minutes. The draft EU GMP Annex 22 keeps such models out of critical applications and asks for a qualified person to stay responsible for the output everywhere else. What that means for validation teams, and what the reviewer should check.
NOVEMBER 2026 · 6 MIN READ · VALIDATION / AI
By Cezar Babes, founder

Summary. Validation teams are starting to use generative AI to write test scripts from approved requirements. The draft EU GMP Annex 22, published for consultation in July 2025, says generative AI and large language models should not be used in critical GMP applications, and that in non-critical applications qualified staff must always be responsible for checking that the output is fit for its intended use. As of November 2026 the annex is still a draft. Our interpretation is that writing a test script with AI can stay a non-critical use, provided a qualified person reviews and approves every script before it is executed, and the reasoning is written down. This article explains that interpretation and lists what the reviewer should check.

What the draft Annex 22 says

The European Commission, EMA and PIC/S published the draft Annex 22 on artificial intelligence on 7 July 2025, together with drafts of a revised Annex 11 and Chapter 4. The consultation closed on 7 October 2025. The draft covers AI models used in critical applications, meaning applications with a direct impact on patient safety, product quality or data integrity. Within that scope:

  • Only static, deterministic models are covered. A static model is trained before it is deployed and does not change itself during operation; any update is a controlled change, followed by retesting. A deterministic model always gives the same output for the same input.
  • Dynamic models and models with probabilistic output should not be used in critical GMP applications.
  • Generative AI and large language models are outside the annex and should not be used in critical GMP applications.
  • In non-critical applications, staff with adequate qualification and training should always be responsible for ensuring that the output of such models is suitable for the intended use. The draft calls this "human in the loop".

The draft also says that generating test data or labels with generative AI is not recommended and must be fully justified. That clause is written for testing AI models, but the same caution makes sense for the data used in any system test.

Where things stand in November 2026

The annex has not been adopted. The EudraLex Volume 4 page still lists the January 2011 versions of Annex 11 and Chapter 4, and no Annex 22. PIC/S has published no adoption notice. Validation work today is therefore done against the texts in force: the 2011 Annex 11, 21 CFR Part 11 where it applies, and GAMP 5 (second edition). None of these forbids using a writing aid, but all of them expect approved, traceable test documentation that a named person is accountable for. The draft Annex 22 is a clear signal of where inspectors are heading, not law. Our article on CSV regulation in transition covers the wider changes.

Is writing a test script with AI a critical application?

A test script does not touch the product or the patient. What matters is whether the AI output can reach a GMP decision without a qualified person checking it. If every script is reviewed, corrected where needed and approved by a qualified person before execution, the AI is a writing aid: the approved script is the controlled document, and the person who signs it is accountable for it, exactly as if a junior colleague had written the first version.

The picture changes if AI output is used without that step: scripts executed as generated, expected results filled in by the model, or pass and fail decided by the tool. Those uses would put a generative model in the path of a GMP decision, which the draft says should not happen.

This is our interpretation of a draft regulation, not regulatory advice, and an inspector may ask about it. We therefore recommend writing it down: in the validation plan or a short procedure, state which tool is used, for which documents, who reviews and approves, and why the use is non-critical.

What the reviewer checks

Review is where the control sits, so it should be more than a read through. For each AI-written script, the reviewer confirms that:

  • Each test traces to an approved requirement in the current version of the user requirements specification (URS) or functional specification (FS), and every requirement in scope has a test.
  • The depth of testing matches the risk assessment, in line with GAMP 5: more detail for high-risk functions, less for low-risk ones.
  • Expected results are objective, so two testers would record the same result.
  • Every step can be executed on the system as configured, in the version being validated. AI may hallucinate steps for screens, buttons or functions the system does not have.
  • The evidence to capture is defined before execution, for example which screenshot or report proves the step.
  • Test data is chosen by a person, not generated by the model, unless the reason is documented.

Controls around the tool

Requirements and specifications often contain confidential client information. Before AI is used on client documentation, the client should agree which tools are permitted, what information may be entered and how the output is reviewed. The tool itself is not part of the validated system, but its use should be visible: the procedure names it, and the approved script, not the version the AI produced, is the record that counts.

Used this way, AI shortens the time to a first version and helps keep scripts consistent in format. It does not replace knowledge of the system, the risk assessment or the time a qualified reviewer needs.

How we use AI in validation work

We use AI only to speed up the writing of CSV and GxP documents. Every document is reviewed, corrected and signed by a senior consultant before it goes to the client's quality assurance (QA) for approval. We do not build or host AI systems for GxP or other regulated use. For non-GxP purposes, we can build AI tools for clients as a separate project. Our CSV and GxP validation page describes the deliverables we prepare.

This article is a general overview of the draft Annex 22 and the rules in force as of November 2026. It is not regulatory advice. We will update it when Annex 22 is adopted.

Sources

SCALANTO · VALIDATION PRACTICE · ABOUT THE SERVICE →

Discuss a project

If you need support with a project or program, validation, cybersecurity, certification, audit or training, write to us. The first conversation is with a senior consultant, and we will tell you plainly whether and how we can help.

Contact us

Office
Křenová 409/52, 602 00 Brno