Lesson 06 · 45 minutes
Map the EU AI Act to engineering work with a classification table
- Name the roles and the risk classes of the EU AI Act and what each asks an engineer to produce
- Classify a table of systems with rules kept as data
- Compare the declared class of each system with the computed class and find the gaps
The lab folder as it stands after this lesson. Unzip it in ~/krlab.
More
The zip holds every file that the course has printed up to here. To start this lesson with the files of the earlier lessons only, take the zip of the lesson before. Type the code yourself first: you learn more.
Scenario
Harbour Credit offers loans in the European Union. The compliance lead asks a plain question: "Which of our AI systems are in scope of the EU AI Act, in which class, and in which role are we? What must engineering produce for each?" You do not write the legal opinion. You build the table that the lawyers will review: one row for each system, a computed class, a list of artefacts, and a check that the class on file matches the rules.
Recall
Lesson 2: which fields of the inventory does this lesson use first?
The name, the purpose and the data class. Classification starts from what the system is for, and the inventory is the only complete list of systems.
Lesson 1: what is the difference between the owner of a system and its approver?
The owner answers for the system and runs it. The approver decides that it may go live and must not have built it. The Act uses other role words (provider, deployer).
The idea
Sources. This lesson follows Regulation (EU) 2024/1689, called the AI Act, and Regulation (EU) 2026/1744, the "Digital Omnibus on AI", which amends it. The author checked the dates and article numbers against the amended text in November 2026. Take every date and every obligation from the current official text on EUR-Lex, and let your legal people decide what applies to you. The table of rules in this lesson is a teaching model, a first triage.
Roles. The Act defines roles by what an organisation does. A provider develops an AI system, or has one developed, and places it on the market or puts it into service under its own name. A deployer uses an AI system under its own authority, except for personal non-professional use. A deployer is treated as a provider of a high-risk system if it puts its own name on it, changes it substantially, or changes its purpose so that it becomes high-risk (Article 25).
Classes. The Commission describes four risk levels.
A system is high-risk by one of two routes. Route one: it is a safety component of a product, or a product itself, that falls under the EU product laws listed in Annex I and needs a third-party conformity assessment (Article 6(1)). Route two: it is used in one of the areas of Annex III (Article 6(2)): biometrics, critical infrastructure, education and training, employment and workers' management, access to essential private and public services (this includes assessing the creditworthiness of people), law enforcement, migration, asylum and border control, and the administration of justice and democratic processes. An Annex III system is not high-risk when it does not pose a significant risk of harm, for example when it only does a narrow procedural task, but never when it profiles people, and the provider must document that assessment before the system goes live (Article 6(3) and (4)).
Dates. Dates changed with the Omnibus, which is a reason to read the current text. Article 113 now says this. The prohibitions of Article 5 apply from 2 February 2025. The Act applies in general from 2 August 2026. The duties for high-risk systems of Annex III start on 2 December 2027, and for systems under the Annex I product laws on 2 August 2028. Two new prohibitions, Article 5(1) points (ba) and (bb), cover AI systems that make realistic images, video or audio of the intimate parts of an identifiable person without consent, and AI systems that make material that Directive 2011/93/EU covers (child sexual abuse material). Article 5(1a) and (1b) say when these two bans bite. The rules file flags only the practice, so a lawyer must read both paragraphs. Article 111(4) gives providers of generative systems that were on the market before 2 August 2026 until 2 December 2026 to comply with the marking duty of Article 50(2).
What an engineer produces. For a provider of a high-risk system, the Act asks for nine artefacts. For a deployer it asks for five duties (Articles 26 and 27), among them human oversight by competent people and the logs that it controls. The rules file in step 1 lists each duty with its article. For transparency risk, providers make sure that people know they talk to an AI, and mark generated content (Article 50). Providers and deployers must also take measures that support AI literacy of their staff (Article 4).
Worked example
Work in ~/krlab/ai-governance with the environment on.
1. Save the rules as data
The rules are a JSON file, so that a lawyer can read and change them, and the code stays the same. Each class has a start date and the artefacts for each role. The source line says where the rules come from, and that they must be checked.
aiact_rules.json
{
"source": "Regulation (EU) 2024/1689 as amended by Regulation (EU) 2026/1744. Check the current text on EUR-Lex.",
"prohibited_practices": ["social_scoring", "untargeted_face_scraping", "emotion_inference_at_work"],
"prohibited_practices_2026_12_02": ["non_consensual_intimate_imagery", "child_abuse_material"],
"annex_iii_areas": ["biometrics", "critical_infrastructure", "education", "employment", "essential_services",
"law_enforcement", "migration_border", "justice_democracy"],
"classes": {
"prohibited": {"from": "2025-02-02", "provider": ["do not place on the market or use (Article 5)"],
"deployer": ["do not use (Article 5)"]},
"prohibited-2026-12-02": {"from": "2026-12-02", "same_duties_as": "prohibited"},
"high-risk-annex-iii": {"from": "2027-12-02",
"provider": ["classification record (Article 6)", "risk management system (Article 9)",
"data governance (Article 10)", "technical documentation (Article 11, Annex IV)",
"automatic logging (Article 12)", "instructions for deployers (Article 13)",
"human oversight by design (Article 14)", "accuracy, robustness, cybersecurity (Article 15)",
"quality management system (Article 17)"],
"deployer": ["use as the instructions say (Article 26)", "give oversight to competent people (Article 26)",
"monitor, and report risks and incidents (Article 26)", "keep the logs you control (Article 26)",
"fundamental rights impact assessment, for some deployers (Article 27)"]},
"high-risk-annex-i": {"from": "2028-08-02", "same_duties_as": "high-risk-annex-iii"},
"exempt-documented": {"from": "2027-12-02",
"provider": ["write down why the system is not high-risk, before it goes live (Article 6)",
"register the system in the EU database (Article 49(2))"], "deployer": []},
"transparency": {"from": "2026-08-02",
"provider": ["tell people they talk to an AI, and mark generated content (Article 50)"],
"deployer": ["check which Article 50 duties apply to your use"]},
"minimal": {"from": "", "provider": [], "deployer": []}
}
}2. Save the table of systems
Each system has a role, an area, a prohibited practice or none, and four y or n answers that the rules need: is it an Annex I product, a narrow task, does it profile people, does it talk to people or make content. annex_i_product is y only when the system is, or is a safety component of, a product under Annex I law that needs a third-party conformity assessment (Article 6(1)). Article 6(1a) to (1c) say what counts as a safety component, so ask your legal team before you answer y. The last column, declared, holds the class that the team has written down.
systems.csv
id,name,role,area,practice,annex_i_product,narrow_task,profiling,talks_to_people,makes_content,declared
S1,LoanScore,provider,essential_services,none,n,n,y,n,n,high-risk-annex-iii
S2,HelpBot,provider,none,none,n,n,n,y,y,transparency
S3,Nova Chat,deployer,none,none,n,n,n,n,n,minimal
S4,CodePal,deployer,none,none,n,n,n,n,n,minimal
S5,DocCheck,provider,essential_services,none,n,y,n,n,n,exempt-documented3. Write the classifier
next(...) takes the first match. The function returns a class name and gives the same answer for the same input, so a test can check it. The first matching rule wins, as the drawing shows. A real system can be in two classes at once, so a real review lists all the duties. "y" in (a, b) is true when either value is y.
- Prohibited practice? → Annex I product?: not prohibited, ask next
- Annex I product? → Annex III area?: not an Annex I product, ask next
- Annex III area? → Talks, makes content?: not in an Annex III area, ask next
- Talks, makes content? → Minimal: it does neither, so minimal
A yes at any box ends the test with the class that the box names: prohibited (the first box asks about both lists of practices), high-risk-annex-i, high-risk-annex-iii or exempt-documented, and transparency.
classify.py
"""classify.py: a first triage of AI systems into the risk classes of the EU AI Act. It is not legal advice.
python3 classify.py report systems.csv aiact_rules.json
python3 classify.py check systems.csv aiact_rules.json
python3 classify.py duties systems.csv aiact_rules.json LoanScore
"""
import csv
import json
import sys
from govlib import finish
def classify(row, rules):
"""The first matching class. The rules are data in aiact_rules.json, not code."""
if row["practice"] in rules["prohibited_practices"]:
return "prohibited"
if row["practice"] in rules["prohibited_practices_2026_12_02"]:
return "prohibited-2026-12-02"
if row["annex_i_product"] == "y":
return "high-risk-annex-i"
if row["area"] in rules["annex_iii_areas"]:
exempt = row["narrow_task"] == "y" and row["profiling"] != "y"
return "exempt-documented" if exempt else "high-risk-annex-iii"
if "y" in (row["talks_to_people"], row["makes_content"]):
return "transparency"
return "minimal"
def duties(class_name, role, rules):
entry = rules["classes"][class_name]
return rules["classes"][entry.get("same_duties_as", class_name)][role]
def load(path):
with open(path, newline="") as f:
return list(csv.DictReader(f))
def problems(path, rules):
found = []
for row in load(path):
got = classify(row, rules)
if row["declared"] != got:
found.append(f"{row['name']}: declared {row['declared']}, the rules say {got}")
return found
if __name__ == "__main__":
with open(sys.argv[3]) as f:
rules = json.load(f)
if sys.argv[1] == "check":
finish(problems(sys.argv[2], rules))
if sys.argv[1] == "duties":
row = next(r for r in load(sys.argv[2]) if r["name"] == sys.argv[4])
name = classify(row, rules)
print(f"{row['name']} is a {row['role']} of a system in class {name}. To produce:")
print("\n".join(" " + duty for duty in duties(name, row["role"], rules)))
sys.exit(0)
for row in load(sys.argv[2]):
name = classify(row, rules)
todo = duties(name, row["role"], rules)
start = rules["classes"][name]["from"] or "-"
print(f"{row['name']:<15}{row['role']:<10}{name:<22}{start:<12}duties {len(todo)}")python classify.py report systems.csv aiact_rules.jsonLoanScore provider high-risk-annex-iii 2027-12-02 duties 9
HelpBot provider transparency 2026-08-02 duties 1
Nova Chat deployer minimal - duties 0
CodePal deployer minimal - duties 0
DocCheck provider exempt-documented 2027-12-02 duties 2Every provider and deployer, in every class, also owes measures that support AI literacy (Article 4), so "duties 0" does not mean that nobody has work to do.
LoanScore is in Annex III because it assesses creditworthiness, and it profiles people, so the narrow-task exception cannot apply. HelpBot talks to people. DocCheck is in an Annex III area but only checks that files are complete, so its provider must document why it is not high-risk and register the system in the EU database. The start date of that registration is a question for legal. Nova Chat and CodePal are deployer-side tools with no rule that bites.
4. List what engineering must produce
python classify.py duties systems.csv aiact_rules.json LoanScoreLoanScore is a provider of a system in class high-risk-annex-iii. To produce:
classification record (Article 6)
risk management system (Article 9)
data governance (Article 10)
technical documentation (Article 11, Annex IV)
automatic logging (Article 12)
instructions for deployers (Article 13)
human oversight by design (Article 14)
accuracy, robustness, cybersecurity (Article 15)
quality management system (Article 17)Each line is an artefact. The risk register (lesson 3) feeds the risk management system, the fairness test (lesson 4) feeds the bias examination, the explanation records (lesson 5) are logs, the model card and data sheet (lesson 10) feed the technical documentation, and the RACI table and oversight rule (lesson 7) support oversight. These files help to produce evidence. They do not make a system compliant.
5. Check the declared class, and test a pitch
check compares the declared class with the computed one. In sed, a ^ at the start of a pattern means "at the start of the line" and a $ at the end means "at the end of the line". Break one row, then test a vendor's pitch for a tool that builds a face database by scraping photos.
python classify.py check systems.csv aiact_rules.json
sed 's/transparency$/minimal/' systems.csv > broken.csv
python classify.py check broken.csv aiact_rules.json
cp systems.csv pitch.csv
echo "S9,PhotoFinder,deployer,none,untargeted_face_scraping,n,n,n,n,n," >> pitch.csv
python classify.py report pitch.csv aiact_rules.json | tail -1problems: 0
PROBLEM HelpBot: declared minimal, the rules say transparency
problems: 1
PhotoFinder deployer prohibited 2025-02-02 duties 1Your turn
Seven new systems wait for a class: save the table as systems-new.csv. The declared column is empty on purpose. There are no steps: use your tool.
systems-new.csv
id,name,role,area,practice,annex_i_product,narrow_task,profiling,talks_to_people,makes_content,declared
N1,RotaPlan,provider,employment,none,n,n,y,n,n,
N2,TutorPal,provider,education,none,n,n,n,y,y,
N3,MoodWatch,deployer,employment,emotion_inference_at_work,n,n,n,n,n,
N4,ArmGuard,provider,none,none,y,n,n,n,n,
N5,FormFiller,provider,none,none,n,n,n,n,y,
N6,SpamSift,deployer,none,none,n,n,n,n,n,
N7,CvFormat,provider,employment,none,n,y,n,n,n,Last, take one row where you doubt the answer of the rules (for example TutorPal, which also talks to students) and write what a lawyer should look at.
Check yourself
Why is the class decided by rules in a data file and not by a model or by hand?
A rule file gives the same answer for the same facts, and every change shows in a diff. A person can still override a result, but the override must be a recorded decision, not a silent edit.
Harbour Credit uses a hosted language model through an API to build HelpBot. Which role does it take for HelpBot?
Most likely provider of HelpBot, because it puts HelpBot into service under its own name. The company that makes the model has its own role. Write the role down for each system and ask your legal people to confirm it.
DocCheck is "exempt-documented". What must still happen?
The provider must document why the system is not high-risk before the system goes live (Article 6(4)), and must register itself and the system in the EU database (Article 49(2)). The exception is a claim, and the record is the evidence.
The dates in `aiact_rules.json` are right today. What would you do to keep them right?
Name the source in the file, as the source line does, give the file an owner and a review date (lesson 8), and read the current text before each use.
Field notes
- Classify at the start of a project, and again when the purpose changes. Article 25 says that a change of intended purpose can turn a system into a high-risk one, and the role can change with it.
- Keep the classification record: the facts, the rule or article that applied, the date, the person. For a system that you think is not high-risk, it is the Article 6(4) assessment.
- The prohibitions already apply, and two more start on 2 December 2026. Check the list of Article 5 against your inventory (lesson 2) and against vendor pitches. A tool that infers emotions of employees, or scores people on social behaviour, belongs on that list.
- General-purpose AI models have their own chapter (Chapter V), and a high-risk system also needs a conformity assessment, a declaration of conformity, the CE marking and registration (Article 16). This lesson covers systems. A script prepares evidence for these steps and does not replace them. Whether your company is a provider of such a model is a question for your lawyers.