-
-
Notifications
You must be signed in to change notification settings - Fork 5
XAI
Rasmus Wulff Jensen edited this page Dec 26, 2025
·
3 revisions
- AgentFactory (
XAIAgentFactory) - AIToolsFactory integration (tools in
AgentOptions.Tools) - OpenAI-style reasoning settings and
ClientType(ChatClient or ResponsesApi)
dotnet add package AgentFrameworkToolkit.XAI
XAIAgentFactory agentFactory = new("<apiKey>");
XAIAgent agent = agentFactory.CreateAgent(new AgentOptions
{
Model = "grok-4-1-fast-reasoning",
ReasoningEffort = OpenAIReasoningEffort.Low,
Instructions = "You are a nice AI"
});
AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);-
ApiKey(required) -
Endpoint(optional, defaults tohttps://api.x.ai/v1) NetworkTimeoutDefaultClientTypeAdditionalOpenAIClientOptions
builder.Services.AddXAIAgentFactory("<apiKey>");
builder.Services.AddXAIAgentFactory(new XAIConnection
{
ApiKey = "<apiKey>"
});- See AgentFactories for shared options and middleware.
- See AIToolsFactory for tool creation and MCP support.