Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Testing AI Agents with Python: LLM Evaluation with DeepEval
Hot & New
New
Rating: 5.0 out of 5(3 ratings)
17 students

Testing AI Agents with Python: LLM Evaluation with DeepEval

Catch wrong answers, hallucinations and wrong tool calls before users do, with DeepEval tests in Python.
Created byAdi Tejus
Last updated 10/2026
English

What you'll learn

  • Catch AI agent failures that passing unit tests miss by testing the action: the tool called, its arguments, the amount, and the customer.
  • Write LLM evaluations with pytest and DeepEval: test cases, golden datasets, metrics, thresholds, and a pass or fail report.
  • Build an LLM-as-a-judge and a custom G-Eval style metric, calibrate them against hand-labeled cases, and prove when a judge is too soft.
  • Evaluate RAG pipelines by testing retrieval and generation separately with context precision, context recall, and faithfulness.
  • Test tool calling and Model Context Protocol (MCP) contracts on a real MCP server, plus multi-agent handoffs, loops, and shared state.
  • Red-team an AI agent for prompt injection, PII leaks, and unauthorized actions, and run the same attacks through promptfoo.
  • Trace an agent step by step to the exact failing step, use OpenTelemetry names, redact data, and send the trace to Langfuse.
  • Block bad releases with regression baselines, GitHub Actions CI/CD quality gates, a release scorecard, and a one-command capstone.

Course content

16 sections • 58 lectures • 2h 31m total length
  • 0.1 Reproduce the Wrong Refund on Your Machine (Setup, No API Key)6:12

Requirements

  • Python 3.11 or newer installed, and comfort reading Python code.
  • A terminal and a code editor. Windows, macOS, and Linux all work.
  • No machine-learning or data-science background needed.
  • Optional only: your own OpenAI key, Node.js, a Langfuse account, and a GitHub account for a few extra exercises.

Description

This course contains the use of artificial intelligence.


Your AI agent says the refund is done. Status ok. Logs clean. Five unit tests green. It just sent $1,249.00 to the wrong customer, when $124.90 was owed to someone else. This course teaches you to catch that, and every failure like it, before it ships.


Testing AI agents is not like testing ordinary code. The same input can produce different words, a confident reply can hide a wrong tool call, and a passing test suite can miss the one thing that matters: what the agent actually did. In this hands-on course you build a complete AI agent testing and LLM evaluation harness in Python, step by step, on one realistic project.


Why this course is different


  • You work on one project from the first minute: a customer-support refund agent, 30 hand-labeled tickets, and a test harness you grow module by module.

  • Every lab runs offline on your own machine. No API key, no cloud account, nothing to pay for.

  • Every number on screen comes from a real run you can repeat, so your terminal matches the video.

  • Where a real model matters, the course ships recorded gpt-4o-mini answers (five runs of every ticket), so you can study real  model behaviour without calling a model.

  • Every module ends with "your turn": one small test you write yourself, with the command that proves it.


What you will build and learn


  • AI agent fundamentals for testers: tokens, context, temperature, the agent loop, tools, memory, and six ways agents fail (hallucination, wrong tool, wrong arguments, reasoning errors, goal drift, infinite loops).

  • Why traditional testing breaks for non-deterministic systems, and what to assert instead of exact text.

  • LLM evaluation with pytest and DeepEval: test cases, golden datasets, metrics, thresholds, and reports.

  • Evaluation metrics and LLM-as-a-judge: task completion, tool correctness, faithfulness, answer relevancy, custom metrics and G-Eval, with a judge calibrated against human labels.

  • RAG evaluation: test retrieval and generation separately with context precision, context recall, and faithfulness.

  • Tool calling and Model Context Protocol (MCP) contract testing against a real MCP server you start yourself.

  • Multi-agent testing: handoffs, delegation, duplicate deliveries, loops, and failure propagation.

  • AI security testing and red teaming: prompt injection, PII leaks, authorization, and the same attacks run through promptfoo.

  • Observability: step-by-step traces that name the failing step, OpenTelemetry names, redaction, and an export to Langfuse (optional).

  • Performance, cost, and reliability: calls, tokens, retries, timeouts, and a cost saving proven on the same labels.

  • Regression testing: stored baselines, regression gates, and reviewed synthetic test data.

  • CI/CD quality gates with GitHub Actions, branch protection, a release scorecard, a written release policy, and an audit trail.

  • A one-command capstone that runs every stage and ends in one release decision.


Practice built in


  • 4 projects: a customer-support evaluation, an enterprise RAG evaluation, a multi-tool test suite, and a security review.

  • 16 "your turn" coding tasks, 8 labs with written assignments

  • A second, messier agent with no map, so you apply the whole method to something new: labels from its policy, causes from its trace, fixes proven against a baseline.

  • A thirty-day practice plan to keep going after the last lecture.


Who this course is for


  • QA engineers, SDETs, and test automation engineers who now have to test LLM applications and AI agents.

  • Python developers and AI engineers who ship agents and need evidence before a release.

  • Tech leads who must decide whether an agent is safe to merge and release.


What you need


  • Python 3.11 or newer and comfort reading Python code. No machine-learning background.

  • No API key. A few optional exercises use your own OpenAI key, Node.js, a Langfuse account, or a GitHub account; the course tells you each time, and you can skip them.


Scope, stated plainly


  • About 2.5 hours of focused video in 16 modules and 58 lectures. Short lectures, no filler.

  • The course's agents are small on purpose, so every failure is visible and reproducible. The method is what transfers to your own agents.

  • Taught hands-on: pytest, DeepEval, a custom judge, an MCP server and client, promptfoo, the OpenTelemetry SDK, Langfuse (optional), and GitHub Actions.

  • Taught as concepts only: RAGAS, model-generated test data, and hosted monitoring. The course says so where they appear.


How AI was used: the on-screen presenter and the narration are AI-generated video and voice, and AI tools helped write the lecture scripts, code examples, and quizzes. Every result shown comes from a real run of the course code.

Who this course is for:

  • QA engineers, SDETs, and test automation engineers who need to test AI agents and LLM applications.
  • Python developers and AI engineers who build agents and want proof they work before release.
  • Tech leads and engineering managers who need a quality gate, a scorecard, and a release decision for AI features.
  • Not for you if you want a tour of every evaluation product, or a course on training models.