# agentic-ai-lab **Repository Path**: mirrors_microsoft/agentic-ai-lab ## Basic Information - **Project Name**: agentic-ai-lab - **Description**: Azure AI Foundry & Agents Workshop - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-16 - **Last Updated**: 2026-02-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ๐Ÿš€ Azure AI Foundry & Agents Workshop [![Azure AI Foundry](https://img.shields.io/badge/Azure%20AI-Foundry-blue?style=for-the-badge&logo=microsoft)](https://ai.azure.com) [![Python](https://img.shields.io/badge/Python-3.10+-green?style=for-the-badge&logo=python)](https://python.org) [![Jupyter](https://img.shields.io/badge/Jupyter-Lab-orange?style=for-the-badge&logo=jupyter)](https://jupyter.org) **End-to-End Azure AI Foundry And Agents Development Laboratory** *Master Azure AI Foundry and Agents through hands-on experimentation and real-world applications* --- ๐ŸŽฏ [Getting Started](#-getting-started) โ€ข ๐Ÿ“š [Learning Path](#-learning-path) โ€ข ๐Ÿ”ง [Setup Guide](./docs/infrastructure.md) โ€ข ๐Ÿ› ๏ธ [Troubleshooting](#-troubleshooting--support) --- ## ๐ŸŽฏ Mission Statement This comprehensive laboratory transforms you from an AI enthusiast into an Azure AI Foundry expert. Through progressive, hands-on modules, you'll master: 1. Setup, Authentication, Quick Start 2. Prompting, Embeddings, RAG 3. Agents โ€“ File Search, Bing, Azure Functions, Multi-Agent 4. Model Context Protocol (MCP) with Agents 5. AI Red Teaming & Security Testing 6. Agent Framework โ€“ Advanced Agent Development 7. Observability & Evaluation 8. AI Language Services with Low-Code Workflows 9. AI Vision with Low-Code Solutions 10. Content Understanding & Document Classification 11. Responsible AI & Content Safety > **๐ŸŽ“ Laboratory Format**: One day intensive hands-on experience > **๐ŸŽฏ Target Audience**: Developers, AI practitioners, and solution architects > **๐Ÿ’ก Learning Approach**: Progressive complexity with real-world applications --- ## ๐Ÿ“ Repository Structure ``` agentic-ai-lab/ โ”œโ”€โ”€ ๐Ÿ“š initial-setup/ # Start here - Authentication & environment setup โ”œโ”€โ”€ ๐Ÿ’ฌ chat-rag/ # Chat completion and RAG fundamentals โ”œโ”€โ”€ ๐Ÿค– agents/ # AI Agents development and tools (includes multi-agent) โ”œโ”€โ”€ ๐Ÿ”Œ agents-with-mcp/ # Model Context Protocol (MCP) integration โ”œโ”€โ”€ ๐Ÿ”ด ai-red-teaming-agent/ # AI Red Teaming and Security Testing โ”œโ”€โ”€ ๐Ÿค–โš™๏ธ agent-framework/ # Microsoft Agent Framework for advanced agent development โ”œโ”€โ”€ ๐Ÿ“Š observability-and-evaluations/ # Monitoring, evaluation, and quality assurance โ”œโ”€โ”€ ๐Ÿ—ฃ๏ธ ai-language/ # AI Language Services with Logic Apps low-code workflows โ”œโ”€โ”€ ๐Ÿ‘๏ธ ai-vision/ # AI Vision Services with low-code solutions โ”œโ”€โ”€ ๐Ÿ“„ content-understanding/ # Document classification and content extraction โ””โ”€โ”€ ๐Ÿ›ก๏ธ responsible-ai/ # Responsible AI, Content Safety, and PII Detection ``` --- ## ๐Ÿš€ Getting Started ### Step 1: Repository Setup ```powershell # Clone the laboratory repository git clone https://github.com/dhangerkapil/agentic-ai-lab.git cd agentic-ai-lab # Verify Python version python --version # Should be 3.10 or higher ``` ### Step 2: Python Environment Configuration **Using Standard venv** ```powershell # Create and activate virtual environment python -m venv .venv .\.venv\Scripts\activate ``` ### Step 3: Install Dependencies ```powershell # Install core dependencies pip install -r requirements.txt ``` ### Step 4: Azure AI Foundry Setup 1. **Create Azure AI Foundry Resource and Project** To create an AI Foundry resource in the Azure portal follow these instructions: - Select this AI Foundry resource link: https://portal.azure.com/#create/Microsoft.CognitiveServicesAIFoundry - On the Create page, provide the following information: | Project details | Description | |----------------|-------------| | **Subscription** | Select one of your available Azure subscriptions. | | **Resource group** | The Azure resource group that will contain your Azure AI Foundry resource. You can create a new group or add it to a preexisting group. | | **Region** | The location of your Azure AI service instance. Different locations may introduce latency, but have no impact on the runtime availability of your resource. | | **Name** | A descriptive name for your Azure AI Foundry resource. For example, MyAIServicesResource. | | **Default Project Name** | Keep the default project as it is. | - Keep other settings for your resource as default, read and accept the conditions (as applicable), and then select **Review + create**. 2. **Deploy Required Models & Services** | Model Type | Recommended Models | Purpose | |------------|-------------------|---------| | **Chat/Completion** | `gpt-4o`, `gpt-4o-mini` | Primary reasoning & conversation | | **Text Embeddings** | `text-embedding-3-large` | Vector search & RAG | - On the left Nav Menu of the foundry portal go to Models+endpoints - Click Deploy a model button-->Deploy base model - Search for the models in the table above , select a model, click confirm and Deploy and connect 3. **Configure an Azure Search Service** - Create an Azure AI Search resource in Azure - Connect this resource to your AI Foundry project - Navigate to your AI Foundry project โ†’ Management Center โ†’ Connected Resources โ†’ Add Connection โ†’ Select Azure AI Search 4. **Configure Grounding with Bing Search** - Create a new Grounding with Bing Search resource in Azure - Connect this resource to your AI Foundry project - Navigate to your AI Foundry project โ†’ Management Center โ†’ Connected Resources โ†’ Add Connection โ†’ Select Grounding with Bing Search 5. **Create Content Understanding Resource** - Create an Azure AI Content Understanding multi-service resource following the [official documentation](https://learn.microsoft.com/en-us/azure/ai-services/content-understanding/how-to/create-multi-service-resource) - Ensure the resource is created in a supported region (westus, swedencentral, australiaeast) 6. **Configure Environment Variables** - Copy `.env.example` to `.env` in the root directory and update values accordingly - This repository expects the `.env` file to be in the root directory, if you want to store it elsewhere or name it something else, update the `load_dotenv()` calls in notebooks - Many of the Environment Variables needed can be found in the Overview tab of your Azure AI Foundry project or the connected resources in the Management Center tab - For example, AZURE_OPENAI variables- --- ## ๐Ÿ“š Learning Path Follow this structured learning path to master Azure AI Foundry: ### ๐ŸŽฏ Phase 1: Foundation (Start Here) **Location:** `initial-setup/` | Notebook | Description | |----------|-------------| | ๐Ÿ” [Authentication](initial-setup/1-authentication.ipynb) | Azure credential setup and security | | โš™๏ธ [Environment Setup](initial-setup/2-environment_setup.ipynb) | Development environment configuration | | ๐Ÿš€ [Quick Start](initial-setup/3-quick_start.ipynb) | First AI model interaction | ### ๐Ÿ’ฌ Phase 2: Chat & RAG Fundamentals **Location:** `chat-rag/` | Notebook | Description | |----------|-------------| | ๐Ÿ’ฌ [Basic Chat Completion](chat-rag/1-basic-chat-completion.ipynb) | Foundation models and prompting | | ๐Ÿ” [Embeddings](chat-rag/2-embeddings.ipynb) | Vector representations and similarity | | ๐Ÿ“š [Basic RAG](chat-rag/3-basic-rag.ipynb) | Retrieval-Augmented Generation | ### ๐Ÿค– Phase 3: AI Agents Development **Location:** `agents/` | Notebook | Description | |----------|-------------| | ๐Ÿค– [Agent Basics](agents/1-basics.ipynb) | Fundamental agent concepts | | ๐Ÿ’ป [Code Interpreter](agents/2-code_interpreter.ipynb) | Code execution capabilities | | ๐Ÿ“„ [File Search](agents/3-file-search.ipynb) | Document processing | | ๐ŸŒ [Bing Grounding](agents/4-bing_grounding.ipynb) | Web search integration | | ๐Ÿ” [Agents + AI Search](agents/5-agents-aisearch.ipynb) | Enterprise search integration | | โšก [Agents + Azure Functions](agents/6-agents-az-functions.ipynb) | Serverless integration | | ๐Ÿ‘ฅ [Multi-Agent Solution](agents/multi-agent-solution.ipynb) | Collaborative AI systems | ### ๐Ÿ”Œ Phase 4: Model Context Protocol (MCP) Integration **Location:** `agents-with-mcp/` | Implementation | Description | |----------|-------------| | ๐Ÿ”Œ [MCP Inventory Agent](agents-with-mcp/README.md) | Complete working implementation of agents that connect to MCP servers for dynamic tool discovery. Features an intelligent inventory management agent for a cosmetics retailer with automated restock and clearance recommendations. Includes both client and server implementations with interactive chat interface. | ### ๐Ÿ”ด Phase 5: AI Red Teaming & Security Testing **Location:** `ai-red-teaming-agent/` | Implementation | Description | |----------|-------------| | ๐Ÿ”ด [AI Red Teaming Agent](ai-red-teaming-agent/README.md) | Advanced AI security testing and vulnerability assessment using red teaming methodologies. Features automated adversarial prompt generation, safety evaluation, and comprehensive security analysis of AI systems. | ### ๐Ÿค–โš™๏ธ Phase 6: Microsoft Agent Framework **Location:** `agent-framework/` The **Microsoft Agent Framework** is an open-source development kit that unifies and extends Semantic Kernel and AutoGen into the next-generation foundation for AI agent development. Built by the same teams, it offers two primary capabilities: **AI Agents** for autonomous decision-making with tool integration and conversation management, and **Workflows** for orchestrating complex multi-agent processes with type safety and checkpointing. Currently in public preview, it combines AutoGen's simple abstractions with Semantic Kernel's enterprise features while adding robust workflow capabilities. ๐Ÿ“– [Official Documentation](https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview) โ€ข ๐Ÿ”— [GitHub Repository](https://github.com/microsoft/agent-framework) โ€ข ๐Ÿ“š [Complete Guide](agent-framework/README.md) #### ๐Ÿค– Azure AI Agents (`agents/azure_ai_agents/`) | Notebook | Description | |----------|-------------| | ๐Ÿค– [Basic Agent Usage](agent-framework/agents/azure_ai_agents/azure_ai_basic.ipynb) | Fundamental agent concepts with automatic lifecycle management | | โš™๏ธ [Explicit Settings](agent-framework/agents/azure_ai_agents/azure_ai_with_explicit_settings.ipynb) | Agent creation with explicit configuration patterns | | ๐Ÿ”„ [Existing Agent Management](agent-framework/agents/azure_ai_agents/azure_ai_with_existing_agent.ipynb) | Working with pre-existing agents using agent IDs | | ๐Ÿ’ฌ [Thread Management](agent-framework/agents/azure_ai_agents/azure_ai_with_existing_thread.ipynb) | Conversation thread continuity and management | | ๐Ÿ”ง [Function Tools](agent-framework/agents/azure_ai_agents/azure_ai_with_function_tools.ipynb) | Comprehensive function tool integration patterns | | ๐Ÿ’ป [Code Interpreter](agent-framework/agents/azure_ai_agents/azure_ai_with_code_interpreter.ipynb) | Python code execution and mathematical problem solving | | ๐Ÿ“„ [File Search](agent-framework/agents/azure_ai_agents/azure_ai_with_file_search.ipynb) | Document-based question answering with file uploads | | ๐ŸŒ [Bing Grounding](agent-framework/agents/azure_ai_agents/azure_ai_with_bing_grounding.ipynb) | Web search integration using Bing Grounding | #### ๐Ÿ”Œ Model Context Protocol (`agents/mcp/`) | Implementation | Description | |----------|-------------| | ๐Ÿ”Œ [Azure AI with MCP](agent-framework/agents/mcp/azure_ai_with_mcp.ipynb) | Hosted MCP tools with Azure AI Foundry agents (basic, multi-tool, thread-based examples) | | ๐Ÿ–ฅ๏ธ [Agent as MCP Server](agent-framework/agents/mcp/agent_as_mcp_server.py) | Expose Agent Framework agents as MCP servers | | ๐Ÿ” [MCP API Key Auth](agent-framework/agents/mcp/mcp_api_key_auth.py) | API key authentication patterns for MCP servers | #### ๐Ÿ”„ Workflows (`workflows/`) | Category | Description | |----------|-------------| | ๐Ÿ“š [Start Here](agent-framework/workflows/_start-here/) | Foundational workflow concepts, executors, edges, agents, streaming | | ๐ŸŽฏ [Orchestration](agent-framework/workflows/orchestration/) | Sequential and concurrent agent coordination patterns | | ๐Ÿ’พ [Checkpointing](agent-framework/workflows/checkpointing/) | State persistence for long-running workflows | | ๐Ÿ‘ค [Human-in-the-Loop](agent-framework/workflows/human-in-the-loop/) | Interactive approval and feedback patterns | | ๐Ÿง  [Magentic](agent-framework/workflows/magentic/) | AI-driven multi-agent planning and execution | #### ๐Ÿ›ก๏ธ Middleware (`middleware/`) | Notebook | Description | |----------|-------------| | ๐Ÿ”ง [Agent & Run Level](agent-framework/middleware/1-agent_and_run_level_middleware.ipynb) | Middleware fundamentals and scoping | | ๐Ÿ”จ [Function-Based](agent-framework/middleware/2-function_based_middleware.ipynb) | Function-based middleware patterns | | ๐Ÿ—๏ธ [Class-Based](agent-framework/middleware/3-class_based_middleware.ipynb) | Class-based middleware with inheritance | | ๐ŸŽจ [Decorator Middleware](agent-framework/middleware/4-decorator_middleware.ipynb) | @agent_middleware and @function_middleware decorators | | ๐Ÿ’ฌ [Chat Middleware](agent-framework/middleware/5-chat_middleware.ipynb) | Message interception and modification | | โš ๏ธ [Exception Handling](agent-framework/middleware/6-exception_handling_with_middleware.ipynb) | Error handling and recovery patterns | | ๐Ÿ›‘ [Termination](agent-framework/middleware/7-middleware_termination.ipynb) | Early termination and control flow | | ๐Ÿ”„ [Result Override](agent-framework/middleware/8-override_result_with_middleware.ipynb) | Streaming and non-streaming result modification | | ๐Ÿ“ฆ [Shared State](agent-framework/middleware/9-shared_state_middleware.ipynb) | State management with middleware containers | #### ๐Ÿง  Context Providers (`context_providers/`) | Notebook | Description | |----------|-------------| | ๐Ÿ’พ [Azure AI Memory](agent-framework/context_providers/1-azure_ai_memory_context_providers.ipynb) | Agent memory with user fact extraction, tone detection, and persistent context | #### ๐Ÿงต Threading & Conversation Management (`threads/`) | Notebook | Status | Description | |----------|--------|-------------| | ๐Ÿ’ฌ [Azure AI Thread Serialization](agent-framework/threads/1-azure-ai-thread-serialization.ipynb) | โœ… | Service-managed threads with cloud storage (~50 bytes serialization) | | ๐Ÿ”ง [Custom Message Store](agent-framework/threads/2-custom_chat_message_store_thread.ipynb) | โœ… Tested | Custom `ChatMessageStoreProtocol` implementation (converted from Python script) | | ๐Ÿ“ฆ [Redis Message Store](agent-framework/threads/3-redis_chat_message_store_thread.ipynb) | โš ๏ธ Requires Redis | Distributed conversation storage with 5 comprehensive examples | | ๐Ÿ”„ [Suspend/Resume Threads](agent-framework/threads/4-suspend_resume_thread.ipynb) | โœ… Tested | Service-managed & in-memory thread persistence patterns (converted from Python script) | #### ๐Ÿ“Š Observability (`observability/`) | Notebook | Description | |----------|-------------| | ๐Ÿ‘๏ธ [Agent Observability](agent-framework/observability/1-azure_ai_agent_observability.ipynb) | Trace LLM calls, tool executions, token usage with Application Insights | | ๐Ÿ’ฌ [Chat Client Observability](agent-framework/observability/2-azure_ai_chat_client_with_observability.ipynb) | Monitor Azure AI chat clients with multiple tools | #### ๐ŸŽจ Development UI (`devui/`) | Implementation | Description | |----------|-------------| | ๐ŸŒ [In-Memory Mode](agent-framework/devui/in_memory_mode.py) | Quick-start web interface for testing agents | | ๐Ÿ“ [Sample Agents](agent-framework/devui/) | Pre-built examples: Foundry agent, weather agent, spam workflow, fanout workflow | ### ๐Ÿ“Š Phase 7: Quality & Operations **Location:** `observability-and-evaluations/` | Notebook | Description | |----------|-------------| | ๐Ÿ‘๏ธ [Observability](observability-and-evaluations/1-Observability.ipynb) | Monitoring and telemetry | | ๐Ÿ“ˆ [Evaluation](observability-and-evaluations/2-evaluation.ipynb) | Quality assessment and benchmarking | ### ๐Ÿ—ฃ๏ธ Phase 8: AI Language Services with Low-Code Workflows **Location:** `ai-language/` | Implementation | Description | |----------|-------------| | ๐Ÿ”ค [AI Language Service Lab](ai-language/README.md) | Low-code Logic Apps for PII removal, language detection, and translation. Build workflow solutions for processing multilingual customer feedback with privacy compliance and centralized analytics. | ### ๐Ÿ‘๏ธ Phase 9: AI Vision Services with Low-Code Solutions **Location:** `ai-vision/` | Implementation | Description | |----------|-------------| | ๐Ÿ‘€ [AI Vision Lab Guide](ai-vision/README.md) | Azure AI Vision low-code exercises including OCR, face detection, image analysis, and video indexing using Vision Studio | | ๐Ÿ““ [AI Vision Services Notebook](ai-vision/LabFiles/AI_vision_services_lab.ipynb) | Hands-on Jupyter notebook for computer vision capabilities | ### ๐Ÿ“„ Phase 10: Content Understanding & Document Classification **Location:** `content-understanding/` | Implementation | Description | |----------|-------------| | ๐Ÿ“„ [Content Understanding Lab Guide](content-understanding/README.md) | Azure AI Content Understanding for document classification and field extraction from bundled PDF files | | ๐Ÿ““ [Classifier Notebook](content-understanding/classifier.ipynb) | Hands-on Jupyter notebook for building document classifiers and analyzers | | ๐Ÿ [Content Understanding Client](content-understanding/content_understanding_client.py) | Python client implementation for Azure AI Content Understanding API | | ๐Ÿ“‹ [Sample Data](content-understanding/Data/) | Sample PDF documents for testing classification and extraction workflows | ### ๐Ÿ›ก๏ธ Phase 11: Responsible AI & Content Safety **Location:** `responsible-ai/` | Implementation | Description | |----------|-------------| | ๐Ÿ›ก๏ธ [Responsible AI Lab Guide](responsible-ai/README.md) | Comprehensive exploration of AI safety including manual and automated evaluations, content safety filters, PII detection and masking | | ๐Ÿ“Š [Evaluation Data](responsible-ai/Files/Evaluations/) | Manual and automated evaluation datasets for AI model testing | | ๐Ÿ›ก๏ธ [Content Safety Data](responsible-ai/Files/Content_Safety/) | Bulk datasets for text and image moderation testing | | ๐Ÿ“š [Sample Documents](responsible-ai/Files/Contoso/) | Corporate documents for PII detection and content analysis exercises | --- ## ๐Ÿ”ง Environment Setup ### ๐Ÿ“‹ System Requirements **Essential Components:** - ๐Ÿ [Python 3.10+](https://www.python.org/downloads/) - Latest stable version - โ˜๏ธ [Azure Subscription](https://ai.azure.com) - Active subscription with Azure AI Foundry access - ๐Ÿ’ป [Visual Studio Code](https://code.visualstudio.com/) - Recommended development environment - ๐Ÿ› ๏ธ [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) - For resource management - ๐Ÿ“ฆ [Git](https://git-scm.com/downloads) - Version control **Knowledge Prerequisites:** - โœ… Intermediate Python programming skills - โœ… Basic understanding of machine learning concepts - โœ… Familiarity with REST APIs and web services - โœ… Experience with Azure services (recommended) ### ๐Ÿ”ง Development Environment Setup **Visual Studio Code (Recommended)** ```powershell # Install required extensions code --install-extension ms-python.python code --install-extension ms-toolsai.jupyter ``` **Alternative: JupyterLab** ```powershell # Launch JupyterLab jupyter lab ``` --- ## ๐Ÿ› ๏ธ Troubleshooting & Support ### โšก Common Issues & Solutions **Kernel Issues in VS Code:** ```powershell # Refresh kernel registration python -m ipykernel install --user --name=ai-foundry-lab --display-name="AI Foundry Lab" # Reload VS Code: Ctrl+Shift+P โ†’ "Developer: Reload Window" ``` **Environment Activation Problems:** ```powershell # Set PowerShell execution policy Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser # Verify virtual environment python -c "import sys; print(sys.executable)" ``` **Azure Authentication Issues:** ```powershell # Recommended: Use Azure CLI authentication az login --tenant YOUR_TENANT_ID az account show # Alternative: Clear cached credentials and re-login az account clear az login --tenant YOUR_TENANT_ID az account show ``` > **Note:** If you see deprecation warnings about the Azure Account extension in VS Code, use `az login` in the terminal instead. The Azure Account extension for VS Code has been deprecated in favor of Azure CLI authentication. ### ๐Ÿ“š Additional Resources - ๐Ÿ“– [Azure AI Foundry Documentation](https://learn.microsoft.com/en-us/azure/ai-foundry/) - ๐ŸŽฅ [Video Tutorials](https://learn.microsoft.com/en-us/shows/ai-show/) - ๐Ÿ’ก [Best Practices Guide](https://learn.microsoft.com/en-us/azure/ai-services/responsible-use-of-ai-overview) - ๐Ÿ” [GitHub Issues](https://github.com/dhangerkapil/agentic-ai-lab/issues) - Report bugs or request features --- ## ๐Ÿค Community & Contributions ### ๐ŸŒŸ Ways to Contribute - ๐Ÿ“ **Documentation**: Improve clarity and add examples - ๐Ÿ› **Bug Reports**: Help us identify and fix issues - ๐Ÿ’ก **Feature Requests**: Suggest new capabilities and improvements - ๐Ÿ”„ **Pull Requests**: Contribute code and enhancements ### ๐Ÿ“‹ Contribution Guidelines Please review our [Contributing Guide](CONTRIBUTING.md) for: - Code style and formatting standards - Testing requirements and procedures - Pull request process and review criteria - Community guidelines and expectations --- ## ๐Ÿ“„ License & Attribution **License:** MIT License **Repository:** [github.com/dhangerkapil/agentic-ai-lab](https://github.com/dhangerkapil/agentic-ai-lab)