Lesson 6.3 · 8 min read · about 55 min to master at a very slow pace

Security, Privacy and Compliance

What European clients will ask before signing: where data goes, whether it is used for training, how personal data is handled under GDPR, what the EU AI Act requires of a chatbot, and the security basics for an LLM system.

Not startedJump to quiz

The questions every client asks

  1. Where does our data go? Which provider, which region, which sub-processors.
  2. Is it used to train models? Business API terms usually say no by default; confirm in the contract.
  3. How long is it kept? Provider retention (some offer zero data retention for eligible use) and your own logs.
  4. Who can see it? Access controls, on both your side and the provider's.

Have written answers ready. They often decide the deal more than the demo does.

GDPR in practice

  • The client is usually the controller; you and the LLM provider are processors. Sign a data processing agreement (DPA), and check the provider's DPA and sub-processor list.
  • Transfers outside the EU need a legal basis (for example an adequacy decision or standard contractual clauses). EU-region hosting simplifies this.
  • Data minimisation: send the model only what the task needs. Redact or pseudonymise personal data (names, emails, IDs) where the task allows.
  • Retention: decide how long prompts, answers and logs are kept, and delete on schedule. Logs full of user questions are personal data.
  • Rights: be able to find and delete a person's data (including in agent memory and eval samples) on request.

The EU AI Act, briefly

The AI Act sorts systems by risk. Most business assistants (internal search, support chat, document drafting) are not high-risk, but carry transparency duties: people must be told they are interacting with an AI system, and AI-generated content may need to be marked as such. Systems used in areas such as hiring, credit scoring or access to essential services can be high-risk, with much heavier obligations (risk management, documentation, human oversight, logging). Identify the category early, and involve the client's legal team for anything near the high-risk list.

This is not legal advice

Your job as the engineer is to know these questions exist, design so the answers are good, and get the client's legal or data protection officer involved. Do not tell a client "it's GDPR compliant" on your own authority.

Security basics

  • API keys in a secrets manager, never in code, prompts or the browser. Separate keys per environment and client.
  • Permission-aware retrieval (lesson 3.4) and least-privilege tools (lesson 4.4).
  • Treat model output as untrusted input: escape it before rendering, never execute it directly as code or SQL.
  • Input limits and rate limits against abuse; monitoring for unusual usage.
  • Test the system with adversarial prompts (jailbreaks, injections) before launch, and keep those tests in the eval suite.

Stuck? Common doubts

Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.

First passIs self-hosting an open-weight model safer for privacy?

It keeps data inside infrastructure you control, which some clients require. But you then own the security, uptime, scaling and model updates, and open models may score lower on your evals. Often an EU-hosted commercial API with a DPA and no-training terms meets the requirement at lower total cost. Decide from the client's actual constraints.

Going deeperDo we need to tell users their questions are logged?

Yes. Logging is processing of personal data when questions can identify or concern people. State it in the privacy notice, with purpose (quality and safety), retention period and rights. Log only what you need; question text without user identity is often enough for quality work.

Cheatsheet

Client data questions

Where does data go? Used for training? How long kept? Who can see it? Have written answers.

GDPR checklist

DPA with provider, lawful transfers (EU region helps), minimise and redact, retention schedule, deletion on request.

EU AI Act for assistants

Most business assistants: transparency (users know it is AI). Hiring, credit, essential services: possibly high-risk.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1conceptUnder GDPR, in a typical client project, what role does the LLM provider usually have?
Q2applyA support assistant only needs the issue description, but tickets include names, emails and phone numbers. What should you do?
Q3conceptWhat does the EU AI Act typically require of a customer support chatbot?
Q4diagnoseA chat UI renders model output as raw HTML. A crafted document makes the model emit a script tag that runs in users' browsers. What principle was broken?
Q5applyA client asks, "Is your system GDPR compliant?" What is the professional answer?