Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Replaces the community-maintained Anthropic.SDK package with the official Anthropic package (v11.0.0), now maintained by Anthropic in collaboration with Microsoft.

Changes

  • Directory.Packages.props: Anthropic.SDK 5.8.0 → Anthropic 11.0.0
  • QuickstartClient: Updated to new API surface
  • ChatWithTools: Package reference only (no code changes)

API Migration

The official SDK uses IChatClient integration instead of direct Messages API:

// Before (Anthropic.SDK)
using var client = new AnthropicClient(new APIAuthentication(apiKey))
    .Messages
    .AsBuilder()
    .UseFunctionInvocation()
    .Build();

// After (official Anthropic)
using var client = new AnthropicClient(new() { APIKey = apiKey })
    .AsIChatClient("claude-haiku-4-5-20251001")
    .AsBuilder()
    .UseFunctionInvocation()
    .Build();

The new SDK provides better integration with Microsoft.Extensions.AI patterns and is the recommended package for production use.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://crl3.digicert.com:443/DigiCertHighAssuranceEVRootCA.crl
    • Triggering command: /usr/share/dotnet/dotnet dotnet build --configuration Release (http block)
  • http://crl3.digicert.com:443/NETFoundationProjectsCodeSigningCA.crl
    • Triggering command: /usr/share/dotnet/dotnet dotnet build --configuration Release (http block)
  • http://crl3.digicert.com:443/sha2-assured-ts.crl
    • Triggering command: /usr/share/dotnet/dotnet dotnet build --configuration Release (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

The repo currently uses the Anthropic.SDK for one or more samples. Please update it to instead use the official Anthropic package


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update samples to use official Anthropic package Migrate from Anthropic.SDK to official Anthropic package Dec 9, 2025
Copilot AI requested a review from stephentoub December 9, 2025 23:29
@stephentoub stephentoub marked this pull request as ready for review December 9, 2025 23:32
@stephentoub stephentoub requested a review from halter73 December 9, 2025 23:32
@stephentoub stephentoub enabled auto-merge (squash) December 9, 2025 23:32
@PederHP
Copy link
Member

PederHP commented Dec 10, 2025

Verified that I can run the sample after the migration.

@stephentoub stephentoub merged commit f9239b0 into main Dec 10, 2025
10 checks passed
@stephentoub stephentoub deleted the copilot/update-anthropic-sdk-samples branch December 10, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants