Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ graph TD

<img width="1881" height="1000" alt="image" src="https://github.com/user-attachments/assets/59a9dcaf-9291-403c-b8b0-1195c1375aac" />

> E.g `New Platform`:

<img width="1887" height="606" alt="image" src="https://github.com/user-attachments/assets/02f9e726-6274-490e-8db7-111885a13871" />

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.
Expand Down Expand Up @@ -202,7 +206,7 @@ graph TD

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1329-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-1325-limegreen" alt="Total views">
<p>Refresh Date: 2026-01-29</p>
</div>
<!-- END BADGE -->
4 changes: 2 additions & 2 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

----------

Expand Down Expand Up @@ -347,7 +347,7 @@ terraform apply

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1329-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-1325-limegreen" alt="Total views">
<p>Refresh Date: 2026-01-29</p>
</div>
<!-- END BADGE -->
31 changes: 24 additions & 7 deletions src/a2a/status_automation.ps1
Original file line number Diff line number Diff line change
@@ -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"
}
57 changes: 48 additions & 9 deletions src/app/agents/deploy_real_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions terraform-infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

----------

Expand Down Expand Up @@ -119,7 +119,7 @@ graph TD;

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1329-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-1325-limegreen" alt="Total views">
<p>Refresh Date: 2026-01-29</p>
</div>
<!-- END BADGE -->
26 changes: 25 additions & 1 deletion terraform-infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion terraform-infrastructure/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource_group_name = "RG-AI-Retail-DemoX9"
resource_group_name = "RG-AI-Retail-DemoX0"
location = "eastus2"
name_prefix = "zava"

Expand Down