Skip to content

Commit 154c44a

Browse files
kshyjuCopilot
andcommitted
Merge main into feat/durable_task and resolve conflicts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents bb96bf6 + c5ed820 commit 154c44a

2,998 files changed

Lines changed: 200285 additions & 131676 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/dotnet/devcontainer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"name": "C# (.NET)",
3-
//"image": "mcr.microsoft.com/devcontainers/dotnet",
4-
// Workaround for https://github.com/devcontainers/images/issues/1752
5-
"build": {
6-
"dockerfile": "dotnet.Dockerfile"
7-
},
3+
"image": "mcr.microsoft.com/devcontainers/dotnet",
84
"features": {
95
"ghcr.io/devcontainers/features/azure-cli:1.2.9": {},
106
"ghcr.io/devcontainers/features/github-cli:1": {

.devcontainer/dotnet/dotnet.Dockerfile

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Sample Validation Setup
2+
description: Sets up the environment for sample validation (checkout, Node.js, Copilot CLI, Azure login, Python)
3+
4+
inputs:
5+
azure-client-id:
6+
description: Azure Client ID for OIDC login
7+
required: true
8+
azure-tenant-id:
9+
description: Azure Tenant ID for OIDC login
10+
required: true
11+
azure-subscription-id:
12+
description: Azure Subscription ID for OIDC login
13+
required: true
14+
python-version:
15+
description: The Python version to set up
16+
required: false
17+
default: "3.12"
18+
os:
19+
description: The operating system to set up
20+
required: false
21+
default: "Linux"
22+
23+
runs:
24+
using: "composite"
25+
steps:
26+
- name: Set up Node.js environment
27+
uses: actions/setup-node@v4
28+
29+
- name: Install Copilot CLI
30+
shell: bash
31+
run: npm install -g @github/copilot
32+
33+
- name: Test Copilot CLI
34+
shell: bash
35+
run: copilot -p "What can you do in one sentence?"
36+
37+
- name: Azure CLI Login
38+
uses: azure/login@v2
39+
with:
40+
client-id: ${{ inputs.azure-client-id }}
41+
tenant-id: ${{ inputs.azure-tenant-id }}
42+
subscription-id: ${{ inputs.azure-subscription-id }}
43+
44+
- name: Set up python and install the project
45+
uses: ./.github/actions/python-setup
46+
with:
47+
python-version: ${{ inputs.python-version }}
48+
os: ${{ inputs.os }}

.github/copilot-instructions.md

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,19 @@
11
# GitHub Copilot Instructions
22

3-
This repository contains both Python and C# code.
4-
All python code resides under the `python/` directory.
5-
All C# code resides under the `dotnet/` directory.
3+
Microsoft Agent Framework - a multi-language framework for building, orchestrating, and deploying AI agents.
64

7-
The purpose of the code is to provide a framework for building AI agents.
5+
## Repository Structure
86

9-
When contributing to this repository, please follow these guidelines:
7+
- `python/` - Python implementation → see [python/AGENTS.md](../python/AGENTS.md)
8+
- `dotnet/` - C#/.NET implementation → see [dotnet/AGENTS.md](../dotnet/AGENTS.md)
9+
- `docs/` - Design documents and architectural decision records
1010

11-
## C# Code Guidelines
11+
## Architectural Decision Records (ADRs)
1212

13-
Here are some general guidelines that apply to all code.
13+
ADRs in `docs/decisions/` capture significant design decisions and their rationale. They document considered alternatives, trade-offs, and the reasoning behind choices.
1414

15-
- The top of all *.cs files should have a copyright notice: `// Copyright (c) Microsoft. All rights reserved.`
16-
- All public methods and classes should have XML documentation comments.
17-
- After adding, modifying or deleting code, run `dotnet build`, and then fix any reported build errors.
18-
- After adding or modifying code, run `dotnet format` to automatically fix any formatting errors.
15+
**Templates:**
16+
- `adr-template.md` - Full template with detailed sections
17+
- `adr-short-template.md` - Abbreviated template for simpler decisions
1918

20-
### C# Sample Code Guidelines
21-
22-
Sample code is located in the `dotnet/samples` directory.
23-
24-
When adding a new sample, follow these steps:
25-
26-
- The sample should be a standalone .net project in one of the subdirectories of the samples directory.
27-
- The directory name should be the same as the project name.
28-
- The directory should contain a README.md file that explains what the sample does and how to run it.
29-
- The README.md file should follow the same format as other samples.
30-
- The csproj file should match the directory name.
31-
- The csproj file should be configured in the same way as other samples.
32-
- The project should preferably contain a single Program.cs file that contains all the sample code.
33-
- The sample should be added to the solution file in the samples directory.
34-
- The sample should be tested to ensure it works as expected.
35-
- A reference to the new samples should be added to the README.md file in the parent directory of the new sample.
36-
37-
The sample code should follow these guidelines:
38-
39-
- Configuration settings should be read from environment variables, e.g. `var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");`.
40-
- Environment variables should use upper snake_case naming convention.
41-
- Secrets should not be hardcoded in the code or committed to the repository.
42-
- The code should be well-documented with comments explaining the purpose of each step.
43-
- The code should be simple and to the point, avoiding unnecessary complexity.
44-
- Prefer inline literals over constants for values that are not reused. For example, use `new ChatClientAgent(chatClient, instructions: "You are a helpful assistant.")` instead of defining a constant for "instructions".
45-
- Ensure that all private classes are sealed
46-
- Use the Async suffix on the name of all async methods that return a Task or ValueTask.
47-
- Prefer defining variables using types rather than var, to help users understand the types involved.
48-
- Follow the patterns in the samples in the same directories where new samples are being added.
49-
- The structure of the sample should be as follows:
50-
- The top of the Program.cs should have a copyright notice: `// Copyright (c) Microsoft. All rights reserved.`
51-
- Then add a comment describing what the sample is demonstrating.
52-
- Then add the necessary using statements.
53-
- Then add the main code logic.
54-
- Finally, add any helper methods or classes at the bottom of the file.
55-
56-
### C# Unit Test Guidelines
57-
58-
Unit tests are located in the `dotnet/tests` directory in projects with a `.UnitTests.csproj` suffix.
59-
60-
Unit tests should follow these guidelines:
61-
62-
- Use `this.` for accessing class members
63-
- Add Arrange, Act and Assert comments for each test
64-
- Ensure that all private classes, that are not subclassed, are sealed
65-
- Use the Async suffix on the name of all async methods
66-
- Use the Moq library for mocking objects where possible
67-
- Validate that each test actually tests the target behavior, e.g. we should not have tests that creates a mock, calls the mock and then verifies that the mock was called, without the target code being involved. We also shouldn't have tests that test language features, e.g. something that the compiler would catch anyway.
68-
- Avoid adding excessive comments to tests. Instead favour clear easy to understand code.
69-
- Follow the patterns in the unit tests in the same project or classes to which new tests are being added
19+
When proposing architectural changes, create an ADR to capture options considered and the decision rationale. See [docs/decisions/README.md](../docs/decisions/README.md) for the full process.

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ workflows:
2323
- any-glob-to-any-file:
2424
- dotnet/src/Microsoft.Agents.AI.Workflows/**
2525
- dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/**
26-
- dotnet/samples/GettingStarted/Workflow/**
26+
- dotnet/samples/03-workflows/**
2727
- python/packages/main/agent_framework/_workflow/**
2828
- python/samples/getting_started/workflow/**
2929

.github/workflows/dotnet-build-and-test.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
Write-Host "Launching Azure Cosmos DB Emulator"
9393
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
9494
Start-CosmosDbEmulator -NoUI -Key "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
95-
echo "COSMOS_EMULATOR_AVAILABLE=true" >> $env:GITHUB_ENV
95+
echo "COSMOSDB_EMULATOR_AVAILABLE=true" >> $env:GITHUB_ENV
9696
9797
- name: Setup dotnet
9898
uses: actions/setup-dotnet@v5.1.0
@@ -205,20 +205,17 @@ jobs:
205205
COSMOSDB_ENDPOINT: https://localhost:8081
206206
COSMOSDB_KEY: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
207207
# OpenAI Models
208-
OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }}
209-
OpenAI__ChatModelId: ${{ vars.OPENAI__CHATMODELID }}
210-
OpenAI__ChatReasoningModelId: ${{ vars.OPENAI__CHATREASONINGMODELID }}
208+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
209+
OPENAI_CHAT_MODEL_NAME: ${{ vars.OPENAI_CHAT_MODEL_NAME }}
210+
OPENAI_REASONING_MODEL_NAME: ${{ vars.OPENAI_REASONING_MODEL_NAME }}
211211
# Azure OpenAI Models
212-
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
213-
AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }}
212+
AZURE_OPENAI_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME }}
213+
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME }}
214+
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }}
214215
# Azure AI Foundry
215-
AzureAI__Endpoint: ${{ secrets.AZUREAI__ENDPOINT }}
216-
AzureAI__DeploymentName: ${{ vars.AZUREAI__DEPLOYMENTNAME }}
217-
AzureAI__BingConnectionId: ${{ vars.AZUREAI__BINGCONECTIONID }}
218-
FOUNDRY_PROJECT_ENDPOINT: ${{ vars.FOUNDRY_PROJECT_ENDPOINT }}
219-
FOUNDRY_MEDIA_DEPLOYMENT_NAME: ${{ vars.FOUNDRY_MEDIA_DEPLOYMENT_NAME }}
220-
FOUNDRY_MODEL_DEPLOYMENT_NAME: ${{ vars.FOUNDRY_MODEL_DEPLOYMENT_NAME }}
221-
FOUNDRY_CONNECTION_GROUNDING_TOOL: ${{ vars.FOUNDRY_CONNECTION_GROUNDING_TOOL }}
216+
AZURE_AI_PROJECT_ENDPOINT: ${{ vars.AZURE_AI_PROJECT_ENDPOINT }}
217+
AZURE_AI_MODEL_DEPLOYMENT_NAME: ${{ vars.AZURE_AI_MODEL_DEPLOYMENT_NAME }}
218+
AZURE_AI_BING_CONNECTION_ID: ${{ vars.AZURE_AI_BING_CONNECTION_ID }}
222219

223220
# Generate test reports and check coverage
224221
- name: Generate test reports
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#
2+
# Dedicated .NET integration tests workflow, called from the manual integration test orchestrator.
3+
# Only runs integration test matrix entries (net10.0 and net472).
4+
#
5+
6+
name: dotnet-integration-tests
7+
8+
on:
9+
workflow_call:
10+
inputs:
11+
checkout-ref:
12+
description: "Git ref to checkout (e.g., refs/pull/123/head)"
13+
required: true
14+
type: string
15+
16+
permissions:
17+
contents: read
18+
id-token: write
19+
20+
jobs:
21+
dotnet-integration-tests:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- { targetFramework: "net10.0", os: "ubuntu-latest", configuration: Release }
27+
- { targetFramework: "net472", os: "windows-latest", configuration: Release }
28+
runs-on: ${{ matrix.os }}
29+
environment: integration
30+
timeout-minutes: 60
31+
steps:
32+
- uses: actions/checkout@v6
33+
with:
34+
ref: ${{ inputs.checkout-ref }}
35+
persist-credentials: false
36+
sparse-checkout: |
37+
.
38+
.github
39+
dotnet
40+
python
41+
workflow-samples
42+
43+
- name: Start Azure Cosmos DB Emulator
44+
if: runner.os == 'Windows'
45+
shell: pwsh
46+
run: |
47+
Write-Host "Launching Azure Cosmos DB Emulator"
48+
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
49+
Start-CosmosDbEmulator -NoUI -Key "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
50+
echo "COSMOS_EMULATOR_AVAILABLE=true" >> $env:GITHUB_ENV
51+
52+
- name: Setup dotnet
53+
uses: actions/setup-dotnet@v5.1.0
54+
with:
55+
global-json-file: ${{ github.workspace }}/dotnet/global.json
56+
57+
- name: Build dotnet solutions
58+
shell: bash
59+
run: |
60+
export SOLUTIONS=$(find ./dotnet/ -type f -name "*.slnx" | tr '\n' ' ')
61+
for solution in $SOLUTIONS; do
62+
dotnet build $solution -c ${{ matrix.configuration }} --warnaserror
63+
done
64+
65+
- name: Azure CLI Login
66+
uses: azure/login@v2
67+
with:
68+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
69+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
70+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
71+
72+
- name: Set up Durable Task and Azure Functions Integration Test Emulators
73+
if: matrix.os == 'ubuntu-latest'
74+
uses: ./.github/actions/azure-functions-integration-setup
75+
76+
- name: Run Integration Tests
77+
shell: bash
78+
run: |
79+
export INTEGRATION_TEST_PROJECTS=$(find ./dotnet -type f -name "*IntegrationTests.csproj" | tr '\n' ' ')
80+
for project in $INTEGRATION_TEST_PROJECTS; do
81+
target_frameworks=$(dotnet msbuild $project -getProperty:TargetFrameworks -p:Configuration=${{ matrix.configuration }} -nologo 2>/dev/null | tr -d '\r')
82+
if [[ "$target_frameworks" == *"${{ matrix.targetFramework }}"* ]]; then
83+
dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --filter "Category!=IntegrationDisabled"
84+
else
85+
echo "Skipping $project - does not support target framework ${{ matrix.targetFramework }} (supports: $target_frameworks)"
86+
fi
87+
done
88+
env:
89+
COSMOSDB_ENDPOINT: https://localhost:8081
90+
COSMOSDB_KEY: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
91+
OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }}
92+
OpenAI__ChatModelId: ${{ vars.OPENAI__CHATMODELID }}
93+
OpenAI__ChatReasoningModelId: ${{ vars.OPENAI__CHATREASONINGMODELID }}
94+
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
95+
AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }}
96+
AzureAI__Endpoint: ${{ secrets.AZUREAI__ENDPOINT }}
97+
AzureAI__DeploymentName: ${{ vars.AZUREAI__DEPLOYMENTNAME }}
98+
AzureAI__BingConnectionId: ${{ vars.AZUREAI__BINGCONECTIONID }}
99+
FOUNDRY_PROJECT_ENDPOINT: ${{ vars.FOUNDRY_PROJECT_ENDPOINT }}
100+
FOUNDRY_MEDIA_DEPLOYMENT_NAME: ${{ vars.FOUNDRY_MEDIA_DEPLOYMENT_NAME }}
101+
FOUNDRY_MODEL_DEPLOYMENT_NAME: ${{ vars.FOUNDRY_MODEL_DEPLOYMENT_NAME }}
102+
FOUNDRY_CONNECTION_GROUNDING_TOOL: ${{ vars.FOUNDRY_CONNECTION_GROUNDING_TOOL }}

0 commit comments

Comments
 (0)