Privacy, ethics and safety

Part 1: Getting started

Introduction to agentic AI

About this lecture

From the next unit on, you work on your own project, with your own files. Before that, you need to know what happens to a file when the agent reads it, which files you may give it, and how to keep the agent from damaging anything on your computer.

  • When the agent reads a file, its contents are sent to the provider’s servers. What happens there depends on your plan and settings.
  • Data comes in classes: public, internal, personal, sensitive personal, confidential. The class decides what you may do. Some material, such as proposals you review, never goes to an AI tool.
  • You can often build on fake data and run the finished script on the real data yourself, without the agent.
  • You are responsible for what the agent produces, and for disclosing that you used it.
  • Keep the agent in one project folder, on copies, with permissions you understand, and with no passwords in reach.

This is a concept and decision unit. It ends with choosing your own project. How to brief the agent well comes in Delegating well; the project’s folder structure in Organising a project for an agent; the undo button in Git as undo button.

A teacher wants a grade report from last year’s exam file

A sensible task for an agent: read the spreadsheet, write a script, make plots of the grade distribution per question. But the file holds names, ID numbers, emails and a note column that hints at health. Should the agent read it?

When the agent reads a file, the file’s contents leave your computer

The agent program runs on your computer, but the model runs on the provider’s servers. Everything the model needs to see is sent there: your prompt, every file the agent opens, and the output of every command it runs.

What the provider does with your data depends on your plan and settings

  • On personal plans, whether your sessions may train future models depends on a setting, and the retention period depends on that setting too.
  • On business and education plans, the institution signs a contract; by default the data is not used for training.
  • Plans and policies change. Read the provider’s pages, not this slide, before you make a decision.

Turn training off on a personal account, but do not mistake it for permission

Turning the training setting off is good practice. It does not turn a personal plan into an approved tool for personal data: the data still goes to the provider and is still stored for a while.

Data comes in classes, and the class decides what you may do

Personal data is anything about a person who can be identified

Under the GDPR, personal data is any information relating to an identifiable person. For a teacher or researcher that includes:

  • student names, ID numbers, grades, exam answers
  • email lists, course rosters, group assignments
  • photos and recordings of people
  • free-text course evaluations (people write about themselves and others)
  • interview transcripts, survey responses with background questions

It does not need a name. A rare combination (age, programme, home town) can be enough.

What this means for the agent

  • Sending personal data to a provider is processing it. Your university needs a legal basis and, usually, a data processing agreement with that provider.
  • A personal plan has no such agreement with your university.
  • So: personal data goes only into a tool your university has approved for it, and only as much as the task needs.

Sensitive personal data needs explicit approval, and usually stays out

Special categories (GDPR article 9):

  • health and patient data
  • racial or ethnic origin
  • genetic and biometric data
  • religion or beliefs, political opinions
  • sexual orientation, trade union membership

Research on such data in most EU countries also needs an ethics approval that says where the data may be stored and processed.

In practice

  • Patient records, clinical trial data, genotypes linked to people, health notes in a student file: not into a general AI tool, unless your university and the ethics approval explicitly allow it.
  • “The agent only needs it to write a script” is not an exception.
  • Use a synthetic stand-in instead (next slides).

Material you review in confidence must never go to an AI tool

Manuscripts and grant proposals sent to you for review belong to their authors. Funders and journals forbid uploading them, in part or whole, to AI tools. This holds even with training off.

Your own unpublished work and exam drafts need precautions, not a ban

Material Risk Precaution
Your unpublished results Kept by the provider for a while; on personal plans possibly used for training Training off or institutional plan; check co-authors agree
Exam questions before the exam Leak before the exam; later, in a public repository Training off; keep the folder private (also on GitHub in Part 3)
Data under a contract or NDA (industry partner, data use agreement) The contract may forbid third-party processing Read the contract; ask the partner if unclear
Code or data from a collaborator Not yours to decide Ask first

Your university’s rules come before your own judgement

Find your university’s AI policy and its list of approved tools. If something is unclear, ask your data protection officer or IT, before you start, not after.

The EU AI Act matters less to your daily work than GDPR does, for now

  • The AI Act regulates AI systems by risk. Most of what we do in this course, scripts, figures, literature tables, is low risk.
  • Education is a named high-risk area: AI used for admission, grading, or monitoring students during exams faces strict requirements. Do not build an agent pipeline that grades students or decides admissions.
  • Organisations that use AI must ensure AI literacy among their staff. This course is part of that.
  • The rules are being phased in. Your university will translate them into its policy, which is the document to follow.

GDPR is the law that applies to almost every file with people in it, today.

One flowchart answers most “May I give this to the agent?” questions

Build the script on fake data, then run it on the real data yourself

The agent needs the structure (column names, types, value ranges, quirks), not the content. Give it a synthetic stand-in, let it write and test the script, then run the script on the real file yourself, with the agent closed.

Write the stand-in from a description, not from the real file

Describe the columns yourself, in words. Do not let the agent open the real file to “see the format”.

Make a synthetic file fake_grades.csv with 40 rows and the same
structure as my real export (which you must not open):
- columns: name, personal_id, email, q1 ... q6, total, note
- names: invented, clearly fake; personal_id: format YYYYMMDD-XXXX, invented
- q1..q6: whole numbers 0-10; about 5% missing (empty)
- total: sum of q1..q6, empty if any question is missing
- note: mostly empty, a few short texts like "re-sit"
- separator: semicolon; decimal comma; UTF-8 with Swedish letters
Then tell me how you made it, so I can check it matches.

Check the stand-in against the real file by eye: same columns, same separators, same oddities. Missing quirks in the fake data become bugs on the real data.

If the agent runs the script on real data, it sees the output

Error messages, previews and summaries print real rows. Whatever a command prints goes into the conversation. So run the real-data step outside the agent.

Pseudonymisation lowers the risk but does not make data anonymous

You are responsible for everything the agent produces in your name

  • An AI tool cannot be an author. Journals and publishing ethics bodies (for example COPE and ICMJE) agree on this: authors must be able to take responsibility for the work, and a tool cannot.
  • If the agent’s script has a bug, the paper has the bug. If the literature table has an invented reference, you cited it.
  • “The AI did it” is not a defence in a misconduct case. Fabricated or plagiarised content is treated as fabrication or plagiarism, whoever typed it.
  • This is why every exercise in this course has a “Check the result” step.

Say where you used AI, in the way each venue asks

Where What is usually asked
Journals A statement in methods or acknowledgements: which tool, for what. Language polishing is often exempt; analysis and figures are not. Check the author guidelines.
Theses Your university’s rules for degree projects and doctoral theses. Often a declaration of which tools were used and how.
Courses you teach Clear rules for students: what is allowed in which assignment, and how to declare it.
Grant applications Funders differ. Some require no statement, some do. Check the call text.

Keep a short log as you go: tool, version or plan, date, what it did, what you checked. Writing a disclosure later is then easy. (Your project’s notes file in Organising a project for an agent is a good place.)

Example: “Analysis scripts were drafted with Claude Code (Anthropic) and checked by the authors against hand calculations on a subset of the data. The authors take full responsibility for the code and results.”

PDFs and datasets come with licences, and uploading them is a use

Usually fine

  • Open-access papers under CC BY and similar
  • Open data with a licence that allows reuse
  • Your own texts and data
  • Public web pages, for reading (scraping has its own rules: Part 4)

Check first

  • Paywalled PDFs from your library: the publisher’s licence may restrict text and data mining or uploading to AI services
  • Datasets under a data use agreement (registries, biobanks, survey archives)
  • Textbooks, course books, exam banks from publishers
  • Anything marked “no redistribution”

When the agent reads a PDF, a copy goes to the provider. If the licence does not allow that, the convenience does not change it.

Your students use these tools too, so give them clear rules

  • Students have access to the same agents. Assume they use them unless the setting prevents it.
  • State per assignment what is allowed, what must be declared, and what is not allowed. Vague rules are not followed.
  • Do not upload student work to a non-approved tool for grading or feedback: it is personal data, and grading by AI is a high-risk use under the AI Act.
  • Your own experience from this course is the best basis for writing those rules.

The agent can reach whatever your user account can, so start it in one project folder

Never start the agent in your home folder, on your Desktop, or in a synced drive with everything in it. Start it in one project folder that holds only what the task needs.

Work on copies, never on the only original

Know which permission mode you are in before you start

Claude Code

  • The mode shows in the status line below the prompt. Shift+Tab cycles through modes.
  • Recent versions start in auto mode: a second model reviews each action instead of you.
  • Manual mode asks before edits, most commands and web access. Prefer it in folders with anything you care about.
  • Plan mode only reads and proposes.
  • Bypass permissions (--dangerously-skip-permissions) skips the checks. Not on your own computer.

