AI risks and governance: LGPD, agent permissions and regulation

•0•0Comment iconComment iconComment iconComment icon

Privacy and LGPD compliance, bias, copyright and security; what an agent can and cannot do on your computer; usage policy; ISO/IEC 42001, the AI Act and Bill 2338/2023

Writer image

Translated byEditorial

Edit Article

In the last two lessons, we set an agent running on its own, with written limits, and learned to measure its accuracy using the confusion matrix and all three metrics together. An assistant can pass both tests and still cause serious harm: leak a customer's data, treat one group worse than another, publish someone else's work or let someone in who should not have access.

This lesson covers those risks and the governance needed to keep them under control. We will look at privacy and the LGPD, bias, copyright, security (for both the agent and the system) and energy use; then put together a basic governance framework (a one-page policy, a register of uses and a review process); examine ISO/IEC 42001, the European AI Act and Bill PL 2338/2023; and finish with AI in the public sector. As always, we will use real examples from my projects, including those that show where I needed a safeguard myself.

1. Privacy and the LGPD

1.1 Personal data and sensitive data

Brazil's General Data Protection Law, the LGPD (Law 13.709/2018), applies to any public or private organization that processes data about people in Brazil. Two concepts answer most questions:

Personal data is any information relating to an identified or identifiable person. Names, CPF tax identification numbers, email addresses, phone numbers and ID numbers are obvious examples. But a combination of separate details (job title, department and city) can also identify someone.

Sensitive personal data is a category with stronger protections: racial or ethnic origin, religious beliefs, political opinions, membership of a trade union or a religious, philosophical or political organization, health or sex-life data, and genetic or biometric data. An HR system that stores medical certificates processes sensitive data.

Anonymized data, which can no longer be linked to a person by reasonable means, is no longer personal data. Beware of false anonymity: removing names from a spreadsheet containing dates of birth, neighborhoods and job titles is often not enough.

1.2 Legal basis and purpose

To process personal data, an organization needs a legal basis: the law sets out the permitted grounds, including the person's consent, compliance with a legal obligation, performance of a contract with that person and the controller's legitimate interest. The grounds for processing sensitive data are more restrictive. The principle of purpose limitation also applies: data collected for one purpose cannot be used for an incompatible purpose without a new justification. An email address a customer provided to receive an invoice does not automatically become training data for a marketing model.

The LGPD also contains a provision directly relevant to this course: data subjects can request a review of decisions based solely on automated processing that affect their interests (Art. 20). Keeping a human in the loop is not just good management; it is also a way to uphold that right.

1.3 What not to paste into a tool

The most common risk is not in official systems: it is in the shadow AI discussed in Lesson 6link outside website. The Diagnostic Manual questionnaire has a question specifically about this: "Have you ever pasted customer or colleague data, contracts or internal figures into it?". When the answer is yes, the data has left the company for a provider with which it has no contract, under terms of use no one has read.

The practical rule for a usage policy is this: personal data, sensitive data and confidential information must not go into tools the company has not approved. Even in an approved tool, use only what the task requires.

1.4 The exam-grading case

In Lesson 7link outside website, you saw exams being graded from photos: 49 exams, 448 photos, AI reading the answers and suggesting grades, and the teacher resolving flagged uncertainties (47 of the 49 exams had at least one uncertainty flagged) and entering the grades into the college's system.

From an LGPD perspective, the process involves three design choices. Files containing names and student ID numbers stay on my machine only: the scores for each question, the spreadsheet for the system and the PDF of graded exams. All public material uses aggregate data only: in this lesson, for example, you have read how many exams, photos and uncertainties there were, but no names or individual grades. And the teacher decides the grade, not the AI.

An important qualification: when the agent reads a photo of an exam, the image is sent to the language model running on the provider's servers. "Staying on my machine" applies to the files and history, not to the moment the image is read. Before an organization uses AI with personal data, someone therefore needs to check the account terms (does the provider use the data for training? how long does it retain it?) and the institution's own rules. That is a question for the usage policy, not for an individual user to resolve alone.

