ai-agents-for-beginners

Course Setup

Introduction

This lesson will cover how to run the code samples of this course.

Join Other Learners and Get Help

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.

Clone or Fork this Repo

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 hacer un fork del repositorio

You should now have your own forked version of this course in the following link:

Repositorio bifurcado

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.

Quick shallow clone — minimal history, all files

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

Partial (sparse) clone — minimal blobs + only selected folders

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

Tips

Running the Code

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 either:

Requires GitHub Account - Free:

1) Semantic Kernel Agent Framework + GitHub Models Marketplace. Labelled as (semantic-kernel.ipynb) 2) AutoGen Framework + GitHub Models Marketplace. Labeled as (autogen.ipynb)

Requires Azure Subscription: 3) Azure AI Foundry + Azure AI Agent Service. Labelled as (azureaiagent.ipynb)

We encourage you to try out all three types of examples to see which one works best for you.

Whichever option you choose, it will determine which setup steps you need to follow below:

Requirements

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.

Setup VSCode

Make sure that you are using the right version of Python in VSCode.

imagen

Set Up for Samples using GitHub Models

Step 1: Retrieve Your GitHub Personal Access Token (PAT)

This course leverages the GitHub Models Marketplace, providing free access to Large Language Models (LLMs) that you will use to build AI Agents.

To use the GitHub Models, you will need to create a GitHub Personal Access Token.

This can be done by going to your Personal Access Tokens settings in your GitHub Account.

Please follow the Principle of Least Privilege when creating your token. This means you should only give the token the permissions it needs to run the code samples in this course.

  1. Select the Fine-grained tokens option on the left side of your screen by traversing to the Developer settings

    Configuración de desarrollador

    Then select Generate new token.

    Generar Token

  2. Enter a descriptive name for your token that reflects its purpose, making it easy to identify later.

    🔐 Recomendación de duración del token

    Recommended duration: 30 days For a more secure posture, you can opt for a shorter period—such as 7 days 🛡️ It’s a great way to set a personal target and complete the course while your learning momentum is high 🚀.

    Nombre del token y expiración

  3. Limit the token’s scope to your fork of this repository.

    Limitar alcance al repositorio bifurcado

  4. Restrict the token’s permissions: Under Permissions, click Account tab, and click the “+ Add permissions” button. A dropdown will appear. Please search for Models and check the box for it.

    Agregar permiso de Models

  5. Verify the permissions required before generating the token. Verificar permisos

  6. Before generating the token, ensure you are ready to store the token in a secure place like a password manager vault, as it will not be shown again after you create it. Guardar el token de forma segura

Copy your new token that you have just created. You will now add this to your .env file included in this course.

Step 2: Create Your .env File

To create your .env file run the following command in your terminal.

# zsh/bash
cp .env.example .env
# PowerShell
Copy-Item .env.example .env

This will copy the example file and create a .env in your directory and where you fill in the values for the environment variables.

With your token copied, open the .env file in your favorite text editor and paste your token into the GITHUB_TOKEN field.

Campo del token de GitHub

You should now be able to run the code samples of this course.

Set Up for Samples using Microsoft Foundry and Azure AI Agent Service

Step 1: Retrieve Your Azure Project Endpoint

Follow the steps to creating a hub and project in Azure AI Foundry found here: Hub resources overview

Once you have created your project, you will need to retrieve the connection string for your project.

This can be done by going to the Overview page of your project in the Microsoft Foundry portal.

Cadena de conexión del proyecto

Step 2: Create Your .env File

To create your .env file run the following command in your terminal.

# zsh/bash
cp .env.example .env
# PowerShell
Copy-Item .env.example .env

This will copy the example file and create a .env in your directory and where you fill in the values for the environment variables.

With your token copied, open the .env file in your favorite text editor and paste your token into the PROJECT_ENDPOINT field.

Step 3: Sign in to Azure

As a security best practice, we’ll use keyless authentication to authenticate to Azure OpenAI with Microsoft Entra ID.

Next, open a terminal and run az login --use-device-code to sign in to your Azure account.

Once you’ve logged in, select your subscription in the terminal.

Additional Environment Variables - Azure Search and Azure OpenAI

For the Agentic RAG Lesson - Lesson 5 - there are samples that use Azure Search and Azure OpenAI.

If you want to run these samples, you will need to add the following environment variables to your .env file:

Overview Page (Project)

Management Center

Models + Endpoints Page

Azure Portal

External Webpage

Setup keyless authentication

Rather than hardcode your credentials, we’ll use a keyless connection with Azure OpenAI. To do so, we’ll import DefaultAzureCredential and later call the DefaultAzureCredential function to get the credential.

# Python
from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential

Stuck Somewhere?

Si tienes algún problema al ejecutar esta configuración, únete a nuestro Discord de la comunidad Azure AI o crea un issue.

Siguiente lección

Ahora estás listo para ejecutar el código de este curso. ¡Disfruta aprendiendo más sobre el mundo de los Agentes de IA!

Introducción a los Agentes de IA y casos de uso de agentes


Descargo de responsabilidad: Este documento ha sido traducido utilizando el servicio de traducción automática Co-op Translator (https://github.com/Azure/co-op-translator). Aunque nos esforzamos por la exactitud, tenga en cuenta que las traducciones automáticas pueden contener errores o inexactitudes. El documento original en su idioma nativo debe considerarse la fuente autorizada. Para información crítica, se recomienda una traducción profesional realizada por un traductor humano. No nos hacemos responsables de ningún malentendido o interpretación errónea que surja del uso de esta traducción.