- Status: Accepted
- Date: 2026-03-16
ClaudeCodeSharpSDK already exposes ManagedCode.ClaudeCodeSharpSDK.Extensions.AI, which adapts the Claude Code CLI runtime to Microsoft.Extensions.AI through ClaudeChatClient : IChatClient. Microsoft Agent Framework provides a general IChatClient.AsAIAgent(...) path plus provider-specific bridge packages such as Microsoft.Agents.AI.GitHub.Copilot for backends that do not implement IChatClient.
Goals:
- enable Claude-backed
AIAgentusage with documented, supported package boundaries - keep the existing core SDK and M.E.AI adapter modular
- provide DI convenience for
AIAgentregistration without inventing a parallel agent runtime
Non-goals:
- implementing a custom
AIAgentruntime like the GitHub Copilot provider - adding MAF hosting/workflow packages or durable orchestration support
- changing core
ClaudeClient/ClaudeThreadbehaviour
Implement Microsoft Agent Framework support as a separate opt-in package, ManagedCode.ClaudeCodeSharpSDK.Extensions.AgentFramework, that composes the existing ClaudeChatClient with Microsoft.Agents.AI ChatClientAgent/AsAIAgent(...) and provides DI registration helpers.
Key points:
- Keep MAF dependency out of core SDK and out of
ManagedCode.ClaudeCodeSharpSDK.Extensions.AI. - Reuse the existing
IChatClientadapter instead of creating a bespoke Claude-specificAIAgent. - Expose DI helpers for both non-keyed and keyed
AIAgentregistration to make the integration first-class for host applications.
flowchart LR
Consumer["Consumer / Host"]
MAFPkg["Extensions.AgentFramework"]
MEAIPkg["Extensions.AI"]
MAF["ChatClientAgent / AsAIAgent"]
Chat["ClaudeChatClient"]
Core["ClaudeClient / ClaudeThread"]
Consumer --> MAFPkg
MAFPkg --> MAF
MAFPkg --> MEAIPkg
MEAIPkg --> Chat
Chat --> Core
- Pros:
- fewer packages for consumers
- no extra adapter project
- Cons:
- forces MAF dependency onto every
IChatClientconsumer - mixes two different integration boundaries into one package
- forces MAF dependency onto every
- Rejected because the repository already treats ecosystem adapters as opt-in boundaries.
- Pros:
- would look similar to
GitHubCopilotAgent - full control over session behaviour
- would look similar to
- Cons:
- duplicates functionality already provided by
ChatClientAgent - increases maintenance and behavioural drift risk
- duplicates functionality already provided by
- Rejected because Claude already exposes the canonical
IChatClientabstraction required by MAF.
- Pros:
- smallest code change
- no new package
- Cons:
- no first-class DI helpers
- no explicit repository boundary for MAF support
- Rejected because the requested integration should exist as a supported package in this repository, not just as an undocumented possibility in consumer code.
- Preserves a clean dependency ladder: core SDK -> M.E.AI adapter -> MAF adapter.
- Aligns with the official Microsoft pattern of separate bridge packages for agent-framework integrations.
- Gives consumers a documented one-package path for MAF registration while keeping direct
AsAIAgent(...)usage intact.
- Adds one more optional NuGet package to maintain.
- Introduces a preview/RC ecosystem dependency surface from Microsoft Agent Framework.
Mitigation:
- keep the integration thin and DI-focused
- verify published dependency version from official NuGet before pinning
- cover the new layer with DI unit tests instead of new auth-dependent integration tests
dotnet build ManagedCode.ClaudeCodeSharpSDK.slnx -c Release -warnaserror- focused agent-framework tests in
ClaudeServiceCollectionExtensionsTests dotnet test --solution ManagedCode.ClaudeCodeSharpSDK.slnx -c Releasedotnet format ManagedCode.ClaudeCodeSharpSDK.slnx
- Feature spec:
docs/Features/agent-framework-integration.md - M.E.AI base layer:
docs/ADR/003-microsoft-extensions-ai-integration.md - Official docs:
https://learn.microsoft.com/en-us/agent-framework/agents/providers/github-copilot?pivots=programming-language-csharp - Reference implementation:
https://github.com/microsoft/agent-framework