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
2 changes: 1 addition & 1 deletion .claude/agents/architecture-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Reviewer: architecture-reviewer
## Files Reviewed

- List each file included in the PR with its full path
- Example: `src/Observability/Runtime/Scopes/InvokeAgentScope.cs`
- Example: `src/Tooling/Core/Services/McpToolServerConfigurationService.cs`

---

Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/code-review-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You are a senior engineering manager specializing in code quality and review coo
- Balances criticism with recognition of good practices

3. **Enforce Standards**: Ensure all code adheres to project standards:
- .NET 8.0 / netstandard2.0 compatibility as appropriate
- .NET 8.0 compatibility for maintained packages
- Copyright headers on all C# files: `// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.`
- No "Kairo" legacy references
- Nullable reference types enabled
Expand Down
6 changes: 3 additions & 3 deletions .claude/agents/prd-task-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ You are a senior software engineer with deep expertise in the Microsoft Agent 36
1. **Analyze PRD Context**: Thoroughly review the provided PRD, understanding both explicit requirements and implicit dependencies. Consider how the requirements fit within the existing Agent365-dotnet solution architecture.

2. **Align with Project Architecture**: Every task you generate must align with the established patterns in this repository:
- The solution structure with four core modules: Runtime, Observability, Notifications, and Tooling
- The solution structure with three core modules: Runtime, Notifications, and Tooling
- The Core + Extensions pattern (core packages are framework-agnostic, extensions add framework-specific integration)
- Package naming conventions (`Microsoft.Agents.A365.*`)
- OpenTelemetry-based observability patterns
- External observability integration via the Microsoft OpenTelemetry .NET distro; see `docs/observability-migration.md`
- MCP (Model Context Protocol) tool integration patterns
- Target frameworks: `net8.0` for most packages, `netstandard2.0` for Runtime/Hosting
- Target framework: `net8.0` for all maintained packages

3. **Consider Design Documentation**: Reference the detailed architecture in `docs/design.md` and per-package design documents in `src/<module>/<package>/docs/design.md` when breaking down tasks. Ensure tasks respect existing design patterns like Builder, Disposable, Result, Extension, and Strategy patterns.

Expand Down
6 changes: 3 additions & 3 deletions .claude/agents/prd-writer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ You are a senior software engineering architect with deep expertise in creating
- Security and compliance considerations

2. **Contextual Awareness**: You have access to the Agent365 .NET SDK codebase context. When creating PRDs, ensure alignment with:
- The solution structure with four core modules (Runtime, Observability, Notifications, Tooling)
- The solution structure with three core modules (Runtime, Notifications, Tooling)
- Existing architectural patterns (Core + Extensions pattern for framework integrations)
- .NET 8.0 and netstandard2.0 target frameworks
- OpenTelemetry-based observability patterns
- .NET 8.0 target framework
- External observability integration via the Microsoft OpenTelemetry .NET distro; see `docs/observability-migration.md`
- MCP (Model Context Protocol) integration patterns
- Async/await conventions for I/O operations
- Required copyright headers and code standards
Expand Down
10 changes: 4 additions & 6 deletions .claude/agents/task-implementer.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,13 @@ Before submitting code, verify:
## Package-Specific Guidelines

### Runtime (`Microsoft.Agents.A365.Runtime`)
- Target: `netstandard2.0` for broad compatibility
- Target: `net8.0`
- Use `OperationResult` pattern for method returns
- Follow `TenantContextHelper` patterns for context extraction

### Observability (`Microsoft.Agents.A365.Observability.*`)
- Use `IDisposable` pattern for scope classes
- Follow `InvokeAgentScope`, `InferenceScope`, `ExecuteToolScope` patterns
- Integrate with OpenTelemetry's `Activity` and `ActivitySource`
- Use `BaggageBuilder` for context propagation
### External Observability
- Observability source and releases are maintained in the Microsoft OpenTelemetry .NET distro.
- Do not reintroduce retired projects or packages; use `docs/observability-migration.md` for application integrations.

### Notifications (`Microsoft.Agents.A365.Notifications`)
- Target: `net8.0`
Expand Down
4 changes: 1 addition & 3 deletions .claude/agents/test-coverage-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ The Microsoft Agent 365 SDK for .NET uses:
```
src/Tests/
├── Runtime.Tests/
├── Microsoft.Agents.A365.Observability.Runtime.Tests/
├── Microsoft.Agents.A365.Observability.Runtime.IntegrationTests/
├── Microsoft.Agents.A365.Observability.Hosting.Tests/
├── Microsoft.Agents.A365.Notifications.Tests/
├── Microsoft.Agents.A365.Tooling.Tests/
├── Microsoft.Agents.A365.Tooling.Core.Tests/
└── Microsoft.Agents.A365.Tooling.Extensions.*.Tests/
```

Expand Down
21 changes: 7 additions & 14 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# GitHub Copilot Instructions for Agent365-dotnet

The Microsoft Agent 365 SDK (C#/.NET) extends the Microsoft 365 Agents SDK with enterprise capabilities across four modules: **Observability**, **Notifications**, **Runtime**, and **Tooling**. Packages publish to NuGet under the `Microsoft.Agents.A365.*` prefix.
The Microsoft Agent 365 SDK (C#/.NET) extends the Microsoft 365 Agents SDK with enterprise capabilities across three modules: **Notifications**, **Runtime**, and **Tooling**. Packages publish to NuGet under the `Microsoft.Agents.A365.*` prefix.

Observability is maintained in the [Microsoft OpenTelemetry .NET distro](https://github.com/microsoft/opentelemetry-distro-dotnet/tree/main). Do not reintroduce retired Observability projects or packages here; see [migration guidance](../docs/observability-migration.md).

## Build, Test, and Lint

Expand All @@ -17,7 +19,7 @@ dotnet test src/Microsoft.Agents.A365.Sdk.sln
./build/build.ps1 -Pack # produce NuGet packages

# Run all tests in ONE project
dotnet test src/Tests/Microsoft.Agents.A365.Runtime.Tests/Microsoft.Agents.A365.Runtime.Tests.csproj
dotnet test src/Tests/Runtime.Tests/Microsoft.Agents.A365.Runtime.Tests.csproj

# Run a SINGLE test or test class (xUnit primary; some MSTest)
dotnet test src/Microsoft.Agents.A365.Sdk.sln --filter "FullyQualifiedName~TenantContextHelperTests"
Expand All @@ -27,16 +29,15 @@ dotnet test src/Microsoft.Agents.A365.Sdk.sln --filter "Name=Extract_Returns_Ten
dotnet format src/Microsoft.Agents.A365.Sdk.sln --verify-no-changes
```

CI (`.github/workflows/ci.yml`) builds and tests in **Release** with `--no-restore`/`--no-build`, then packs. Some Observability/Tooling tests read `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY`, and `AZURE_OPENAI_DEPLOYMENT` from the environment.
CI (`.github/workflows/ci.yml`) builds and tests in **Release** with `--no-restore`/`--no-build`, then packs into a fresh per-run directory and rejects retired Observability filenames before uploading. It does not publish to nuget.org.

Pre-commit hooks (`.pre-commit-config.yaml`, install with `pip install pre-commit && pre-commit install`) run gitleaks (secret scanning), whitespace/EOL fixers, and `dotnet format`.

## Architecture

The SDK follows a consistent **Core + Extensions** pattern. Each module has a `Core`/`Runtime` package with base functionality and per-framework extension packages (SemanticKernel, AgentFramework, AzureAIFoundry, OpenAI). Source lives under `src/<Module>/`:
The SDK follows a **Core + Extensions** pattern for framework integrations, with Tooling extension packages for SemanticKernel, AgentFramework, and AzureAIFoundry. Source lives under `src/<Module>/`:

- **Runtime** (`src/Runtime/`) — multi-tenant context extraction (`TenantContextHelper` pulls tenant/worker IDs from `HttpContext` claims/headers/items) and the result pattern (`OperationResult` / `OperationError`).
- **Observability** (`src/Observability/`) — OpenTelemetry distributed tracing. Configured via a fluent `Builder` API; tracing uses disposable scope classes (`InvokeAgentScope`, `InferenceScope`, `ExecuteToolScope`) that auto-end spans on dispose. `BaggageMiddleware` seeds tenant/agent context into OTel baggage. A custom `Agent365Exporter` (gated by the `EnableAgent365Exporter` env var) exports spans.
- **Notifications** (`src/Notification/`) — event routing for M365 (Teams, email, Office) via `AgentNotification`; sub-channels like `agents:email`, `agents:word`, `agents:excel`, `agents:powerpoint`.
- **Tooling** (`src/Tooling/`) — Model Context Protocol (MCP) server discovery and tool registration via `IMcpToolServerConfigurationService`, with framework-specific registration extensions.

Expand All @@ -48,14 +49,7 @@ Detailed design docs: `docs/design.md`; build internals: `build/BUILD.md`.

- **Central package management**: ALL NuGet versions live in `src/Directory.Packages.props`. Add a version there, then reference the package without a `Version` attribute in the `.csproj`. Never put versions in project files.
- **Common build props** (`src/Directory.Build.props`): `TreatWarningsAsErrors=true`, `Nullable=enable`, and `GenerateDocumentationFile=true` are global. Warnings — including invalid XML-doc `cref`s (CS1574) — fail the build. Write valid XML doc comments.
- **Target frameworks**: most packages target `net8.0`; some Runtime/Hosting packages target `netstandard2.0` (no implicit usings; `LangVersion` 8.0). Guard framework-specific code accordingly.
- **Observability export config — coordinated change required**: these three must stay in sync. If you change ONE, verify the other two:
| Constant | Location |
|---|---|
| `ProdObservabilityScope` (via `GetObservabilityAuthenticationScope()`) | `src/Observability/Runtime/Common/EnvironmentUtils.cs` |
| `DefaultEndpointHost` | `src/Observability/Runtime/Tracing/Exporters/Agent365ExporterOptions.cs` |
| Export URL path (`BuildEndpointPath()`) | `src/Observability/Runtime/Tracing/Exporters/Agent365ExporterCore.cs` |
Snapshot tests in `src/Tests/Microsoft.Agents.A365.Observability.Runtime.Tests/Tracing/Exporters/ExportConfigConsistencyTests.cs` catch accidental drift but not intentional-but-incomplete updates — confirm values are correct for the target environment.
- **Target frameworks**: all maintained packages target `net8.0`.
- **Tests** mirror source under `src/Tests/` (e.g. `Microsoft.Agents.A365.Runtime.Tests`). xUnit is primary (some MSTest), with Moq for mocking and FluentAssertions for assertions.

## Coding agent rules
Expand Down Expand Up @@ -178,4 +172,3 @@ When Copilot detects violations:
- Project files (`.csproj`, `.sln`), configuration files (`.json`, `.xml`, `.yaml`, `.md`) do not require copyright headers
- Build output directories (`bin/`, `obj/`)
- AssemblyInfo.cs files that are auto-generated

21 changes: 15 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI - Build, Test, and Publish
name: CI - Build, Test, and Pack

permissions:
contents: read
Expand Down Expand Up @@ -48,14 +48,23 @@ jobs:
AZURE_OPENAI_DEPLOYMENT: ${{ vars.AZURE_OPENAI_DEPLOYMENT }}

- name: Pack
run: dotnet pack Microsoft.Agents.A365.Sdk.sln --no-build --configuration Release --output ../NuGetPackages

- name: Copy NuGet packages
shell: pwsh
run: |
mkdir -p ~/drop/dotnet/NuGetPackages && cp -v ../NuGetPackages/*.nupkg $_
$outputPath = Join-Path $env:RUNNER_TEMP "agent365-packages-$([guid]::NewGuid().ToString('N'))"
New-Item -ItemType Directory -Path $outputPath | Out-Null
dotnet pack Microsoft.Agents.A365.Sdk.sln --no-build --configuration Release --output $outputPath
if ($LASTEXITCODE -ne 0) { throw "Pack failed" }
if (Get-ChildItem -LiteralPath $outputPath -Filter 'Microsoft.Agents.A365.Observability.*' -File) {
throw "Retired Observability packages must not be released."
}
if (-not (Get-ChildItem -LiteralPath $outputPath -Filter '*.nupkg' -File)) {
throw "Pack produced no NuGet packages."
}
"PACKAGE_OUTPUT=$outputPath" >> $env:GITHUB_ENV

- name: Upload NuGet packages as artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dotnet-packages-${{ github.run_number }}
path: ~/drop/dotnet/NuGetPackages/*
path: ${{ env.PACKAGE_OUTPUT }}/*
if-no-files-found: error
12 changes: 5 additions & 7 deletions .specify/memory/constitution.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Follow-up TODOs: None
## Core Principles

### I. Core + Extensions Architecture
Every capability MUST follow the Core + Extensions pattern. Core packages provide framework-agnostic base functionality. Extension packages integrate with specific frameworks (Semantic Kernel, Agent Framework, Azure AI Foundry, OpenAI). This separation ensures loose coupling, independent versioning, and allows consumers to adopt only what they need. New features MUST NOT add framework-specific code to core packages.
Every capability MUST follow the Core + Extensions pattern. Core packages provide framework-agnostic base functionality. Extension packages integrate with specific frameworks (Semantic Kernel, Agent Framework, Azure AI Foundry). This separation ensures loose coupling, independent versioning, and allows consumers to adopt only what they need. New features MUST NOT add framework-specific code to core packages.

### II. Multi-Tenant First
All components MUST support multi-tenant scenarios from the ground up. Tenant context extraction via `TenantContextHelper` MUST be used consistently for all tenant/worker ID retrieval. Hard-coded tenant identifiers are forbidden. Tenant context MUST propagate through OpenTelemetry baggage in distributed tracing scenarios.
All components MUST support multi-tenant scenarios from the ground up. Tenant context extraction via `TenantContextHelper` MUST be used consistently for all tenant/worker ID retrieval. Hard-coded tenant identifiers are forbidden. Applications integrating external tracing MUST preserve tenant isolation during context propagation.

### III. Strict Code Quality (NON-NEGOTIABLE)
- All compiler warnings MUST be treated as errors (`TreatWarningsAsErrors=true`)
Expand All @@ -44,16 +44,15 @@ All components MUST support multi-tenant scenarios from the ground up. Tenant co
All service operations that can fail MUST use the `OperationResult` pattern. Return `OperationResult.Success` for success cases. Return `OperationResult.Failed(OperationError)` with appropriate HTTP status codes for failures. Exceptions MUST NOT be thrown for expected business logic failures.

### V. Disposable Scope Pattern
All tracing scopes (`InvokeAgentScope`, `InferenceScope`, `ExecuteToolScope`) MUST implement `IDisposable`. Consumers MUST use `using` statements or blocks to ensure proper span lifecycle management. Spans are automatically ended on dispose. New scope types MUST follow this pattern.
Consumers of disposable resources MUST use `using` statements or blocks to ensure proper lifecycle management. Observability scope implementations are maintained outside this repository in the Microsoft OpenTelemetry .NET distro, not in new SDK projects. See `docs/observability-migration.md` for the supported application integration.

### VI. Test Coverage Required
Every package MUST have a corresponding test project in `src/Tests/`. Tests MUST cover happy path scenarios, error conditions, edge cases, and framework-specific extension behavior. Pre-commit validation MUST pass: solution builds without warnings and all tests pass.

## Architecture Constraints

### Target Frameworks
- **Primary packages**: `net8.0`
- **Runtime/Hosting packages**: `netstandard2.0` (for broader ASP.NET Core compatibility)
- **Maintained packages**: `net8.0`
- **Test projects**: `net8.0`

### Package Management
Expand Down Expand Up @@ -81,8 +80,7 @@ Before committing any changes, developers MUST verify:
### Design Patterns
| Pattern | When to Use | Example |
|---------|-------------|---------|
| Builder | Complex configuration | `Builder.WithAgentFramework().Build()` |
| Disposable | Resource/span lifecycle | `using var scope = InvokeAgentScope.Start(...)` |
| Disposable | Resource lifecycle | Dispose owned clients and streams using `using` |
| Result | Operation outcomes | `OperationResult.Success`, `OperationResult.Failed(...)` |
| Extension Methods | Framework integration | `app.OnAgenticEmailNotification(...)` |

Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@ All notable changes to the Microsoft Agent 365 SDK will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [3.0.0] - Unreleased

### Breaking Changes

- **Observability packages retired** - This repository no longer builds or releases
`Microsoft.Agents.A365.Observability.Runtime`,
`Microsoft.Agents.A365.Observability.Hosting`,
`Microsoft.Agents.A365.Observability.Extensions.AgentFramework`,
`Microsoft.Agents.A365.Observability.Extensions.SemanticKernel`, or
`Microsoft.Agents.A365.Observability.Extensions.OpenAI`.
Notifications, Runtime, Tooling, and the Tooling extensions remain maintained.
- **Application migration required** - Use
[`Microsoft.OpenTelemetry`](https://www.nuget.org/packages/Microsoft.OpenTelemetry)
from the [Microsoft OpenTelemetry .NET distro](https://github.com/microsoft/opentelemetry-distro-dotnet/tree/main).
This is not a drop-in replacement or an automatic dependency redirect; follow the
[Observability migration guide](docs/observability-migration.md) for package replacement,
configuration, authentication, context propagation, and framework instrumentation.

## [2.0.0] - 2026-10-20

Expand Down
Loading
Loading