-
Notifications
You must be signed in to change notification settings - Fork 477
Fixed broken dependencies and added option to use uv instead of pip and venv #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ed4a50d
fe30e96
5a0cadf
16ba329
b55e660
97f4a09
71865d5
cdaced8
f775e25
d3d40e4
8dc308c
37cae48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
| // README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
| { | ||
| "name": "Python 3", | ||
| // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
| "image": "mcr.microsoft.com/devcontainers/python:1-3.12", | ||
|
|
||
| // Features to add to the dev container. More info: https://containers.dev/features. | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/azure-cli:1": {}, | ||
| "ghcr.io/devcontainers-extra/features/uv:1": {} | ||
| }, | ||
|
|
||
| // Configure tool-specific properties. | ||
| "customizations": { | ||
| // Configure properties specific to VS Code. | ||
| "vscode": { | ||
| "settings": {}, | ||
| "extensions": [ | ||
| "streetsidesoftware.code-spell-checker" | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
| // "forwardPorts": [9000], | ||
|
|
||
| // Use 'portsAttributes' to set default properties for specific forwarded ports. | ||
| // More info: https://containers.dev/implementors/json_reference/#port-attributes | ||
| "portsAttributes": { | ||
| "9000": { | ||
| "label": "Hello Remote World", | ||
| "onAutoForward": "notify" | ||
| } | ||
| }, | ||
|
|
||
| // Use 'postCreateCommand' to run commands after the container is created. | ||
| "postCreateCommand": "pip3 install -r requirements.txt" | ||
|
|
||
| // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
| // "remoteUser": "root" | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,216 @@ | ||||||
|  | ||||||
| # Microsoft AI Agentic Workshop Setup | ||||||
|
|
||||||
| This document describes how to setup and run your AI Agents for the workshop if you are using UV as your python manager. | ||||||
|
|
||||||
| ## Setup & Installation | ||||||
|
|
||||||
| ### 1. Clone the Repository | ||||||
|
|
||||||
| Open VS Code terminal | ||||||
|
|
||||||
| ```bash | ||||||
| git clone <repo_url> # from folder where you want clone to reside | ||||||
| ``` | ||||||
| ### 2. Install Python dependencies | ||||||
|
|
||||||
| With uv, packages are managed through pyproject.toml in the subfolders. Instead of activating a virtual environment, you can use `uv run <python_filename.py> | ||||||
|
|
||||||
| ### 3. Deploy LLM model using Azure AI Foundry | ||||||
|
|
||||||
| 1. Login to ai.azure.com. Create account if you don't already have access to an account. | ||||||
| 2. Create project, use new hub is none exists. This will setup a hub, project container, AI services, Storage account and Key Vault | ||||||
| 3. Use API Key, Azure OpenAI Service endpoint and Project connection string and add to .env file (next step) | ||||||
| 4. On project page, go to Models + endpoints -> Deploy model -> Deploy base model -> gpt-4.1 | ||||||
| 5. Select deployment type (Standard, Global Standard etc.) and region if desired | ||||||
| 6. Customize deployment details to reduce tokens per minute to 10K, disable dynamic quote | ||||||
|
|
||||||
| ### 4. Set up your environment variables and select the agent to run | ||||||
|
|
||||||
| Rename `.env.sample` to `.env` and fill in all required fields: | ||||||
|
|
||||||
| ```bash | ||||||
| ############################################ | ||||||
| # Azure OpenAI – chat model configuration # | ||||||
| ############################################ | ||||||
| # Replace with your model-deployment endpoint in Azure AI Foundry | ||||||
| AZURE_OPENAI_ENDPOINT="https://YOUR-OPENAI-SERVICE-ENDPOINT.openai.azure.com" | ||||||
|
|
||||||
| # Replace with your Foundry project’s API key | ||||||
| AZURE_OPENAI_API_KEY="YOUR-OPENAI-API-KEY" | ||||||
|
|
||||||
| # Connection-string that identifies your Foundry project / workspace. Only needed if you're using Azure Agent Service | ||||||
| AZURE_AI_AGENT_PROJECT_CONNECTION_STRING="YOUR-OPENAI-PROJECT-CONNECTION-STRING" | ||||||
|
|
||||||
| # Model deployment & API version | ||||||
| AZURE_OPENAI_CHAT_DEPLOYMENT="gpt-4.1" | ||||||
| AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME="gpt-4.1" | ||||||
| AZURE_OPENAI_API_VERSION="2025-01-01-preview" | ||||||
| OPENAI_MODEL_NAME="gpt-4.1-2025-04-14" #only applicable for Autogen | ||||||
|
|
||||||
| ############################################ | ||||||
| # Local URLs for backend & MCP server # | ||||||
| ############################################ | ||||||
| BACKEND_URL="http://localhost:7000" | ||||||
| MCP_SERVER_URI="http://localhost:8000/mcp" | ||||||
|
|
||||||
| ############################################ | ||||||
|
|
||||||
| ############################################ | ||||||
| # Agent module to be executed # | ||||||
| ############################################ | ||||||
| # AGENT_MODULE="agents.autogen.multi_agent.reflection_agent" | ||||||
| # AGENT_MODULE="agents.autogen.single_agent.loop_agent" | ||||||
| # AGENT_MODULE="agents.autogen.multi_agent.collaborative_multi_agent_round_robin" | ||||||
| # AGENT_MODULE="agents.autogen.multi_agent.collaborative_multi_agent_selector_group" | ||||||
| # AGENT_MODULE="agents.autogen.multi_agent.handoff_multi_agent_domain" | ||||||
| # AGENT_MODULE="agents.semantic_kernel.multi_agent.collaborative_multi_agent" | ||||||
| # AGENT_MODULE="agents.semantic_kernel.multi_agent.a2a.collaborative_multi_agent" | ||||||
| AGENT_MODULE="agents.autogen.single_agent.loop_agent" | ||||||
|
|
||||||
| # ----------------------------------------------------------- | ||||||
| # If you are experimenting with Logistics-A2A, uncomment: | ||||||
| # LOGISTIC_MCP_SERVER_URI="http://localhost:8100/sse" | ||||||
| # LOGISTICS_A2A_URL="http://localhost:9100" | ||||||
| # ----------------------------------------------------------- | ||||||
|
|
||||||
|
|
||||||
| ############################################################# | ||||||
| # Cosmos DB – state persistence settings # | ||||||
| ############################################################# | ||||||
| # Endpoint for your Cosmos DB account (SQL API) | ||||||
| COSMOSDB_ENDPOINT="https://YOUR-COSMOS-ACCOUNT.documents.azure.com:443/" | ||||||
|
|
||||||
| # --------- Choose ONE authentication method -------------- | ||||||
| # (1) Account key | ||||||
| #COSMOSDB_KEY="YOUR-COSMOS-ACCOUNT-KEY" | ||||||
|
|
||||||
| # (2) Azure AD service-principal (preferred in production) | ||||||
| #AAD_CLIENT_ID="00000000-0000-0000-0000-000000000000" | ||||||
| #AAD_CLIENT_SECRET="YOUR-AAD-CLIENT-SECRET" | ||||||
| #AAD_TENANT_ID="11111111-1111-1111-1111-111111111111" | ||||||
| # ----------------------------------------------------------- | ||||||
|
|
||||||
| # Logical (application) tenant for data isolation | ||||||
| # Leave as "default" unless you partition data by customer / org | ||||||
| DATA_TENANT_ID="default" | ||||||
|
|
||||||
| # Database & container names (created automatically if not present) | ||||||
| COSMOSDB_DB_NAME="ai_state_db" | ||||||
| COSMOSDB_CONTAINER_NAME="state_store" | ||||||
| ``` | ||||||
|
|
||||||
| **Note:** | ||||||
| #### Choosing a State Store | ||||||
|
|
||||||
| - **Do nothing** ➜ the workshop uses an in-memory Python `dict` (fast, but data is lost when the process exits). | ||||||
| - **Fill in the Cosmos variables** ➜ the app automatically switches to an Azure Cosmos DB container with a hierarchical partition-key (`/tenant_id + /id`) so chat history survives restarts and scales across instances. | ||||||
|
|
||||||
| > If neither `COSMOSDB_KEY` nor the AAD credential set is provided, the code silently falls back to the in-memory store. | ||||||
| > **Important:** | ||||||
| > If you choose Cosmos DB and use Azure AD service-principal authentication, you must grant the service principal a custom role for data plane (read/write) access in Cosmos DB. | ||||||
| > See: [Grant data plane access using custom roles in Azure Cosmos DB](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-grant-data-plane-access?tabs=custom-definition%2Ccsharp&pivots=azure-interface-cli) | ||||||
| > | ||||||
| > Without this role, the application will not be able to access or persist chat history in Cosmos DB using Azure AD authentication. | ||||||
|
|
||||||
| #### Make sure your Azure resources are configured to use the correct model deployment names, endpoints, and API versions. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### 5. Run MCP Server | ||||||
|
|
||||||
| Navigate to ```agentic_ai/backend_services``` folder, and in terminal window with virtual environment activated, run MCP server | ||||||
|
||||||
| Navigate to ```agentic_ai/backend_services``` folder, and in terminal window with virtual environment activated, run MCP server | |
| Navigate to the ```mcp``` folder at the project root, and in a terminal window with virtual environment activated, run the MCP server |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation references 'run_application.sh' but the actual script created in this PR is named 'run_applications_uv.sh'. The documentation should be updated to reference the correct script name.
| bash run_application.sh | |
| bash run_applications_uv.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.12 |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||
| [project] | ||||||||||
| name = "applications" | ||||||||||
| version = "0.1.0" | ||||||||||
| description = "Add your description here" | ||||||||||
| readme = "README.md" | ||||||||||
| requires-python = ">=3.12" | ||||||||||
| dependencies = [ | ||||||||||
| "a2a-sdk>=0.3.7", | ||||||||||
| "autogen-agentchat==0.7.1", | ||||||||||
| "autogen-ext[mcp]==0.7.1", | ||||||||||
| "azure-cosmos==4.9.0", | ||||||||||
| "chainlit==1.3.2", | ||||||||||
| "faker==26.0.0", | ||||||||||
| "fastapi==0.115.12", | ||||||||||
| "fastmcp==2.7.1", | ||||||||||
|
Comment on lines
+14
to
+15
|
||||||||||
| "fastapi==0.115.12", | |
| "fastmcp==2.7.1", | |
| "fastapi==0.116.1", | |
| "fastmcp==2.12.0", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
| # Determine project root | ||
| PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)") | ||
|
|
||
| # Set paths relative to project root | ||
| MCP_DIR="$PROJECT_ROOT/mcp" | ||
| APP_DIR="$PROJECT_ROOT/agentic_ai/applications" | ||
| OUTPUT_LOG="$PROJECT_ROOT/logs/output.log" | ||
| ERROR_LOG="$PROJECT_ROOT/logs/error.log" | ||
|
|
||
| mkdir -p "$PROJECT_ROOT/logs" | ||
|
|
||
| # Function to add timestamps and service prefixes | ||
| log_with_prefix() { | ||
| local service_name="$1" | ||
| awk -v service="$service_name" '{print "[" strftime("%Y-%m-%d %H:%M:%S") "] [" service "] " $0; fflush()}' | ||
| } | ||
|
|
||
| # Start MCP server | ||
| echo "Starting MCP server..." | ||
| cd "$MCP_DIR" | ||
| uv run mcp_service.py 2>&1 | log_with_prefix "MCP" >> $OUTPUT_LOG & | ||
| MCP_PID=$! | ||
|
|
||
| sleep 5 | ||
|
|
||
| # Start backend | ||
| echo "Starting backend..." | ||
| cd "$APP_DIR" | ||
| uv run backend.py 2>&1 | log_with_prefix "BACKEND" >> $OUTPUT_LOG & | ||
| BACKEND_PID=$! | ||
|
|
||
| sleep 5 | ||
| uv run streamlit run frontend.py 2>&1 | log_with_prefix "FRONTEND" >> $OUTPUT_LOG & | ||
| FRONTEND_PID=$! | ||
|
|
||
| echo "MCP Server PID: $MCP_PID" | ||
| echo "Backend PID: $BACKEND_PID" | ||
| echo "Frontend PID: $FRONTEND_PID" | ||
| echo "Project root: $PROJECT_ROOT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The postCreateCommand references a requirements.txt file, but this PR introduces pyproject.toml for dependency management with UV. This command should be updated to use UV for dependency installation, such as 'uv sync' or removed if not needed.