An employee wants to use AI to summarize colleagues' medical certificates and prepare an absenteeism report. What does the LGPD require them to consider first?

Loading icon

Answer: Whether the certificates contain sensitive data, with more restrictive legal grounds for processing, and whether the summary really needs to identify people. Health data is sensitive. The necessity principle also asks whether the report could use aggregate data alone. "Internal" does not mean unrestricted.

2. Bias

2.1 Where bias comes from

A system is biased when it makes more errors, or makes systematically different decisions, for one group than for another. In Weapons of Math Destruction, Cathy O'Neil shows how this can happen without anyone intending it: the model learns from the past, and if one group was treated worse in the past, the model learns to treat it worse. The classic example is a resume-ranking system trained on a company's previous hiring decisions.

Bias can also be built into hand-written rules. One example comes from Conta Ovos: it would seem natural to check the distance between an ovitrap and the municipal center, rejecting locations that are too far away as typing errors. The decision documented in the project was not to run that check, because legitimate locations in the Amazon can be hundreds of kilometers from the center. A "sensible" rule based on cities in southeastern Brazil would have flagged the work of Amazonian municipalities as an error.

2.2 Bias in AI behavior

Language models also have biases of their own. In the exam-grading project, the project memory records a rule that arose from this: agents tend to be generous, "rounding up" when they should not and awarding half a point that an answer did not deserve. The written rule was: apply the same partial-credit criteria to everyone and flag uncertainties for the teacher to review, checking before making a judgment.

Generosity sounds harmless, but in an exam it is unfair: if AI is generous with some answers but not others, students with the same performance receive different grades.

2.3 How to look for bias

The tool is the one from Lesson 12link outside website: the confusion matrix, but broken down by group. If a triage assistant gets 90% of emails written in formal Portuguese right, but only 70% of those containing typing errors, it treats people with less formal education worse. The question for your Project 2 is: is there a group of cases in which the assistant makes more mistakes? If so, who is in that group?

3. Copyright

Three situations come up in everyday work. The first is using third-party material as input. In my Le Cursos project, reference books are kept in a folder outside version control, precisely because of copyright: I use them to prepare lessons, but do not redistribute them. The same rule applies to any agent: reading a book to extract a concept is different from reproducing the book.

The second is using a person's voice, likeness or style. On Cards Realm's English-language channel, videos are dubbed using the presenter's own voice, generated by a model trained on 38 minutes of his speech. He authorized the use of his voice, and that authorization was recorded (16/11/2026). Without it, this would be unauthorized use of someone's voice.

The third is authorship of AI-generated work. In Brazil, the Copyright Law (Law 9.610/1998) protects works created by people, and the treatment of AI-generated content remains under debate worldwide. For organizations, the prudent rule is this: whoever publishes something is responsible for it, and AI-assisted work goes through the same review as any other text.

4. Security and energy

4.1 The agent's permissions

In Lesson 11link outside website, you saw settings.json, with its allow and deny lists, and the phrase "a prompt is a request; deny is a locked door". From a security perspective, three threats deserve attention: the agent accidentally doing something destructive, the agent being manipulated by outside text (prompt injection), and an exposed credential (a password or access key).

Two real examples. In Conta Ovos, two independent safeguards prevent code from being pushed to the server during the daily checks: the deny rule and a git hook. At Le Cursos, the daily check itself flagged a plaintext credential in a configuration file on the machine. The agent did not have permission to change anything there, and it did not: it reported the issue. That is governance working both ways: limiting the agent and using the agent to help spot risks.

4.2 Separation of duties

A longstanding principle of internal control is separation of duties: the person who prepares a payment is not the person who approves it. The same applies to agents.

The lecursos.com website, where this lesson is published, has a database. Access to that database is blocked for Claude. The agent writes the article and the publishing script; I run the script myself. That way, no text goes live without a human action, and an agent error cannot alter the website's database. The agent prepares; the person executes. It is the same setup used for exam grading (AI suggests the grade; the teacher enters it) and Conta Ovos (AI suggests the count; the field worker checks and submits it).

