Skip to content
Open
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
30 changes: 30 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
}
21 changes: 21 additions & 0 deletions a2a-sample/http/scripts/auth.js
Original file line number Diff line number Diff line change
@@ -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
};

87 changes: 87 additions & 0 deletions a2a-sample/http/test.http
Original file line number Diff line number Diff line change
@@ -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);
}}
19 changes: 19 additions & 0 deletions a2a-sample/mortgage_market_insights_agent.agent
Original file line number Diff line number Diff line change
@@ -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
92 changes: 92 additions & 0 deletions a2a-sample/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

## Windows

Clone a2a-net repo
```bash
git clone https://github.com/neuroglia-io/a2a-net
cd a2a-net
```

Install .NET SDK 9.0 (if needed)

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
```

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
```

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" `
--auth "Bearer=$token" `
--streaming
```

## Linux

CLone a2a-net repo
```bash
git clone https://github.com/neuroglia-io/a2a-net
cd a2a-net
```

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
rm packages-microsoft-prod.deb
```

```bash
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-9.0
```

Install Azure CLI (if needed)
```bash
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
```

Authenticate with Azure CLI
```bash
az login
```

Get the access token:
```bash
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
```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?
5 changes: 5 additions & 0 deletions a2a-sample/skills/bing_search.skill
Original file line number Diff line number Diff line change
@@ -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