diff --git a/README.md b/README.md index ddc1ee8..71b5fdc 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,10 @@ graph TD image + > E.g `New Platform`: + + image + 5. **Application Deployment**: - Builds the Docker container with A2A protocol support in the cloud (ACR Build). - Configures the Azure Web App with the generated Agent IDs, A2A endpoints, and credentials. @@ -202,7 +206,7 @@ graph TD
- Total views + Total views

Refresh Date: 2026-01-29

diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index 56a7a91..a03850a 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2026-01-12 +Last updated: 2026-01-29 ---------- @@ -347,7 +347,7 @@ terraform apply
- Total views + Total views

Refresh Date: 2026-01-29

diff --git a/src/a2a/status_automation.ps1 b/src/a2a/status_automation.ps1 index 59fe6fc..27db885 100644 --- a/src/a2a/status_automation.ps1 +++ b/src/a2a/status_automation.ps1 @@ -1,18 +1,35 @@ -# Check A2A Automation Framework Status +param( + [string]$WebAppName = $env:WEB_APP_NAME, + [string]$StatusUrl = $env:A2A_AUTOMATION_STATUS_URL +) + +# Check A2A Automation Framework Status Write-Host "Checking A2A Automation Framework status..." - = Get-Process -Name "python" -ErrorAction SilentlyContinue | Where-Object { .CommandLine -like "*automated_main*" } -if () { +$processes = Get-CimInstance Win32_Process -ErrorAction SilentlyContinue | + Where-Object { $_.CommandLine -like "*automated_main*" } + +if ($processes) { Write-Host "A2A Automation Framework is RUNNING" - Write-Host "Processes: 0" - | Format-Table Id,ProcessName,StartTime + Write-Host "Processes: $($processes.Count)" + $processes | Select-Object ProcessId,Name,CreationDate | Format-Table -AutoSize } else { Write-Host "A2A Automation Framework is STOPPED" } +# Build status URL dynamically +if (-not $StatusUrl -and $WebAppName) { + $StatusUrl = "https://$WebAppName.azurewebsites.net/a2a/automation/status" +} + +if (-not $StatusUrl) { + Write-Host "Automation endpoint not accessible (missing WebAppName or StatusUrl)" + return +} + # Check automation endpoint try { - = Invoke-RestMethod -Uri "https://zava-63f59c9f-app.azurewebsites.net/a2a/automation/status" -TimeoutSec 5 - Write-Host "Automation Status: " + $status = Invoke-RestMethod -Uri $StatusUrl -TimeoutSec 5 + Write-Host "Automation Status: $($status | ConvertTo-Json -Compress)" } catch { Write-Host "Automation endpoint not accessible" } diff --git a/src/app/agents/deploy_real_agents.py b/src/app/agents/deploy_real_agents.py index 706c53e..922c8e4 100644 --- a/src/app/agents/deploy_real_agents.py +++ b/src/app/agents/deploy_real_agents.py @@ -83,25 +83,64 @@ def _create_agent(project_client: AIProjectClient, *, model: str, name: str, ins except TypeError: pass + # Preferred: pass name + definition explicitly (newer SDK signature) + try: + from azure.ai.projects.models import PromptAgentDefinition, AgentKind + + agent_def = PromptAgentDefinition( + kind=AgentKind.PROMPT, + model=model, + instructions=instructions, + ) + return agents.create(name=name, definition=agent_def, description=name) + except Exception: + pass + # Fall back to SDK model definitions try: - from azure.ai.projects.models import PromptAgentDefinition + from azure.ai.projects.models import PromptAgentDefinition, AgentKind - agent_def = PromptAgentDefinition(model=model, name=name, instructions=instructions) + agent_def = PromptAgentDefinition( + kind=AgentKind.PROMPT, + model=model, + instructions=instructions, + ) return agents.create(agent_def) except Exception: pass try: - from azure.ai.projects.models import AgentDefinition + from azure.ai.projects.models import AgentDefinition, AgentKind - agent_def = AgentDefinition(model=model, name=name, instructions=instructions) + agent_def = AgentDefinition(kind=str(AgentKind.PROMPT)) return agents.create(agent_def) except Exception: pass - # Last resort: pass a dict payload - return agents.create({"model": model, "name": name, "instructions": instructions}) + # Try AgentCreateRequest with explicit definition + try: + from azure.ai.projects.models import AgentCreateRequest, PromptAgentDefinition, AgentKind + + agent_def = PromptAgentDefinition( + kind=AgentKind.PROMPT, + model=model, + instructions=instructions, + ) + request = AgentCreateRequest(definition=agent_def, name=name, description=name) + return agents.create(request) + except Exception: + pass + + # Some SDKs require a "definition" wrapper in the payload + payload = { + "name": name, + "kind": "prompt", + "definition": { + "model": model, + "instructions": instructions, + }, + } + return agents.create(payload) if hasattr(agents, "create_prompt_agent"): return agents.create_prompt_agent(model=model, name=name, instructions=instructions) @@ -166,7 +205,7 @@ def deploy_agents(): "Your role is to help customers find products, answer questions about inventory, provide recommendations, and assist with general shopping needs. " "Be friendly, professional, and informative. Keep answers concise and helpful." ), - "model": agent_model_map.get("cora", model_deployment) + "model": agent_model_map.get("cora", "model-router") }, { "name": "Interior Design Specialist", @@ -418,8 +457,8 @@ def deploy_agents(): print(f"WARNING: Failed to write state file: {se}") # Update src/.env with real agent IDs (early propagation) - # NOTE: Terraform generates ../src/.env (workspace-relative), not ../src/app/.env. - env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '.env')) + # NOTE: Terraform generates ../src/.env (workspace-relative). + env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src', '.env')) if os.path.exists(env_path): try: import re diff --git a/terraform-infrastructure/README.md b/terraform-infrastructure/README.md index 1459b9f..4824a75 100644 --- a/terraform-infrastructure/README.md +++ b/terraform-infrastructure/README.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2026-01-12 +Last updated: 2026-01-29 ---------- @@ -119,7 +119,7 @@ graph TD;
- Total views + Total views