4.3 Energy

Language models run in data centers that consume electricity and water for cooling. The figures vary widely depending on the model, provider and measurement method, and I will not cite any I cannot verify. What we can confidently say is qualitative: every request to a model consumes energy, and repeated requests consume more.

The good news is that the course's central argument also offers an environmental answer. Turning repeated tasks into programs (which run without a language model), keeping context lean (/compact when the conversation gets long) and not using AI where a rule or calculation will do all reduce consumption. The SES-DF case in section 8 takes this idea to its logical limit.

The agent writes the article and the script that publishes it on the website, but it is blocked from accessing the website's database, and a person runs the script. What control principle is this?

Loading icon

Answer: Separation of duties: the person who prepares is not the person who executes. The agent prepares; the person executes. An agent error cannot reach the website's database without a human action.

5. Security by design: the server decides

The agent's safeguards protect against the agent itself. But a system also needs to be secure against its users. Here, security is not a rule in a prompt: it is built into the system's design.

5.1 The browser only handles display

In Futebol de Carta, the card game introduced in Lesson 12link outside website, each player has a hand the other player cannot see. The naive approach would be to send both hands to the browser and hide the opponent’s hand on screen. That does not work: anyone can open the browser’s developer tools and read everything that was sent. Hiding something on screen is not security.

The decision recorded on 07/10/2026, when the prototype became a website, was: the server decides; the browser only renders. The server shuffles and stores the deck and the hands, runs the clock and the bot, and each side receives only its own view of the game. In the code, the rule is written as follows: "no one receives what they are not allowed to see." The same applies to decks unlocked by account level: the server checks access, because hiding a deck on screen would not be enough.

In management, the equivalent question is: does confidential information reach a computer belonging to someone who should not see it, even if it is hidden? A report with the salary column "hidden" in the spreadsheet still contains the salaries.

5.2 The key goes in the header, not the address

The public API for Conta Ovos, which we saw in Lesson 11link outside website, accepted the key directly in the address, at the end of the URL. That may seem harmless, but the web server keeps a record of every request—the access log—including the full URL. A security audit identified the problem (finding A9, rated medium severity): every key sent this way was stored on disk in plain text. The fix, on 11/09/2026, was to accept the key in the Authorization header, which is not written to the log, and to recommend this approach in the documentation. The old method continued to work so as not to break municipalities that were already integrated. The private API for lecursos.com learned the lesson before it was launched: it accepts the key only in the header, from day one.

5.3 The seat token

How does the server know that the person who sent the move is really the player on that side? Each player receives a token: a server-signed credential with an expiration date that says, "this person occupies side A of this game." Without the correct token, the channel that delivers one side’s view does not open. It is like a meeting badge: it grants access to that room, on that day, and nothing else.

5.4 The circuit breaker: the game continues if the database goes down

Security also means staying operational. Futebol de Carta’s history, profile and ranking are stored in an external database shared with Cards Realm. If that database goes down, the game cannot go down with it. That is why reads pass through a circuit breaker: after a failure, the system stops trying for 5 minutes and continues without the database, using short waits—just a few seconds—so no one gets stuck. The game continues; only the history stops being saved, while the profile and ranking indicate that they are unavailable. Like the circuit breaker in your home, it isolates the faulty section so everything else can keep running.

In Futebol de Carta, why does the server never send the other player’s hand to the browser, even hidden?

Loading icon

Answer: Because anything that reaches the browser can be read by the user, and hiding it on screen is not security. The project rule is "no one receives what they are not allowed to see": the server decides and sends each side only its own view.

6. Minimal governance

6.1 A one-page usage policy

Governance does not have to begin with a committee and an 80-page manual. The Diagnostic Manual recommends starting with a one-page usage policy that answers four questions:

Which tools are approved? Preferably, tools used with a corporate account rather than a personal one.

What may and may not be pasted? Personal, sensitive and confidential data should be entered only into approved tools, and only when necessary.

