AgentFrameworkToolkit.Cerebras
1.0.0-rc4
dotnet add package AgentFrameworkToolkit.Cerebras --version 1.0.0-rc4
NuGet\Install-Package AgentFrameworkToolkit.Cerebras -Version 1.0.0-rc4
<PackageReference Include="AgentFrameworkToolkit.Cerebras" Version="1.0.0-rc4" />
<PackageVersion Include="AgentFrameworkToolkit.Cerebras" Version="1.0.0-rc4" />
<PackageReference Include="AgentFrameworkToolkit.Cerebras" />
paket add AgentFrameworkToolkit.Cerebras --version 1.0.0-rc4
#r "nuget: AgentFrameworkToolkit.Cerebras, 1.0.0-rc4"
#:package AgentFrameworkToolkit.Cerebras@1.0.0-rc4
#addin nuget:?package=AgentFrameworkToolkit.Cerebras&version=1.0.0-rc4&prerelease
#tool nuget:?package=AgentFrameworkToolkit.Cerebras&version=1.0.0-rc4&prerelease
Agent Framework Toolkit @ Cerebras
This package is aimed at Cerebras 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 is 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
- Easier Structured Output calling with
.RunAsync<>(...)even on AIAgents using Tool Calling Middleware.
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.Cerebras' NuGet Package (
dotnet add package AgentFrameworkToolkit.Cerebras) - Get your Cerebras API Key
- Create a
CerebrasAgentFactoryinstance (Namespace: AgentFrameworkToolkit.Cerebras) - Use instance to create your
CerebrasAgent(which is a regular Microsoft Agent FrameworkAIAgentbehind the scenes)
Note: Cerebras currently supports the OpenAI Chat Completions style endpoint in this toolkit integration.
ClientType.ResponsesApiis not supported and will fail at runtime.
Minimal Code Example
//Create your AgentFactory
CerebrasAgentFactory agentFactory = new CerebrasAgentFactory("<API Key>");
//Create your Agent
CerebrasAgent agent = agentFactory.CreateAgent(CerebrasChatModels.GptOss120B);
AgentResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);
Normal Code Example
//Create your AgentFactory
CerebrasAgentFactory agentFactory = new CerebrasAgentFactory("<API Key>");
//Create your Agent
CerebrasAgent agent = agentFactory.CreateAgent(new AgentOptions //Use AgentOptions overload to access more options
{
Model = CerebrasChatModels.GptOss120B,
Temperature = 0,
Instructions = "You are a nice AI", //The System Prompt
Tools = [], //Add your tools here
});
AgentResponse 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)
CerebrasAgentFactory agentFactory = new CerebrasAgentFactory(new CerebrasConnection
{
//Endpoint = "<endpoint>", //Optional if not using default Cerebras Endpoint
ApiKey = "<apiKey>",
NetworkTimeout = TimeSpan.FromMinutes(5), //Set call timeout
DefaultClientType = ClientType.ChatClient, //Set default Client Type for each agent (ChatClient or ResponsesAPI)
AdditionalOpenAIClientOptions = options =>
{
//Set additional properties if needed
}
});
//Create your Agent
CerebrasAgent agent = agentFactory.CreateAgent(new AgentOptions
{
//Mandatory
Model = CerebrasChatModels.GptOss120B, //Model to use
//Optional (Common)
Name = "MyAgent", //Agent Name
Temperature = 0, //The Temperature of the LLM Call (1 = Normal; 0 = Less creativity)
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)
MaxOutputTokens = 2000, //Max allow token
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)
ChatHistoryProviderFactory = 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)
RawHttpCallDetails = details => //Intercept the raw HTTP Call to the LLM (great for advanced debugging sessions)
{
Console.WriteLine(details.RequestUrl);
Console.WriteLine(details.RequestData);
Console.WriteLine(details.ResponseData);
},
ClientFactory = client =>
{
//Interact with the underlying Client-factory
return client;
}
});
AgentResponse 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.OpenAI (>= 1.0.0-rc4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-rc4 | 33 | 3/12/2026 |
| 1.0.0-rc3.1 | 35 | 3/8/2026 |