Skip to content

Anthropic

Rasmus Wulff Jensen edited this page Jan 27, 2026 · 4 revisions

NuGet README

Features

  • AgentFactory (AnthropicAgentFactory)
  • AIToolsFactory integration (tools in AnthropicAgentOptions.Tools)
  • Thinking budget via BudgetTokens
  • Requires MaxOutputTokens on agent creation

Package

dotnet add package AgentFrameworkToolkit.Anthropic

Quick start

AnthropicAgentFactory agentFactory = new("<apiKey>");
AnthropicAgent agent = agentFactory.CreateAgent(new AnthropicAgentOptions
{
    Model = "claude-haiku-4-5",
    MaxOutputTokens = 2000,
    BudgetTokens = 1024,
    Instructions = "You are a nice AI"
});

AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);

Connection options

  • ApiKey (required)
  • NetworkTimeout (optional)
  • Endpoint (optional, override base URL)

Dependency injection

builder.Services.AddAnthropicAgentFactory("<apiKey>");
builder.Services.AddAnthropicAgentFactory(new AnthropicConnection
{
    ApiKey = "<apiKey>",
    NetworkTimeout = TimeSpan.FromMinutes(5)
});

Notes

Clone this wiki locally