Refresh Date: 2026-01-29

diff --git a/terraform-infrastructure/main.tf b/terraform-infrastructure/main.tf index 014dd84..5111645 100644 --- a/terraform-infrastructure/main.tf +++ b/terraform-infrastructure/main.tf @@ -151,6 +151,21 @@ resource "azapi_resource" "ai_project" { depends_on = [azapi_update_resource.ai_foundry_enable_project_mgmt] } +# Grant current principal access to AI Foundry + AI Project for Agents API +resource "azurerm_role_assignment" "ai_foundry_openai_user" { + scope = azapi_resource.ai_foundry.id + role_definition_name = "Cognitive Services OpenAI User" + principal_id = local.principal_id + depends_on = [azapi_resource.ai_foundry] +} + +resource "azurerm_role_assignment" "ai_project_user" { + scope = azapi_resource.ai_project.id + role_definition_name = "Azure AI User" + principal_id = local.principal_id + depends_on = [azapi_resource.ai_project] +} + # === Real Multi-Agent Creation (ochartarotr) === # NOTE: Azure Agents API not yet available via ARM/Terraform (returns 500 Internal Server Error) # Keeping these commented for future use when the API becomes available @@ -1969,7 +1984,9 @@ resource "null_resource" "deploy_multi_agents" { depends_on = [ null_resource.create_env_file, null_resource.ai_model_deployments, - azapi_resource.ai_project + azapi_resource.ai_project, + azurerm_role_assignment.ai_foundry_openai_user, + azurerm_role_assignment.ai_project_user ] provisioner "local-exec" { @@ -2006,6 +2023,13 @@ resource "null_resource" "deploy_multi_agents" { $agentEndpointBase = $rawEndpoint -replace "cognitiveservices\.azure\.com", "services.ai.azure.com" $agentEndpoint = "$agentEndpointBase/api/projects/${local.ai_project_name}" $env:AZURE_AI_PROJECT_ENDPOINT = $agentEndpoint + $env:AZURE_AI_FOUNDRY_ENDPOINT = $rawEndpoint + $env:AZURE_AI_FOUNDRY_NAME = "${local.ai_foundry_name}" + $env:AZURE_AI_PROJECT_NAME = "${local.ai_project_name}" + $env:AZURE_SUBSCRIPTION_ID = "${data.azurerm_client_config.current.subscription_id}" + $env:AZURE_RESOURCE_GROUP = "${azurerm_resource_group.rg.name}" + $env:AZURE_LOCATION = "${var.location}" + $env:AZURE_AI_PROJECT_CONNECTION_STRING = "${var.location}.api.azureml.ms;subscription_id=${data.azurerm_client_config.current.subscription_id};resource_group=${azurerm_resource_group.rg.name};project_name=${local.ai_project_name}" Write-Host "Using Agents API endpoint: $agentEndpoint" # Deploy agents using Python script diff --git a/terraform-infrastructure/terraform.tfvars b/terraform-infrastructure/terraform.tfvars index e1dfd76..1ed8bf8 100644 --- a/terraform-infrastructure/terraform.tfvars +++ b/terraform-infrastructure/terraform.tfvars @@ -1,4 +1,4 @@ -resource_group_name = "RG-AI-Retail-DemoX9" +resource_group_name = "RG-AI-Retail-DemoX0" location = "eastus2" name_prefix = "zava"