From ac5159b8929d2fec61f8a2d3388f2233b4a88496 Mon Sep 17 00:00:00 2001 From: Ravi Teja Pidaparthi Date: Mon, 9 Jun 2025 14:06:29 -0700 Subject: [PATCH 1/6] Sample for a2a --- .../mortgage_market_insights_agent.agent | 19 ++++ a2a-sample/readme.md | 102 ++++++++++++++++++ a2a-sample/skills/bing_search.skill | 5 + 3 files changed, 126 insertions(+) create mode 100644 a2a-sample/mortgage_market_insights_agent.agent create mode 100644 a2a-sample/readme.md create mode 100644 a2a-sample/skills/bing_search.skill diff --git a/a2a-sample/mortgage_market_insights_agent.agent b/a2a-sample/mortgage_market_insights_agent.agent new file mode 100644 index 0000000..62b1e80 --- /dev/null +++ b/a2a-sample/mortgage_market_insights_agent.agent @@ -0,0 +1,19 @@ +# AI Foundry Agent Definition +name: MortgageMarketInsightsAgent +description: Retrieves real-time data using Bing, including rates, regional trends, policy changes, and external guidance. +model: gpt-4o +instructions: You are a real-time market assistant for mortgage lending. Use Bing Search to retrieve current mortgage rates, regional housing trends, policy updates, and market forecasts. Summarize relevant findings clearly and cite the source when appropriate. Do not answer questions about specific loan products, personal documentation, or user financial scenarios—those should be handled by the Home Loan Guide Agent. +top_p: 0 +temperature: 0 +tools: + - type: bing_grounding + bing_grounding: + connections: + - connection_id: /subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/connections/agentsbinggrounding +tool_resources: {} +events: [] +inputs: [] +outputs: [] +system_prompts: {} +response_format: auto +id: asst_8vfrJwY26XYXzNfCzhJu2IZA diff --git a/a2a-sample/readme.md b/a2a-sample/readme.md new file mode 100644 index 0000000..1db13e1 --- /dev/null +++ b/a2a-sample/readme.md @@ -0,0 +1,102 @@ + +## Windows instructions for sample + +### CLone repo +```bash +git clone https://github.com/neuroglia-io/a2a-net +cd a2a-net +``` + +### Install .NET SDK 9.0 + +Download and install the .NET SDK 9.0 from the official Microsoft website: + +- [Download .NET SDK 9.0](https://dotnet.microsoft.com/download/dotnet/9.0) + +Alternatively, using winget (Windows Package Manager): + +```powershell +winget install Microsoft.DotNet.SDK.9 +``` + +### Authenticate with Azure CLI + +Ensure Azure CLI is installed. If not, install it from [Azure CLI](https://aka.ms/installazurecliwindows). + +Log in to Azure: + +```powershell +az login +``` + +Get the access token: + +```powershell +$token = az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv +``` + +### Run the .NET project + +```powershell +dotnet run --project .\samples\semantic-kernel\a2a-net.Samples.SemanticKernel.Client\a2a-net.Samples.SemanticKernel.Client.csproj ` + --server "https://eastus.api.azureml.ms/workflows/a2a/v1.0/subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/agents/asst_8vfrJwY26XYXzNfCzhJu2IZA?api-version=2024-12-01-preview" ` + --auth "Bearer=$token" ` + --streaming +``` + +## Linux instructions for sample + +### CLone repo +```bash +git clone https://github.com/neuroglia-io/a2a-net +cd a2a-net +``` + +### Install .NET SDK 9.0 +```bash +wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +sudo dpkg -i packages-microsoft-prod.deb +rm packages-microsoft-prod.deb +``` + +```bash +sudo apt-get update && \ + sudo apt-get install -y dotnet-sdk-9.0 +``` + +### Install Azure CLI (if needed) + +If Azure CLI is not installed, run the following commands: + +```bash +curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash +``` + +### Authenticate with Azure CLI +Log in to Azure: +```bash +az login +``` + +Get the access token: +```bash +token=$(az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv) +``` + + +### Run the .NET project +```bash +dotnet run --project ./samples/semantic-kernel/a2a-net.Samples.SemanticKernel.Client/a2a-net.Samples.SemanticKernel.Client.csproj --server https://eastus.api.azureml.ms/workflows/a2a/v1.0/subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/agents/asst_8vfrJwY26XYXzNfCzhJu2IZA?api-version=2024-12-01-preview --auth "Bearer=$token" --streaming +``` + +## Prompts +What are the current 30-year fixed mortgage rates in California? +What is the mortgage rate trend for the past 3 months? +Are there any new homebuyer assistance programs in Texas? +Has the FHA loan limit changed for 2024? +Is it a good time to refinance my mortgage? +What is the forecast for housing prices in 2024? +What are the best cities for first-time homebuyers in the US? +Are mortgage rates expected to drop in Q3 2024? +What are current real estate trends in Seattle? +What are the new tax benefits for homeowners in 2024? \ No newline at end of file diff --git a/a2a-sample/skills/bing_search.skill b/a2a-sample/skills/bing_search.skill new file mode 100644 index 0000000..6d9fc40 --- /dev/null +++ b/a2a-sample/skills/bing_search.skill @@ -0,0 +1,5 @@ +# AI Foundry Skill Definition +type: bing_grounding +bing_grounding: + connections: + - connection_id: /subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/connections/agentsbinggrounding From 41ad81b901700c4e86df7edc5ee8dc0c7f7d3f24 Mon Sep 17 00:00:00 2001 From: Ravi Teja Pidaparthi Date: Mon, 9 Jun 2025 14:08:35 -0700 Subject: [PATCH 2/6] Fix --- a2a-sample/readme.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/a2a-sample/readme.md b/a2a-sample/readme.md index 1db13e1..716a230 100644 --- a/a2a-sample/readme.md +++ b/a2a-sample/readme.md @@ -90,13 +90,13 @@ dotnet run --project ./samples/semantic-kernel/a2a-net.Samples.SemanticKernel.Cl ``` ## Prompts -What are the current 30-year fixed mortgage rates in California? -What is the mortgage rate trend for the past 3 months? -Are there any new homebuyer assistance programs in Texas? -Has the FHA loan limit changed for 2024? -Is it a good time to refinance my mortgage? -What is the forecast for housing prices in 2024? -What are the best cities for first-time homebuyers in the US? -Are mortgage rates expected to drop in Q3 2024? -What are current real estate trends in Seattle? -What are the new tax benefits for homeowners in 2024? \ No newline at end of file +- What are the current 30-year fixed mortgage rates in California? +- What is the mortgage rate trend for the past 3 months? +- Are there any new homebuyer assistance programs in Texas? +- Has the FHA loan limit changed for 2024? +- Is it a good time to refinance my mortgage? +- What is the forecast for housing prices in 2024? +- What are the best cities for first-time homebuyers in the US? +- Are mortgage rates expected to drop in Q3 2024? +- What are current real estate trends in Seattle? +- What are the new tax benefits for homeowners in 2024? \ No newline at end of file From 7d78fc40e7b58eac374869965706cc9c1157db5d Mon Sep 17 00:00:00 2001 From: Ravi Teja Pidaparthi Date: Mon, 9 Jun 2025 14:10:33 -0700 Subject: [PATCH 3/6] Fix --- a2a-sample/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a2a-sample/readme.md b/a2a-sample/readme.md index 716a230..77f0d95 100644 --- a/a2a-sample/readme.md +++ b/a2a-sample/readme.md @@ -1,7 +1,7 @@ ## Windows instructions for sample -### CLone repo +### CLone a2a-net repo ```bash git clone https://github.com/neuroglia-io/a2a-net cd a2a-net @@ -46,7 +46,7 @@ dotnet run --project .\samples\semantic-kernel\a2a-net.Samples.SemanticKernel.Cl ## Linux instructions for sample -### CLone repo +### CLone a2a-net repo ```bash git clone https://github.com/neuroglia-io/a2a-net cd a2a-net From d584b98c75961dbe53f7d9065f9dffdf566bafa2 Mon Sep 17 00:00:00 2001 From: Ravi Teja Pidaparthi Date: Mon, 9 Jun 2025 14:46:39 -0700 Subject: [PATCH 4/6] Http tests --- .vscode/settings.json | 30 ++++++++++++ a2a-sample/http/scripts/auth.js | 21 ++++++++ a2a-sample/http/test.http | 87 +++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 a2a-sample/http/scripts/auth.js create mode 100644 a2a-sample/http/test.http diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2aa4c0c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "[json]": { + "editor.quickSuggestions": false, + "editor.suggest.showWords": false, + "editor.suggest.showSnippets": true, + "editor.formatOnSave": true, + "editor.defaultFormatter": "vscode.json-language-features" + }, + "editor.tokenColorCustomizations": { + "textMateRules": [ + { + "scope": [ + "string.key.json" + ], + "settings": { + "foreground": "#FF8800", + "fontStyle": "bold" + } + }, + { + "scope": [ + "constant.numeric.json" + ], + "settings": { + "foreground": "#2AF598" + } + } + ] + } +} \ No newline at end of file diff --git a/a2a-sample/http/scripts/auth.js b/a2a-sample/http/scripts/auth.js new file mode 100644 index 0000000..135dec4 --- /dev/null +++ b/a2a-sample/http/scripts/auth.js @@ -0,0 +1,21 @@ +const { exec } = require('child_process'); +const util = require('util'); +const execPromise = util.promisify(exec); + +async function runProcess(command) { + try { + const { stdout, stderr } = await execPromise(command); + return "Bearer " + stdout.replace(/\r?\n|\r/g, ''); + } catch (error) { + return ""; + } +} + +async function getAccessToken() { + return await runProcess('az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv') +} + +module.exports = { + getAccessToken +}; + diff --git a/a2a-sample/http/test.http b/a2a-sample/http/test.http new file mode 100644 index 0000000..7172363 --- /dev/null +++ b/a2a-sample/http/test.http @@ -0,0 +1,87 @@ +# @no-reject-unauthorized + +{{ + const { getAccessToken } = require('./scripts/auth.js') + exports.bearerToken = getAccessToken() + exports.a2aAgentUrl = "https://eastus.api.azureml.ms/workflows/a2a/v1.0/subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/agents/asst_8vfrJwY26XYXzNfCzhJu2IZA" +}} + + +### Get Agent Card +# @name agent +GET {{a2aAgentUrl}}/.well-known/agent.json?api-version=2025-05-15-preview +Content-Type: application/json +Authorization: {{bearerToken}} + +{{ + const { ok } = require('assert') + test.status(200); +}} + + +### Start new chat session +{{ + const { v4: uuidv4 } = require('uuid') + exports.sessionId = uuidv4() + $global.requestNum = 1; +}} + +### Send message to agent +# @name task +# @depends agent + +{{ + const { v4: uuidv4 } = require('uuid') + exports.taskId = uuidv4() + + $global.requestNum++ +}} + +POST {{a2aAgentUrl}} +Content-Type: application/json +Authorization: {{bearerToken}} + +{ + "jsonrpc": "2.0", + "method": "tasks/send", + "id": "{{$global.requestNum}}", + "params": { + "id": "{{taskId}}", + "sessionId": "{{sessionId}}", + "message": { + "role": "user", + "parts": [ + { + "type": "text", + "text": "What are the current 30-year fixed mortgage rates in California?" + } + ] + } + } +} + +{{ + const { ok, strictEqual } = require('assert') + test.status(200); +}} + +### Get task from Agent + +POST {{a2aAgentUrl}} +Content-Type: application/json +Authorization: {{bearerToken}} + +{ + "jsonrpc": "2.0", + "method": "tasks/get", + "id": "{{task.id}}", + "params": { + "id": "{{task.result.id}}", + "historyLength": 10 + } +} + +{{ + const { ok, strictEqual } = require('assert') + test.status(200); +}} \ No newline at end of file From bfba7b063bdb894f0a010a0946b5218a3a1e10cd Mon Sep 17 00:00:00 2001 From: Ravi Teja Pidaparthi Date: Mon, 9 Jun 2025 15:59:14 -0700 Subject: [PATCH 5/6] Fix readme --- a2a-sample/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a2a-sample/readme.md b/a2a-sample/readme.md index 77f0d95..81e0cf9 100644 --- a/a2a-sample/readme.md +++ b/a2a-sample/readme.md @@ -35,7 +35,7 @@ Get the access token: $token = az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv ``` -### Run the .NET project +### Interact with an existing foundry agent using dotnet a2a client ```powershell dotnet run --project .\samples\semantic-kernel\a2a-net.Samples.SemanticKernel.Client\a2a-net.Samples.SemanticKernel.Client.csproj ` @@ -84,7 +84,7 @@ token=$(az account get-access-token --scope "https://ai.azure.com/.default" --qu ``` -### Run the .NET project +### Interact with an existing foundry agent using dotnet a2a client ```bash dotnet run --project ./samples/semantic-kernel/a2a-net.Samples.SemanticKernel.Client/a2a-net.Samples.SemanticKernel.Client.csproj --server https://eastus.api.azureml.ms/workflows/a2a/v1.0/subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/agents/asst_8vfrJwY26XYXzNfCzhJu2IZA?api-version=2024-12-01-preview --auth "Bearer=$token" --streaming ``` From ea7188f5484c1ad0e887a4db61b7ab1d943eec5f Mon Sep 17 00:00:00 2001 From: Ravi Teja Pidaparthi Date: Mon, 9 Jun 2025 16:04:10 -0700 Subject: [PATCH 6/6] Fix readme --- a2a-sample/readme.md | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/a2a-sample/readme.md b/a2a-sample/readme.md index 81e0cf9..2bb396f 100644 --- a/a2a-sample/readme.md +++ b/a2a-sample/readme.md @@ -1,13 +1,13 @@ -## Windows instructions for sample +## Windows -### CLone a2a-net repo +Clone a2a-net repo ```bash git clone https://github.com/neuroglia-io/a2a-net cd a2a-net ``` -### Install .NET SDK 9.0 +Install .NET SDK 9.0 (if needed) Download and install the .NET SDK 9.0 from the official Microsoft website: @@ -19,10 +19,7 @@ Alternatively, using winget (Windows Package Manager): winget install Microsoft.DotNet.SDK.9 ``` -### Authenticate with Azure CLI - -Ensure Azure CLI is installed. If not, install it from [Azure CLI](https://aka.ms/installazurecliwindows). - +Ensure Azure CLI is installed. If not, install it from [Azure CLI](https://aka.ms/installazurecliwindows). Log in to Azure: ```powershell @@ -30,13 +27,11 @@ az login ``` Get the access token: - ```powershell $token = az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv ``` -### Interact with an existing foundry agent using dotnet a2a client - +Interact with an existing foundry agent using dotnet a2a client ```powershell dotnet run --project .\samples\semantic-kernel\a2a-net.Samples.SemanticKernel.Client\a2a-net.Samples.SemanticKernel.Client.csproj ` --server "https://eastus.api.azureml.ms/workflows/a2a/v1.0/subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/agents/asst_8vfrJwY26XYXzNfCzhJu2IZA?api-version=2024-12-01-preview" ` @@ -44,15 +39,15 @@ dotnet run --project .\samples\semantic-kernel\a2a-net.Samples.SemanticKernel.Cl --streaming ``` -## Linux instructions for sample +## Linux -### CLone a2a-net repo +CLone a2a-net repo ```bash git clone https://github.com/neuroglia-io/a2a-net cd a2a-net ``` -### Install .NET SDK 9.0 +Install .NET SDK 9.0 (if needed) ```bash wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb @@ -64,16 +59,12 @@ sudo apt-get update && \ sudo apt-get install -y dotnet-sdk-9.0 ``` -### Install Azure CLI (if needed) - -If Azure CLI is not installed, run the following commands: - +Install Azure CLI (if needed) ```bash curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash ``` -### Authenticate with Azure CLI -Log in to Azure: +Authenticate with Azure CLI ```bash az login ``` @@ -83,8 +74,7 @@ Get the access token: token=$(az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv) ``` - -### Interact with an existing foundry agent using dotnet a2a client +Interact with an existing foundry agent using dotnet a2a client ```bash dotnet run --project ./samples/semantic-kernel/a2a-net.Samples.SemanticKernel.Client/a2a-net.Samples.SemanticKernel.Client.csproj --server https://eastus.api.azureml.ms/workflows/a2a/v1.0/subscriptions/921496dc-987f-410f-bd57-426eb2611356/resourceGroups/ai-agents-karthik-eu/providers/Microsoft.MachineLearningServices/workspaces/project-demo-eu-fw7g/agents/asst_8vfrJwY26XYXzNfCzhJu2IZA?api-version=2024-12-01-preview --auth "Bearer=$token" --streaming ```