What requires human review? Anything that leaves the company, and anything that makes decisions about people or amounts.

Who should you ask? A specific person, not "the IT department."

One page is deliberately short: a policy no one reads protects no one.

6.2 Usage records

The second instrument is a record of every use of AI, with the four columns required by the manual: owner (a named person), level of autonomy (0 to 4), data it uses (does it involve personal or sensitive data?) and indicator (how do you know it works, as in Lesson 12link outside website).

In my projects, the records are spread across files that the agent reads: each project’s CLAUDE.md, the memories and the manuals for the rounds. Important decisions are marked as "owner decision," along with the reason. Examples from Conta Ovos include the fact that the epidemiological week of a count cannot be edited; the distance to the center is not validated (the Amazon case); and use of the counter is not measured by field agents. There is also a record of what was shut down: the comment bot, with the instruction "Do not restart." It works, but I acknowledge one weakness: everything is spread out. In an organization, the record should be a single list that an auditor can read.

6.3 Review

The third instrument is periodic review: the manual recommends a quarterly review and a new AI Triangle. The review asks, for each use: Is the indicator still reliable? Does the level of autonomy still make sense? Have there been any incidents? Has the data changed? This is when autonomy can be increased or reduced, as happened with the comment bot, which was reduced all the way to zero.

According to the Diagnostic Manual, a record of each use of AI in an organization must include, at a minimum:

Loading icon

Answer: owner, level of autonomy, data it uses and indicator. This shows who is responsible, how much the AI decides on its own, what privacy risk exists and how its performance is measured.

7. Regulation

7.1 ISO/IEC 42001

ISO/IEC 42001, published in 2023, is a standard for an AI management system. It follows the logic of management standards you may already know, such as ISO 9001 (quality) and ISO/IEC 27001 (information security): the organization defines policies, roles, risk assessments, controls, monitoring and continuous improvement, and can be certified for doing so. It does not say which model to use; it says how to manage its use. The minimal governance described in Section 6 is a first step in the same direction.

7.2 The European AI Act

The European Union’s AI Act, approved in 2024 and being implemented in stages, organizes regulation by level of risk. Some practices are prohibited because they pose unacceptable risks, such as social scoring of people. High-risk systems, including those used in recruitment, credit, education and essential public services, face extensive obligations: risk management, data quality, documentation, human oversight and record-keeping. Systems such as chatbots have transparency obligations, including informing users that they are interacting with AI. Everything else, involving minimal risk, remains unrestricted.

The logic is the same as that of our checklist from Lesson 7link outside website: the greater the cost of an error and the impact on people, the more control is needed. Brazilian companies that sell to Europe already need to pay attention to it.

7.3 PL 2338/2023 in Brazil

In Brazil, PL 2338/2023 proposes an AI framework, also using a risk-based approach—with categories for excessive, prohibited and high risk—as well as rights for affected people and governance obligations for those who develop and use AI systems. It was approved by the Senate in December 2024. As a bill, its text may change during the next stages; check its current status before citing any obligation. In the meantime, the LGPD already applies, including the right to review automated decisions.

8. AI in the public sector

8.1 SES-DF: public figures and explainable models

The public sector carries an additional burden: decisions must be justified, the money is public, and those affected often have no alternative. One case I work on is an FGV consultancy for the Federal District Health Secretariat. All the figures I use are public—management reports, the Court of Accounts and the press: R$ 13.2 billion authorized in 2025, 32 thousand employees, more than 200 thousand people on the waiting list, absenteeism of 9.4%, primary-care coverage of 76.7% against a target of 82.4%, and, in the 2023 budget, 3.2% for primary care compared with 79% for specialized care.

Two project rules offer governance lessons. The first is: use only official data in the documents; discrepancies with other figures are left out of the submitted text. The second is the automation guideline: prefer explainable mathematical and statistical models, and use AI only for text, images and conversation. In a surgery waiting list, a manager needs to explain why one patient moved ahead of another. A statistical model with visible criteria makes that possible; a black box does not. Notice that this is an AI course telling people not to use AI in certain situations—and that is exactly what governance does.

