AgentFrameworkToolkit.Google
1.0.0-preview.251230.1
dotnet add package AgentFrameworkToolkit.Google --version 1.0.0-preview.251230.1
NuGet\Install-Package AgentFrameworkToolkit.Google -Version 1.0.0-preview.251230.1
<PackageReference Include="AgentFrameworkToolkit.Google" Version="1.0.0-preview.251230.1" />
<PackageVersion Include="AgentFrameworkToolkit.Google" Version="1.0.0-preview.251230.1" />
<PackageReference Include="AgentFrameworkToolkit.Google" />
paket add AgentFrameworkToolkit.Google --version 1.0.0-preview.251230.1
#r "nuget: AgentFrameworkToolkit.Google, 1.0.0-preview.251230.1"
#:package AgentFrameworkToolkit.Google@1.0.0-preview.251230.1
#addin nuget:?package=AgentFrameworkToolkit.Google&version=1.0.0-preview.251230.1&prerelease
#tool nuget:?package=AgentFrameworkToolkit.Google&version=1.0.0-preview.251230.1&prerelease
Agent Framework Toolkit @ Google
This package is aimed at Google as an LLM Provider. Check out the General README.md for other providers and shared features in Agent Framework Toolkit.
What is Agent Framework Toolkit?
Agent Framework Toolkit and an opinionated C# wrapper on top of the Microsoft Agent Framework that makes various things easier to work with:
- Easier to set advanced Agent Options (often only needing half or fewer lines of code to do the same things) that normally would need the Breaking Glass approach.
- Easier Tools / MCP Tools Definition
FAQ
Q: If I use the Agent Framework Toolkit, does it limit or hinder what I can do with Microsoft Agent Framework?
A: No, everything you can do with Microsoft Agent Framework can still be done with Agent Framework Toolkit. It is just a wrapper that enables options that are hard to use otherwise
Q: What is the release frequency of Agent Framework Toolkit (can I always use the latest Microsoft Agent Framework release)?
A: This NuGet package is released as often (or more) than the Microsoft Agent Framework. At a minimum, it will be bumped to the latest Microsoft Agent Framework Release within a day of official release. It follows the same versioning scheme as AF, so the same or higher version number will always be compatible with the latest release.
Q: Why are the agents not AIAgent / ChatClientAgents? Are they compatible with the rest of the Microsoft Agent Framework?
A: The specialized agents in Agent Framework Toolkit are all 100% compatible with AF as they simply inherit from AIAgent
Getting Started
- Install the 'AgentFrameworkToolkit.Google' NuGet Package (
dotnet add package AgentFrameworkToolkit.Google) - Get your Google API Key
- Create an
GoogleAgentFactoryinstance (Namespace: AgentFrameworkToolkit.Google) - Use instance to create your
GoogleAgent(which is a regular Microsoft Agent FrameworkAIAgentbehind the scenes)
Minimal Code Example
//Create your AgentFactory
GoogleAgentFactory agentFactory = new GoogleAgentFactory("<apiKey>");
//Create your Agent
AIAgent agent = agentFactory.CreateAgent(model: "gemini-2.5-flash");
AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);
Normal Code Example
//Create your AgentFactory
GoogleAgentFactory agentFactory = new GoogleAgentFactory("<apiKey>");
//Create your Agent
GoogleAgent agent = agentFactory.CreateAgent(new GoogleAgentOptions //Use GoogleAgentOptions overload to access more options
{
Model = "gemini-2.5-flash",
Instructions = "You are a nice AI", //The System Prompt
Tools = [], //Add your tools here
BudgetTokens = 1024, //Set Thinking Budget
});
AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);
Full Code example with ALL options
//Create your AgentFactory (using a connection object for more options)
GoogleAgentFactory agentFactory = new GoogleAgentFactory(new GoogleConnection
{
ApiKey = "<apiKey>",
});
//Create your Agent
GoogleAgent agent = agentFactory.CreateAgent(new GoogleAgentOptions
{
//Mandatory
Model = "gemini-2.5-flash", //Model to use
//Optional (Common)
Name = "MyAgent", //Agent Name
MaxOutputTokens = 2000, //Max allow token
Temperature = 0, //The Temperature of the LLM Call (1 = Normal; 0 = Less creativity)
ThinkingBudget = 5000, //Set Thinking Budget
Instructions = "You are a nice AI", //The System Prompt for the Agent to Follow
Tools = [], //Add your tools for Tool Calling here
ToolCallingMiddleware = async (callingAgent, context, next, token) => //Tool Calling Middleware to Inspect, change, and cancel tool-calling
{
AIFunctionArguments arguments = context.Arguments; //Details on the tool-call that is about to happen
return await next(context, token);
},
OpenTelemetryMiddleware = new OpenTelemetryMiddleware(source: "MyOpenTelemetrySource", telemetryAgent => telemetryAgent.EnableSensitiveData = true), //Configure OpenTelemetry Middleware
//Optional (Rarely used)
Id = "1234", //Set the ID of Agent (else a random GUID is assigned as ID)
Description = "My Description", //Description of the Agent (not used by the LLM)
LoggingMiddleware = new LoggingMiddleware( /* Configure custom logging */),
Services = null, //Setup Tool Calling Service Injection (See https://youtu.be/EGs-Myf5MB4 for more details)
LoggerFactory = null, //Setup logger Factory (Alternative to Middleware)
ChatMessageStoreFactory = context => new MyChatMessageStore(), //Set a custom message store
AIContextProviderFactory = context => new MyAIContextProvider(), //Set a custom AI context provider
AdditionalChatClientAgentOptions = options =>
{
//Option to set even more options if not covered by AgentFrameworkToolkit
},
RawToolCallDetails = Console.WriteLine, //Raw Tool calling Middleware (if you just wish to log what tools are being called. ToolCallingMiddleware is a more advanced version of this)
});
AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- AgentFrameworkToolkit (>= 1.0.0-preview.251230.1)
- Google_GenerativeAI.Microsoft (>= 3.6.1)
- Microsoft.Agents.AI (>= 1.0.0-preview.251219.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on AgentFrameworkToolkit.Google:
| Repository | Stars |
|---|---|
|
rwjdk/MicrosoftAgentFrameworkSamples
Samples demonstrating the Microsoft Agent Framework in C#
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.251230.1 | 36 | 12/30/2025 |
| 1.0.0-preview.251226.1 | 90 | 12/26/2025 |
| 1.0.0-preview.251224.1 | 123 | 12/24/2025 |
| 1.0.0-preview.251222.1 | 489 | 12/22/2025 |
| 1.0.0-preview.251220.1 | 164 | 12/20/2025 |
| 1.0.0-preview.251219.1 | 186 | 12/19/2025 |
| 1.0.0-preview.251217.1 | 292 | 12/17/2025 |
| 1.0.0-preview.251215.1 | 192 | 12/15/2025 |
| 1.0.0-preview.251204.1 | 316 | 12/5/2025 |
| 1.0.0-preview.251201.1 | 441 | 12/1/2025 |
| 1.0.0-preview.251129.1 | 71 | 11/29/2025 |
| 1.0.0-preview.251126.2 | 193 | 11/26/2025 |
| 1.0.0-preview.251126.1 | 138 | 11/26/2025 |
| 1.0.0-preview.251123.1 | 142 | 11/23/2025 |
| 1.0.0-preview.251121.3 | 279 | 11/21/2025 |
| 1.0.0-preview.251121.2 | 310 | 11/21/2025 |
| 1.0.0-preview.251121.1 | 311 | 11/21/2025 |
| 0.0.1-preview2 | 395 | 11/18/2025 |
| 0.0.1-preview1 | 356 | 11/18/2025 |