# 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
[](https://ai.azure.com)
[](https://python.org)
[](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)