Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Build Governed AI Agents in Python
New
Rating: 5.0 out of 5(1 rating)
1 students

Build Governed AI Agents in Python

Permissions, approvals, budgets and audit trails: make an AI agent that spends money and changes data safe to ship
Created byUsman AHMED
Last updated 11/2026
English
English

What you'll learn

  • Rank an agent's tools by risk with three questions: what can it change, how much in one call, can we undo it.
  • Put one policy check in front of every tool call, write the rules in Python and in Cedar, and test them.
  • Add human approval for high-risk actions, bound to the exact arguments, without causing approval fatigue.
  • Stop runaway agents with step limits, cost budgets, loop detection and a kill switch that fails closed.
  • Limit what prompt injection can do by checking actions at the tool boundary.
  • Record a hash-chained audit trail with personal data redacted, verify it and replay a run from it.
  • Build a governance test suite and a CI release gate that blocks a release when a control breaks.
  • Produce an evidence pack that maps each control to its code, tests and logs.

Course content

11 sections • 46 lectures • 4h 8m total length
  • Meet your instructor2:47

    Meet your instructor and see what this course is about: an AI agent that can issue refunds and close accounts, and the controls that make it safe to ship. After this lecture, you know what you will build and whether this course is right for you.

  • What you will build5:00

    See why an agent with tools is risky, and how we govern it with checks, approvals, limits and records. After this lecture, you can explain the plan of the course: one new control for Sam in each section, tested on the same five practice tickets.

  • Set up the project5:04

    Install Python 3.12 and uv, get the course code, and run Sam on your laptop with three commands. After this lecture, you can reset the shop, run the tests, and move to any section with its git tag, in replay mode with no API key.

  • How to get the most from this course4:03

    Learn how every lecture, exercise and quiz works, and how to use replay mode as a safe place to practise. After this lecture, you know what to do after each section, and how to apply each control to an agent of your own.

Requirements

  • Comfortable with Python (functions, classes, running a script from the terminal).
  • Python 3.12 and uv installed (a lecture early in the course shows how). Any operating system.

Description

This course contains the use of artificial intelligence. The scripts, visuals and audio editing were prepared with the help of AI tools. Every lecture is narrated in my own voice, and I designed the course and the project and reviewed every lecture.

An AI agent that can only talk is easy to live with. An agent that can issue refunds, change customer records and close accounts is different: when it makes a mistake, the mistake is an action, and very often nobody checks it before it happens.

In this course, you take Sam, the support agent of a small online shop, from "it works in the demo" to "we can ship it". In the first section, Sam fails on five practice tickets: it refunds two thousand dollars instead of twenty, closes the wrong customer's account, gives an address to a stranger, obeys an instruction hidden in a ticket, and burns its budget in a loop. In every section after that, you add one control in plain Python and replay the same tickets to see it work:

  • an identity for every agent and every run, and one scoped credential per tool

  • a guard before every tool call, with the rules written as code and in Cedar, and tested

  • human approval for risky actions, without approving everything by hand

  • step limits, cost budgets, loop detection and a kill switch that really stops the agent

  • defences against prompt injection that check actions, not words

  • a tamper-evident audit trail that you can replay

  • a test suite and a release gate in CI that block a release when a control breaks

  • an evidence pack that maps your controls to what the EU AI Act, NIST AI RMF, ISO/IEC 42001 and OWASP ask for

Everything runs on your laptop. The project ships with recorded model answers, so you need no API key and pay nothing to follow along; a live mode works with any OpenAI-compatible endpoint when you want it.

The course ends with a capstone: you govern a second agent on your own, and review it with the same checklist that we use for Sam.

This course teaches engineering controls and how to show evidence for them. It is not legal advice.

Who this course is for:

  • Python developers who build, or are about to build, an LLM agent with tools.
  • Engineers asked "how do we know the agent won't do something bad?" by their team, their security people or a customer.
  • Tech leads and platform engineers who need agent controls they can test and show.