8.2 Conta Ovos: a tool, not surveillance

Conta Ovos is used by more than 2,000 municipalities, and the photo counter records each use to measure adoption. It would be easy to also record which disease-control agent used it, how many times and with what result. The decision was not to measure usage by agent, "so as not to turn a tool into worker surveillance." The counter records usage by municipality, and nothing more.

It is a governance decision with a cost: information that could help train infrequent users is lost. But the benefit is trust: an agent who knows they are not being watched uses the tool to help with the work, rather than to protect themselves. In the public sector, where tools often arrive from above, that trust determines whether a tool is adopted or abandoned.

9. Terms you need to know

Understanding the subject is more important than understanding AI itself. Anyone who knows the right terms can make precise requests of an agent and knows what to check. "Make the API secure" is a wish; "accept the key only in the Authorization header, never in the URL, and check whether any key appears in the access log" is a request the agent can fulfill and that you can verify by opening the log.

TermWhat it isWhere it appears in the project
Personal / sensitive dataInformation that identifies someone; sensitive data includes health, religion, biometric data and similar informationExam grading: names and student IDs stay on the machine
Legal basis / purposeThe LGPD legal basis that permits the data to be processed, and the purpose for which it was collectedA page's usage policy
AnonymizedData that can no longer be used to identify the person by reasonable meansPublic exam-grading material, containing only aggregated data
Separation of dutiesThe person who prepares something is not the person who executes or approves itlecursos.com: the agent writes, Leon runs the script
The server decidesThe server stores the state and sends each side only its own view; the browser only renders itFutebol de Carta: futebol/partidas.py
Access logA record of every request to the web server, including the full URLConta Ovos: audit finding A9
Authorization headerThe part of the request where the key is sent, outside the URL and the logConta Ovos API and private lecursos.com API
Seat token (JWT)A signed credential with an expiration date that proves which side the player is on in the matchFutebol de Carta: futebol/tokens.py
Circuit breakerAfter a database failure, it stops retrying for 5 minutes while the system continues runningFutebol de Carta: futebol/historico.py
Usage policyA single page covering approved tools, what to paste, what to review and whom to askDiagnostic manual; this lesson's activity
Usage registerA list of every AI use, including its owner, autonomy, data and metricCLAUDE.md, memories and round manuals
ISO/IEC 42001A certifiable standard for AI management systemsMinimum governance as a first step

10. Common mistakes

"I removed the name column from the spreadsheet, so it's anonymous." Date of birth, neighborhood and job title together can often identify a person. Data is anonymized only when the person cannot be identified by reasonable means.

"It's internal data, so I can paste it anywhere." Internal does not mean unrestricted. Personal and confidential data should go only to approved tools, and only what is necessary.

"Governance is for big companies." A one-page policy, a list of uses with an owner and a review every three months can fit any organization.

"AI is neutral because it's mathematical." It learns from the past and can reproduce its biases; even a handwritten rule can be biased, like the distance validation that would penalize the Amazon region.

11. Bringing it all together

LGPD: personal data, sensitive data, legal basis and purpose. In exam grading, names and student IDs stay only on the teacher's machine, and public material uses aggregated data only.

Biases come from the data, the rules and the model itself (the AI being generous when grading). Look for them using a confusion matrix broken down by group.

Security is a design choice: deny rules in the agent, separation of duties (the site's database is blocked to Claude, and the person who publishes is a human) and careful handling of credentials, such as the one identified during the review. In the system, the server decides, and the key never travels in the URL.

Minimum governance: a one-page policy, a usage register with an owner, autonomy, data and a metric, and a quarterly review. ISO/IEC 42001, the AI Act and PL 2338/2023 follow the same logic: greater risk, greater control.

In the public sector, explainability and trust carry more weight: explainable models at SES-DF, and no monitoring workers in Conta Ovos.

In the next and final lesson, we bring it all together: an AI plan for your organizationlink outside website.

Activity in Claude Code (20 minutes)

1. Open Claude Code in your Projeto 2 folder and ask: "List everything this project accesses: files and folders it reads, files it writes, programs it runs, websites or services it calls and personal data that appears in the files. Save it as acessos.md."

2. Check the list: open the folders yourself and see whether anything is missing. In particular, look for personal data (names, emails, CPF numbers, student IDs) that the agent did not flag.

3. Ask: "Write a settings.json for this project with a deny rule for: deleting files, pushing changes, sending data to the internet and reading the folder containing the original personal data (leave only the anonymized version). Explain each rule." Read it and confirm that the worst the agent could do is blocked.

4. Ask: "Write a one-page AI usage policy for the team that will use this assistant: approved tools, what may and may not be pasted, what requires human review and whom to ask." Cut anything that goes beyond one page.

5. Ask it to include a line in the policy for recording information about your assistant: owner, level of autonomy, data it uses and metric.

6. Ask it to record a rule in CLAUDE.md with a date, for example: "Personal data belongs only in the dados_originais folder, which the agent cannot read; delivery material must contain aggregated data only."

Exercise for classroom discussion

Conta Ovos decided not to measure counter use by field agents "so as not to turn a tool into worker surveillance," and the SES-DF consultancy prefers explainable models over AI for decision-making. Think of an organization you know. (a) What data about employees could an AI tool record there, and what legitimate and abusive uses could be made of that data? (b) For which decision in that organization is explainability indispensable, to the point that you would prefer a rule or a simple statistical model over a more accurate AI? (c) Who should sign that organization's AI usage policy?

Exercises

1) Under the LGPD, which is an example of sensitive personal data?

A) An employee's corporate email address.

B) A supplier company's CNPJ.

C) A customer's delivery address.

D) A purchase order number.

E) A medical certificate containing an employee's diagnosis.

2) In the Le Cursos project, the site's database is blocked to Claude, and a person runs the publication scripts. The main purpose of this design is to:

A) save tokens.

B) make publication faster.

C) ensure separation of duties: the agent prepares, the person executes, and an agent error cannot reach the database without human action.

D) comply with a requirement of the European AI Act.

E) prevent the agent from reading the articles.

3) What do the European AI Act and PL 2338/2023 have in common?

A) The prohibition of any use of AI in the public sector.

B) A risk-based approach, with more obligations for higher-risk systems.

C) The requirement that every AI system be certified under ISO/IEC 42001.

D) The obligation to use only open-source models.

E) The absence of rules on human oversight.

4) When grading exams from photos, the rule "the same partial-credit standard for everyone," created because agents tended to be generous, primarily combats:

A) Personal data leaks.

B) Energy consumption.

C) Copyright infringement.

D) A model bias that would treat students with the same performance differently.

E) Prompt injection.

5) (True or false) "According to the Diagnostic Manual, minimum AI governance can begin with a one-page usage policy, a record of every use (owner, level of autonomy, data and metric) and a periodic review."

( ) True ( ) False

6) (True or false) "Removing only the name column from a spreadsheet containing employees' dates of birth, neighborhoods and job titles guarantees that the data is anonymized for LGPD purposes."

( ) True ( ) False

Answer key

1) E — Health data is sensitive data. Email addresses and physical addresses are ordinary personal data; a CNPJ and an order number are not data about a natural person.

2) C — This is separation of duties applied to the agent. It writes the article and the script; the person decides when to run it. It has nothing to do with tokens or the AI Act.

3) B — Both organize obligations according to risk: prohibited practices at the top, high-risk systems with demanding obligations, and fewer requirements for everything else. ISO/IEC 42001 is voluntary.

4) D — The model's generosity is a behavioral bias: when applied unevenly, it causes identical answers to receive different grades. A consistent criterion and questions flagged for the teacher to review correct this.

5) True — These are the three elements of the "minimum governance" line in the manual's 90-day plan.

6) False — The combination of date of birth, neighborhood and job title can often identify a person. Anonymization requires that it not be possible to identify them by reasonable means.

What did you think of this article?

0%
User score (0)

Share this article!