Files
Roger Barreto 1dde57981e .NET: Add Anthropic Agent Package (#2359)
* WIP

* WIP

* Simple call working

* Update Thinking sample

* Non-Streaming Function calling working

* Update Anthropic Impl

* Public Preps

* UT + IT working

* Update documentation + samples

* Update variable

* Revert nuget.config

* Add IT for BetaService implementation

* Remove polyfill + enable IT to run for netstandard 2.0

* Skipping Anthropic IT's for manual execution and avoid pipeline execution

* Fix compilation error

* Address error in UT

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix warning

* Net 10 update

* Update for NET 10, remove Anthropic.Foundry due to vulnerability

* Final missing adjustments for NET 10

* Address PR comments

* Remove unused code

* Address feedback

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1dde57981e ยท 2025-11-25 11:53:18 +00:00
History
..

Running a simple agent with Anthropic

This sample demonstrates how to create and run a basic agent with Anthropic Claude models.

What this sample demonstrates

  • Creating an AI agent with Anthropic Claude
  • Running a simple agent with instructions
  • Managing agent lifecycle

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • .NET 8.0 SDK or later
  • Anthropic API key configured

Note: This sample uses Anthropic Claude models. For more information, see Anthropic documentation.

Set the following environment variables:

$env:ANTHROPIC_API_KEY="your-anthropic-api-key"  # Replace with your Anthropic API key
$env:ANTHROPIC_MODEL="your-anthropic-model"  # Replace with your Anthropic model

Run the sample

Navigate to the AgentWithAnthropic sample directory and run:

cd dotnet\samples\GettingStarted\AgentWithAnthropic
dotnet run --project .\Agent_Anthropic_Step01_Running

Expected behavior

The sample will:

  1. Create an agent with Anthropic Claude
  2. Run the agent with a simple prompt
  3. Display the agent's response