# Testing Course Samples

Runs the course notebooks and code samples against a live Foundry or Azure OpenAI setup.

- Repository: https://github.com/microsoft/ai-agents-for-beginners (78611 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add microsoft/ai-agents-for-beginners --skill testing-course-samples -g -a claude-code -y`
Codex: `npx skills add microsoft/ai-agents-for-beginners --skill testing-course-samples -g -a codex -y`
Cursor: `npx skills add microsoft/ai-agents-for-beginners --skill testing-course-samples -g -a cursor -y`
Gemini CLI: `npx skills add microsoft/ai-agents-for-beginners --skill testing-course-samples -g -a gemini-cli -y`

## Description

Use when asked to validate, test, smoke-test, or run the course's notebook and code samples against a live Microsoft Foundry / Azure OpenAI configuration. Covers environment setup (.env, az login, packages), the scripts/validate-notebooks.ps1 runner, interpreting PASS/FAIL results, and which lessons need extra resources (Azure AI Search, GitHub MCP, Foundry Local, Playwright).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Testing the Course Samples

Validate that the lesson notebooks and code samples run against a live
Microsoft Foundry / Azure OpenAI setup. The repo ships a runner at
[`scripts/validate-notebooks.ps1`](../../../scripts/validate-notebooks.ps1) that
executes every Python notebook headlessly and prints a PASS/FAIL matrix.

## When to use
- "Validate all the notebooks / samples against my Azure subscription."
- "Smoke-test the course after upgrading packages or changing models."
- "Which lessons still pass / fail live?"

Do **not** use this for the AI Smoke Test GitHub Action (that validates *deployed*
hosted agents, see [`tests/README.md`](../../../tests/README.md)). This skill
runs the notebooks locally.

## Prerequisites (check first)
1. **Python 3.12+** with course deps: `python -m pip install -r requirements.txt`
   plus the executor: `python -m pip install nbconvert ipykernel`.
2. **`.env` at the repo root** (copy from [`.env.example`](../../../.env.example)) with at least:
   - `AZURE_AI_PROJECT_ENDPOINT`, Foundry project endpoint
     (`https://<account>.services.ai.azure.com/api/projects/<project>`)
   - `AZURE_AI_MODEL_DEPLOYMENT_NAME`, a non-deprecated deployment (e.g. `gpt-5-mini`)
   - `AZURE_OPENAI_ENDPOINT` (`https://<account>.openai.azure.com`) and `AZURE_OPENAI_DEPLOYMENT`
     for lessons that call Azure OpenAI directly (Lesson 06, 02-azure-openai, 14 handoff/human-loop).
3. **`az login`** completed, samples authenticate with `AzureCliCredential` (Entra ID, keyless).
4. Verify the model deployment exists:
   `az cognitiveservices account deployment list -g <rg> -n <account> -o table`.

## Running the validation
```powershell
# All Python notebooks (skips .NET, .venv, site-packages, translations, skill assets)
pwsh scripts/validate-notebooks.ps1

# A single lesson, with a longer per-cell timeout
pwsh scripts/validate-notebooks.ps1 -Filter '08-*' -Timeout 600

# Just list what would run (no execution)
pwsh scripts/validate-notebooks.ps1 -List

The rest: https://github.com/microsoft/ai-agents-for-beginners/blob/HEAD/.agents/skills/testing-course-samples/SKILL.md
