agentleFS
MicrosoftKnown publishermicrosoft/generative-ai-for-beginners/AGENTS.md

generative-ai-for-beginners

AGENTS.md121k starsChanged 5 months agoMITView on GitHub

This repository contains a comprehensive 21-lesson curriculum teaching Generative AI fundamentals and application development. The course is designed for beginners and covers everything from basic concepts to building production-ready applications. Key Technologies: - Python 3.9+ with libraries: openai, python-dotenv, tiktoken, azure-ai-inference, pandas, numpy, matplotlib - TypeScript/JavaScript with Node.js and libraries: openai (Azure OpenAI via the v1 endpoint + Responses API), @azure-rest/ai-inference (Microsoft Foundry Models) - Azure OpenAI Service, OpenAI API, and Microsoft Foundry Models (GitHub Models is retiring end of…

  • Reads credentials
  • Installs packages

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 1 mentionMay 2026: 2 mentionsJun 2026: 8 mentionsJul 2026: 3 mentionsAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 2 mentionsNov 2026: 13 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/generative-ai-for-beginners repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/generative-ai-for-beginners

The biggest 5 of 94 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 94

Talked about on Bluesky, GitHub and Hacker News (94 times).

On Bluesky · 44

39 more on Bluesky

On GitHub · 43

38 more on GitHub

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

44 rules. About 3 are common, 22 are distinctive, and 19 are very specific to this project.

  • ≈3

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈22

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 19

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run post-create script (.devcontainer/post-create.sh)

    line 68
  2. Very specific:

    All lessons requiring API access use environment variables defined in .env:

    line 75
  3. Very specific:

    Use python-dotenv for environment variable management

    line 138
  4. Very specific:

    Import openai library for API interactions

    line 139
  5. Very specific:

    Use pylint for linting (some examples include # pylint: disable=all for simplicity)

    line 140
  6. Distinctive:

    Follow PEP 8 naming conventions

    line 141
  7. Very specific:

    Use dotenv package for environment variables

    line 146
  8. Very specific:

    Use the openai package for Azure OpenAI (point the client at the /openai/v1/ endpoint and call client.responses.create).

    line 148
  9. Very specific:

    Use nodemon for development with auto-reload

    line 149
  10. Distinctive:

    Keep code examples simple and educational

    line 154
  11. Very specific:

    Use consistent naming: aoai- prefix for Azure OpenAI, oai- for OpenAI API, githubmodels- for Microsoft Foundry Models (legacy prefix …

    line 157
  12. Very specific:

    All URLs must be wrapped in text format with no extra spaces

    line 163
  13. Very specific:

    All links to Microsoft domains must include tracking ID: ?WT.mc_id=academic-105485-koreyst

    line 165
  14. Very specific:

    No country-specific locales in URLs (avoid /en-us/)

    line 166
  15. Distinctive:

    Use English characters, numbers, and dashes in file names

    line 168
  16. Distinctive:

    Do not submit partial translations

    line 174
  17. Distinctive:

    Test Python examples: Activate venv and run scripts

    line 195
  18. Very specific:

    Test TypeScript examples: npm install, npm run build, npm start

    line 196
  19. Distinctive:

    Verify environment variables are configured correctly

    line 197
  20. Common:

    Check that API keys work with the code examples

    line 198
  21. Distinctive:

    Ensure all code runs without errors

    line 201
  22. Distinctive:

    Test with both Azure OpenAI and OpenAI API when applicable

    line 202
  23. Distinctive:

    Verify examples work with Microsoft Foundry Models where supported

    line 203
  24. Distinctive:

    Test code changes in both Python and TypeScript when applicable

    line 216
  25. Distinctive:

    Run Markdown validation (triggered automatically on PR)

    line 217
  26. Distinctive:

    Ensure tracking IDs are present on all Microsoft URLs

    line 218
  27. Distinctive:

    Check that relative links are valid

    line 219
  28. Distinctive:

    Verify images are properly referenced

    line 220
  29. Very specific:

    Use descriptive titles: [Lesson 06] Fix Python example typo or Update README for lesson 08

    line 224
  30. Distinctive:

    Keep PRs focused and small when possible

    line 239
  31. Very specific:

    Create example in python/ or typescript/ subdirectory

    line 246
  32. Very specific:

    Follow naming convention: {provider}-{example-name}.{py|ts|js}

    line 247
  33. Common:

    Test with actual API credentials

    line 248
  34. Distinctive:

    Document any new environment variables in lesson README

    line 249
  35. Distinctive:

    Follow Markdown guidelines (tracking IDs, relative links)

    line 254
  36. Distinctive:

    Update translations are handled by GitHub Actions (don't edit manually)

    line 255
  37. Distinctive:

    Test all links are valid

    line 256
  38. Distinctive:

    Ensure virtual environment is activated

    line 286
  39. Distinctive:

    Check Python version is 3.9+

    line 288
  40. Very specific:

    Run npm install in the specific app directory

    line 291
  41. Very specific:

    Check Node.js version is compatible

    line 292
  42. Very specific:

    Verify .env file exists and has correct values

    line 296
  43. Common:

    Check API keys are valid and not expired

    line 297
  44. Distinctive:

    Ensure endpoint URLs are correct for your region

    line 298

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Project Overview

This repository contains a comprehensive 21-lesson curriculum teaching Generative AI fundamentals and application development. The course is designed for beginners and covers everything from basic concepts to building production-ready applications.

Key Technologies:

  • Python 3.9+ with libraries: openai, python-dotenv, tiktoken, azure-ai-inference, pandas, numpy, matplotlib
  • TypeScript/JavaScript with Node.js and libraries: openai (Azure OpenAI via the v1 endpoint + Responses API), @azure-rest/ai-inference (Microsoft Foundry Models)
  • Azure OpenAI Service, OpenAI API, and Microsoft Foundry Models (GitHub Models is retiring end of July 2026)
  • Jupyter Notebooks for interactive learning
  • Dev Containers for consistent development environment

Repository Structure:

  • 21 numbered lesson directories (00-21) containing READMEs, code examples, and assignments
  • Multiple implementations: Python, TypeScript, and sometimes .NET examples
  • Translations directory with 40+ language versions
  • Centralized configuration via .env file (use .env.copy as template)

Setup Commands

Initial Repository Setup

# Clone the repository
git clone https://github.com/microsoft/generative-ai-for-beginners.git
cd generative-ai-for-beginners

# Copy environment template
cp .env.copy .env
# Edit .env with your API keys and endpoints

Python Environment Setup

# Create virtual environment
python3 -m venv venv

# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Node.js/TypeScript Setup

# Install root-level dependencies (for documentation tooling)
npm install

# For individual lesson TypeScript examples, navigate to the specific lesson:
cd 06-text-generation-apps/typescript/recipe-app
npm install

Dev Container Setup (Recommended)

The repository includes a .devcontainer configuration for GitHub Codespaces or VS Code Dev Containers:

  1. Open repository in GitHub Codespaces or VS Code with Dev Containers extension
  2. Dev Container will automatically:
    • Install Python dependencies from requirements.txt
    • Run post-create script (.devcontainer/post-create.sh)
    • Set up Jupyter kernel

Development Workflow

Environment Variables

All lessons requiring API access use environment variables defined in .env:

  • OPENAI_API_KEY - For OpenAI API
  • AZURE_OPENAI_API_KEY - For Azure OpenAI in Microsoft Foundry (Azure OpenAI Service is now part of Microsoft Foundry: https://ai.azure.com)
  • AZURE_OPENAI_ENDPOINT - Azure OpenAI endpoint URL (Foundry resource endpoint)
  • AZURE_OPENAI_DEPLOYMENT - Chat completion model deployment name (course default: gpt-5-mini)
  • AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT - Embeddings model deployment name (course default: text-embedding-3-small)
  • AZURE_OPENAI_API_VERSION - API version (default: 2024-10-21)
  • HUGGING_FACE_API_KEY - For Hugging Face models
  • AZURE_INFERENCE_ENDPOINT - Microsoft Foundry Models endpoint (multi-provider model catalog)
  • AZURE_INFERENCE_CREDENTIAL - Microsoft Foundry Models API key (replaces the retiring GITHUB_TOKEN)
  • AZURE_INFERENCE_CHAT_MODEL - A non-reasoning model (e.g. Llama-3.3-70B-Instruct) used by the temperature examples, since reasoning models don't support sampling controls

Model conventions (important)

  • Default chat model is gpt-5-mini - a current, non-deprecated reasoning model. As of 2026 the older temperature-capable "mini" models (gpt-4o-mini, gpt-4.1-mini) are deprecating, so the curriculum standardizes on the GPT-5 family.
  • Reasoning models reject temperature and top_p, and use max_output_tokens (Responses API) / max_completion_tokens (chat completions) instead of max_tokens. Do not add temperature/top_p/max_tokens to samples that call gpt-5-mini.
  • To demonstrate temperature, samples use a Llama model (Llama-3.3-70B-Instruct) via the Microsoft Foundry Models endpoint (AZURE_INFERENCE_CHAT_MODEL). Steer reasoning models with prompt engineering + reasoning controls instead of sampling knobs.
  • Fine-tuning (lesson 18) keeps gpt-4.1-mini: GPT-5 only supports reinforcement fine-tuning (RFT), not the supervised fine-tuning (SFT) shown there.
  • Lessons 20 (Mistral) and 21 (Meta) keep temperature/max_tokens because they target Mistral/Llama models, which support them.

Running Python Examples

# Navigate to lesson directory
cd 06-text-generation-apps/python

# Run a Python script
python aoai-app.py

Running TypeScript Examples

# Navigate to TypeScript app directory
cd 06-text-generation-apps/typescript/recipe-app

# Build the TypeScript code
npm run build

# Run the application
npm start

Running Jupyter Notebooks

# Start Jupyter in the repository root
jupyter notebook

# Or use VS Code with Jupyter extension

Working with Different Lesson Types

  • "Learn" lessons: Focus on README.md documentation and concepts
  • "Build" lessons: Include working code examples in Python and TypeScript
  • Each lesson has a README.md with theory, code walkthroughs, and links to video content

Code Style Guidelines

Python

  • Use python-dotenv for environment variable management
  • Import openai library for API interactions
  • Use pylint for linting (some examples include # pylint: disable=all for simplicity)
  • Follow PEP 8 naming conventions
  • Store API credentials in .env file, never in code

TypeScript

  • Use dotenv package for environment variables
  • TypeScript configuration in tsconfig.json for each app
  • Use the openai package for Azure OpenAI (point the client at the /openai/v1/ endpoint and call client.responses.create); use @azure-rest/ai-inference for Microsoft Foundry Models
  • Use nodemon for development with auto-reload
  • Build before running: npm run build then npm start

General Conventions

  • Keep code examples simple and educational
  • Include comments explaining key concepts
  • Each lesson's code should be self-contained and runnable
  • Use consistent naming: aoai- prefix for Azure OpenAI, oai- for OpenAI API, githubmodels- for Microsoft Foundry Models (legacy prefix retained from the GitHub Models era)

Documentation Guidelines

Markdown Style

  • All URLs must be wrapped in [text](url) format with no extra spaces
  • Relative links must start with ./ or ../
  • All links to Microsoft domains must include tracking ID: ?WT.mc_id=academic-105485-koreyst
  • No country-specific locales in URLs (avoid /en-us/)
  • Images stored in ./images folder with descriptive names
  • Use English characters, numbers, and dashes in file names

Translation Support

  • Repository supports 40+ languages via automated GitHub Actions
  • Translations stored in translations/ directory
  • Do not submit partial translations
  • Machine translations are not accepted
  • Translated images stored in translated_images/ directory

Testing and Validation

Pre-submission Checks

This repository uses GitHub Actions for validation. Before submitting PRs:

  1. Check Markdown Links:
    # The validate-markdown.yml workflow checks:
    # - Broken relative paths
    # - Missing tracking IDs on paths
    # - Missing tracking IDs on URLs
    # - URLs with country locale
    # - Broken external URLs
  2. Manual Testing:
    • Test Python examples: Activate venv and run scripts
    • Test TypeScript examples: npm install, npm run build, npm start
    • Verify environment variables are configured correctly
    • Check that API keys work with the code examples
  3. Code Examples:
    • Ensure all code runs without errors
    • Test with both Azure OpenAI and OpenAI API when applicable
    • Verify examples work with Microsoft Foundry Models where supported

No Automated Tests

This is an educational repository focused on tutorials and examples. There are no unit tests or integration tests to run. Validation is primarily:

  • Manual testing of code examples
  • GitHub Actions for Markdown validation
  • Community review of educational content

Pull Request Guidelines

Before Submitting

  1. Test code changes in both Python and TypeScript when applicable
  2. Run Markdown validation (triggered automatically on PR)
  3. Ensure tracking IDs are present on all Microsoft URLs
  4. Check that relative links are valid
  5. Verify images are properly referenced

PR Title Format

  • Use descriptive titles: [Lesson 06] Fix Python example typo or Update README for lesson 08
  • Reference issue numbers when applicable: Fixes #123

PR Description

  • Explain what was changed and why
  • Link to related issues
  • For code changes, specify which examples were tested
  • For translation PRs, include all files for a complete translation

Contribution Requirements

  • Sign Microsoft CLA (automatic on first PR)
  • Fork repository to your account before making changes
  • One PR per logical change (don't combine unrelated fixes)
  • Keep PRs focused and small when possible

Common Workflows

Adding a New Code Example

  1. Navigate to the appropriate lesson directory
  2. Create example in python/ or typescript/ subdirectory
  3. Follow naming convention: {provider}-{example-name}.{py|ts|js}
  4. Test with actual API credentials
  5. Document any new environment variables in lesson README

Updating Documentation

  1. Edit README.md in the lesson directory
  2. Follow Markdown guidelines (tracking IDs, relative links)
  3. Update translations are handled by GitHub Actions (don't edit manually)
  4. Test all links are valid

Working with Dev Containers

  1. Repository includes .devcontainer/devcontainer.json
  2. Post-create script installs Python dependencies automatically
  3. Extensions for Python and Jupyter are pre-configured
  4. Environment is based on mcr.microsoft.com/devcontainers/universal:2.11.2

Deployment and Publishing

This is a learning repository - there is no deployment process. The curriculum is consumed by:

  1. GitHub Repository: Direct access to code and documentation
  2. GitHub Codespaces: Instant dev environment with pre-configured setup
  3. Microsoft Learn: Content may be syndicated to official learning platform
  4. docsify: Documentation site built from Markdown (see docsifytopdf.js and package.json)

Building Documentation Site

# Generate PDF from documentation (if needed)
npm run convert

Troubleshooting

Common Issues

Python Import Errors:

  • Ensure virtual environment is activated
  • Run pip install -r requirements.txt
  • Check Python version is 3.9+

TypeScript Build Errors:

  • Run npm install in the specific app directory
  • Check Node.js version is compatible
  • Clear node_modules and reinstall if needed

API Authentication Errors:

  • Verify .env file exists and has correct values
  • Check API keys are valid and not expired
  • Ensure endpoint URLs are correct for your region

Missing Environment Variables:

  • Copy .env.copy to .env
  • Fill in all required values for the lesson you're working on
  • Restart your application after updating .env

Additional Resources

Project-Specific Notes

  • This is an educational repository focused on learning, not production code
  • Examples are intentionally simple and focused on teaching concepts
  • Code quality is balanced with educational clarity
  • Each lesson is self-contained and can be completed independently
  • The repository supports multiple API providers: Azure OpenAI, OpenAI, Microsoft Foundry Models, and offline providers such as Foundry Local and Ollama
  • Content is multilingual with automated translation workflows
  • Active community on Discord for questions and support

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.