This lesson will cover how to run the code samples of this course.
Before you begin cloning your repo, join the AI Agents For Beginners Discord channel to get any help with setup, any questions about the course, or to connect with other learners.
To begin, please clone or fork the GitHub Repository. This will make your own version of the course material so that you can run, test, and tweak the code!
This can be done by clicking the link to fork the repo
You should now have your own forked version of this course in the following link:

The full repository can be large (~3 GB) when you download full history and all files. If you’re only attending the workshop or only need a few lesson folders, a shallow clone (or a sparse clone) avoids most of that download by truncating history and/or skipping blobs.
Replace <your-username> in the below commands with your fork URL (or the upstream URL if you prefer).
To clone only the latest commit history (small download):
git clone --depth 1 https://github.com/<your-username>/ai-agents-for-beginners.git
To clone a specific branch:
git clone --depth 1 --branch <branch-name> https://github.com/<your-username>/ai-agents-for-beginners.git
This uses partial clone and sparse-checkout (requires Git 2.25+ and recommended modern Git with partial clone support):
git clone --depth 1 --filter=blob:none --sparse https://github.com/<your-username>/ai-agents-for-beginners.git
Traverse into the repo folder:
cd ai-agents-for-beginners
Then specify which folders you want (example below shows two folders):
git sparse-checkout set 00-course-setup 01-intro-to-ai-agents
After cloning and verifying the files, if you only need files and want to free space (no git history), please delete the repository metadata (💀irreversible — you will lose all Git functionality: no commits, pulls, pushes, or history access).
# zsh/bash
rm -rf .git
# PowerShell
Remove-Item -Recurse -Force .git
Create a new Codespace for this repo via the GitHub UI.
This course offers a series of Jupyter Notebooks that you can run with to get hands-on experience building AI Agents.
The code samples use Microsoft Agent Framework (MAF) with the AzureAIProjectAgentProvider, which connects to Azure AI Agent Service V2 (the Responses API) through Microsoft Foundry.
All Python notebooks are labelled *-python-agent-framework.ipynb.
NOTE: If you don’t have Python3.12 installed, ensure you install it. Then create your venv using python3.12 to ensure the correct versions are installed from the requirements.txt file.
Example
Create Python venv directory:
python -m venv venv
Then activate venv environment for:
# zsh/bash
source venv/bin/activate
# Command Prompt for Windows
venv\Scripts\activate
.NET 10+: For the sample codes using .NET, ensure you install .NET 10 SDK or later. Then, check your installed .NET SDK version:
dotnet --list-sdks
gpt-4o). See Step 1 below.We have included a requirements.txt file in the root of this repository that contains all the required Python packages to run the code samples.
You can install them by running the following command in your terminal at the root of the repository:
pip install -r requirements.txt
We recommend creating a Python virtual environment to avoid any conflicts and issues.
Make sure that you are using the right version of Python in VSCode.
You need an Azure AI Foundry hub and project with a deployed model to run the notebooks.
gpt-4o) from Models + Endpoints → Deploy model.From your project in the Microsoft Foundry portal:

gpt-4o).az loginAll notebooks use AzureCliCredential for authentication — no API keys to manage. This requires you to be signed in via the Azure CLI.
Install the Azure CLI if you haven’t already: aka.ms/installazurecli
Sign in by running:
az login
Or if you’re in a remote/Codespace environment without a browser:
az login --use-device-code
Select your subscription if prompted — choose the one containing your Foundry project.
Verify you’re signed in:
az account show
Why
az login? The notebooks authenticate usingAzureCliCredentialfrom theazure-identitypackage. This means your Azure CLI session provides the credentials — no API keys or secrets in your.envfile. This is a security best practice.
.env FileCopy the example file:
# zsh/bash
cp .env.example .env
# PowerShell
Copy-Item .env.example .env
Open .env and fill in these two values:
AZURE_AI_PROJECT_ENDPOINT=https://<your-project>.services.ai.azure.com/api/projects/<your-project-id>
AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o
| Variable | Where to find it |
|---|---|
AZURE_AI_PROJECT_ENDPOINT |
Foundry portal → your project → Overview page |
AZURE_AI_MODEL_DEPLOYMENT_NAME |
Foundry portal → Models + Endpoints → your deployed model’s name |
That’s it for most lessons! The notebooks will authenticate automatically through your az login session.
pip install -r requirements.txt
We recommend running this inside the virtual environment you created earlier.
Lesson 5 uses Azure AI Search for retrieval-augmented generation. If you plan to run that lesson, add these variables to your .env file:
| Variable | Where to find it |
|---|---|
AZURE_SEARCH_SERVICE_ENDPOINT |
Azure portal → your Azure AI Search resource → Overview → URL |
AZURE_SEARCH_API_KEY |
Azure portal → your Azure AI Search resource → Settings → Keys → primary admin key |
Some notebooks in lessons 6 and 8 use GitHub Models instead of Azure AI Foundry. If you plan to run those samples, add these variables to your .env file:
| Variable | Where to find it |
|---|---|
GITHUB_TOKEN |
GitHub → Settings → Developer settings → Personal access tokens |
GITHUB_ENDPOINT |
Use https://models.inference.ai.azure.com (default value) |
GITHUB_MODEL_ID |
Model name to use (e.g. gpt-4o-mini) |
The conditional workflow notebook in lesson 8 uses Bing grounding via Azure AI Foundry. If you plan to run that sample, add this variable to your .env file:
| Variable | Where to find it |
|---|---|
BING_CONNECTION_ID |
Azure AI Foundry portal → your project → Management → Connected resources → your Bing connection → copy the connection ID |
If you are on macOS and encounter an error like:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain
This is a known issue with Python on macOS where the system SSL certificates are not automatically trusted. Try the following solutions in order:
Option 1: Run Python’s Install Certificates script (recommended)
# Replace 3.XX with your installed Python version (e.g., 3.12 or 3.13):
/Applications/Python\ 3.XX/Install\ Certificates.command
Option 2: Use connection_verify=False in your notebook (for GitHub Models notebooks only)
In the Lesson 6 notebook (06-building-trustworthy-agents/code_samples/06-system-message-framework.ipynb), a commented-out workaround is already included. Uncomment connection_verify=False when creating the client:
client = ChatCompletionsClient(
endpoint=endpoint,
credential=AzureKeyCredential(token),
connection_verify=False, # Disable SSL verification if you encounter certificate errors
)
⚠️ Warning: Disabling SSL verification (
connection_verify=False) reduces security by skipping certificate validation. Use this only as a temporary workaround in development environments, never in production.
Option 3: Install and use truststore
pip install truststore
Then add the following at the top of your notebook or script before making any network calls:
import truststore
truststore.inject_into_ssl()
If you have any issues running this setup, hop into our Azure AI Community Discord or create an issue.
You are now ready to run the code for this course. Happy learning more about the world of AI Agents!