Codex

  • In a folder under version control, Codex starts in the Auto preset: it edits files and runs commands inside the folder without asking, and asks before anything else. Network access is off by default.
  • In other folders, it suggests read-only.
  • /permissions switches mode during a session.
  • Full access (--dangerously-bypass-approvals-and-sandbox, alias --yolo) removes the sandbox. Not on your own computer.

You met the modes in Terminal survival kit. With own data, the safe choice is the more careful mode.

“Yes, and don’t ask again” is a permanent decision

In Claude Code, “don’t ask again” for a command is saved for the project, in all future sessions. Use it for harmless commands. Review saved rules with /permissions.

Never give the agent passwords, API keys or tokens

  • Anything you type in the chat goes to the provider and into the session log on your computer (Claude Code keeps these as plain text for 30 days by default).
  • Do not paste a password, an API key, a GitHub token or a login link into the conversation. Do not ask the agent to log in for you.
  • Keep files with secrets (.env, credentials.json, saved key files) out of the project folder.
  • If a secret did end up in a session: change it (rotate the key, change the password). Deleting the message is not enough.
  • When a later unit needs a key (Part 4 APIs), we will show a safe way that keeps it out of the chat.

A web page or PDF can contain instructions, and the agent may follow them

This is prompt injection. The agent cannot reliably tell your instructions from instructions hidden in the material it reads.

Your defences against tricks and mistakes are simple habits

Habit Protects against
Start in one project folder with copies Damage spreading to the rest of your computer
Read every command before you approve it; say no when unsure Prompt injection, mistakes, deleting the wrong files
Careful permission mode with own or untrusted data Actions you never saw
Never “always allow” rm or all commands One bad step deleting everything
No secrets in the folder or the chat Stolen keys and accounts
Be suspicious of network commands (curl, wget, uploads) you did not ask for Data being sent somewhere
Backups now, git from Part 2 Losing work

Where this goes wrong

  • Policies move. Plans, defaults and retention periods change several times a year. What was true when you checked may not be true now.
  • This is not legal advice. The flowchart is a first filter; your university and your data protection officer decide.
  • The agent cannot judge your data’s class for you. It may tell you a file is fine; it does not know your ethics approval or your contract.
  • A stand-in that is too clean gives a script that breaks on the real data, and the temptation to “just let the agent look”.
  • Auto modes and classifiers are models too. They reduce prompts; they do not replace reading.
  • Habits erode. After the fiftieth prompt, people approve without reading. Notice when that starts.

From the next unit on, you work on a project of your own

A good project is real, small, yours, safe and checkable. Every exercise from now on has an “On your own project” part, applied to it.

There are example projects for every field if you have no idea yet

Teachers

  • A course page for one of your courses, with one interactive demo
  • A question bank with exercise variants and answer keys
  • Last year’s course evaluation numbers as a short report (numbers only, no free text)

Biology and medicine

  • A literature map of 20 genes or proteins, with verified references
  • Reanalysis of a public RNA-seq or image dataset
  • A Shiny app for your lab’s non-personal measurement data

Engineering and natural sciences

  • An automated weekly report from instrument logs
  • Making an old analysis reproducible: one script, pinned versions, a README
  • A spreadsheet of material properties extracted from papers in your field

Humanities and social sciences

  • The funding landscape of your research area in Sweden or the EU
  • A cleaned, documented open dataset ready for deposit (Zenodo)
  • Preparing your next grant: reviewer profiles and mock reviews

The exercise describes each one concretely, with data sources and how to check the result.

Summary

Concept Key fact
Data flow Every file the agent reads, and every command output, goes to the provider’s servers
Plans Personal plans: training depends on a setting; business and education plans: not by default. Check the provider’s pages
Data classes Public, internal, personal, sensitive personal, confidential. The class decides what you may do
Never Manuscripts and proposals you review in confidence
Your university Its AI policy and approved tools come first; ask the data protection officer

Summary (continued)

Concept Key fact
Synthetic stand-in The agent builds the script on fake data; you run it on the real data, outside the agent
Responsibility You are accountable for the agent’s output; disclose AI use as each venue asks
Licences Uploading a PDF or dataset is a use; check its licence
Safety One project folder, copies, careful mode, no “always allow” for rm, no secrets, read commands
Prompt injection Material the agent reads can contain instructions; say no to unexpected actions

Next (Delegating well): with your own project chosen, we learn to brief the agent like a capable new colleague: goal, context, constraints and how you will judge the result.