Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9df8433
feat(icons): add XAI icon component
tdabasinskas Nov 24, 2025
4f426ad
docs(examples): add xai modelconfig example with grok-4-1-fast-reasoning
tdabasinskas Nov 24, 2025
042c219
feat(types): add XAI provider support with OpenAI-compatible configur…
tdabasinskas Nov 24, 2025
2463b33
feat(providers): add xAI model provider support
tdabasinskas Nov 24, 2025
66c361e
feat(api): add XAI model provider support
tdabasinskas Nov 24, 2025
4d2e61f
feat(agent): add support for XAI model provider
tdabasinskas Nov 24, 2025
f0b9153
feat(client): add xAI model configuration support
tdabasinskas Nov 24, 2025
d65b0df
feat(adk): add XAI model type with server-side tools support
tdabasinskas Nov 24, 2025
0f0f637
feat(providers): add XAI model provider support
tdabasinskas Nov 24, 2025
5629913
refactor(api): simplify XAIConfig DeepCopyInto by delegating to OpenA…
tdabasinskas Nov 24, 2025
07ad473
feat(crd): add xAI provider support and enhanced deployment configura…
tdabasinskas Nov 24, 2025
5c944b6
feat(ui): add XAI provider support to model provider combobox
tdabasinskas Nov 24, 2025
19b794f
feat(onboarding): add XAI model provider support to configuration step
tdabasinskas Nov 24, 2025
e88d0a9
feat(models): add XAI provider support and improve array parameter ha…
tdabasinskas Nov 24, 2025
1123d67
feat(translator): add XAI provider support with shared OpenAI-compati…
tdabasinskas Nov 24, 2025
8436584
feat(types): add XAI model support to AgentConfig
tdabasinskas Nov 24, 2025
65bb0a3
feat(models): add XAI (xAI Grok) model support
tdabasinskas Nov 24, 2025
91dae1b
feat(models): add XAI model support
tdabasinskas Nov 24, 2025
9fe4e42
feat(modelconfig): add support for embedded struct fields with inline…
tdabasinskas Nov 24, 2025
62f22bc
Merge branch 'main' into xai
tdabasinskas Dec 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions examples/modelconfig-xai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: Secret
metadata:
name: xai-api-key
namespace: default
type: Opaque
stringData:
apiKey: your-xai-api-key-here
---
apiVersion: kagent.dev/v1alpha2
kind: ModelConfig
metadata:
name: grok-4-1-fast-reasoning
namespace: default
spec:
provider: XAI
model: grok-4-1-fast-reasoning
apiKeySecret: xai-api-key
apiKeySecretKey: apiKey
xAI:
temperature: "0.7"
maxTokens: 4096
topP: "0.9"
tools:
- web_search
- x_search
- code_execution
liveSearchMode: auto
21 changes: 20 additions & 1 deletion go/api/v1alpha1/modelconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
)

// ModelProvider represents the model provider type
// +kubebuilder:validation:Enum=Anthropic;OpenAI;AzureOpenAI;Ollama;Gemini;GeminiVertexAI;AnthropicVertexAI
// +kubebuilder:validation:Enum=Anthropic;OpenAI;AzureOpenAI;Ollama;Gemini;GeminiVertexAI;AnthropicVertexAI;XAI
type ModelProvider string

const (
Expand All @@ -36,6 +36,7 @@ const (
ModelProviderGemini ModelProvider = "Gemini"
ModelProviderGeminiVertexAI ModelProvider = "GeminiVertexAI"
ModelProviderAnthropicVertexAI ModelProvider = "AnthropicVertexAI"
ModelProviderXAI ModelProvider = "XAI"
)

type BaseVertexAIConfig struct {
Expand Down Expand Up @@ -202,6 +203,19 @@ type OllamaConfig struct {

type GeminiConfig struct{}

// XAIConfig contains xAI-specific configuration options
type XAIConfig struct {
OpenAIConfig `json:",inline"`

// Server-side tools to enable
// +optional
Tools []string `json:"tools,omitempty"`

// Live search mode for real-time data retrieval
// +optional
LiveSearchMode string `json:"liveSearchMode,omitempty"`
}

// ModelConfigSpec defines the desired state of ModelConfig.
//
// +kubebuilder:validation:XValidation:message="provider.openAI must be nil if the provider is not OpenAI",rule="!(has(self.openAI) && self.provider != 'OpenAI')"
Expand All @@ -211,6 +225,7 @@ type GeminiConfig struct{}
// +kubebuilder:validation:XValidation:message="provider.gemini must be nil if the provider is not Gemini",rule="!(has(self.gemini) && self.provider != 'Gemini')"
// +kubebuilder:validation:XValidation:message="provider.geminiVertexAI must be nil if the provider is not GeminiVertexAI",rule="!(has(self.geminiVertexAI) && self.provider != 'GeminiVertexAI')"
// +kubebuilder:validation:XValidation:message="provider.anthropicVertexAI must be nil if the provider is not AnthropicVertexAI",rule="!(has(self.anthropicVertexAI) && self.provider != 'AnthropicVertexAI')"
// +kubebuilder:validation:XValidation:message="provider.xAI must be nil if the provider is not XAI",rule="!(has(self.xAI) && self.provider != 'XAI')"
type ModelConfigSpec struct {
Model string `json:"model"`

Expand Down Expand Up @@ -262,6 +277,10 @@ type ModelConfigSpec struct {
// Anthropic-specific configuration
// +optional
AnthropicVertexAI *AnthropicVertexAIConfig `json:"anthropicVertexAI,omitempty"`

// xAI-specific configuration
// +optional
XAI *XAIConfig `json:"xAI,omitempty"`
}

// Model Configurations
Expand Down
26 changes: 26 additions & 0 deletions go/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion go/api/v1alpha2/modelconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
)

// ModelProvider represents the model provider type
// +kubebuilder:validation:Enum=Anthropic;OpenAI;AzureOpenAI;Ollama;Gemini;GeminiVertexAI;AnthropicVertexAI
// +kubebuilder:validation:Enum=Anthropic;OpenAI;AzureOpenAI;Ollama;Gemini;GeminiVertexAI;AnthropicVertexAI;XAI
type ModelProvider string

const (
Expand All @@ -36,6 +36,7 @@ const (
ModelProviderGemini ModelProvider = "Gemini"
ModelProviderGeminiVertexAI ModelProvider = "GeminiVertexAI"
ModelProviderAnthropicVertexAI ModelProvider = "AnthropicVertexAI"
ModelProviderXAI ModelProvider = "XAI"
)

type BaseVertexAIConfig struct {
Expand Down Expand Up @@ -210,6 +211,19 @@ type OllamaConfig struct {

type GeminiConfig struct{}

// XAIConfig contains xAI-specific configuration options
type XAIConfig struct {
OpenAIConfig `json:",inline"`

// Server-side tools to enable
// +optional
Tools []string `json:"tools,omitempty"`

// Live search mode for real-time data retrieval
// +optional
LiveSearchMode string `json:"liveSearchMode,omitempty"`
}

// TLSConfig contains TLS/SSL configuration options for model provider connections.
// This enables agents to connect to internal LiteLLM gateways or other providers
// that use self-signed certificates or custom certificate authorities.
Expand Down Expand Up @@ -255,6 +269,7 @@ type TLSConfig struct {
// +kubebuilder:validation:XValidation:message="provider.gemini must be nil if the provider is not Gemini",rule="!(has(self.gemini) && self.provider != 'Gemini')"
// +kubebuilder:validation:XValidation:message="provider.geminiVertexAI must be nil if the provider is not GeminiVertexAI",rule="!(has(self.geminiVertexAI) && self.provider != 'GeminiVertexAI')"
// +kubebuilder:validation:XValidation:message="provider.anthropicVertexAI must be nil if the provider is not AnthropicVertexAI",rule="!(has(self.anthropicVertexAI) && self.provider != 'AnthropicVertexAI')"
// +kubebuilder:validation:XValidation:message="provider.xAI must be nil if the provider is not XAI",rule="!(has(self.xAI) && self.provider != 'XAI')"
// +kubebuilder:validation:XValidation:message="apiKeySecret must be set if apiKeySecretKey is set",rule="!(has(self.apiKeySecretKey) && !has(self.apiKeySecret))"
// +kubebuilder:validation:XValidation:message="apiKeySecretKey must be set if apiKeySecret is set",rule="!(has(self.apiKeySecret) && !has(self.apiKeySecretKey))"
// +kubebuilder:validation:XValidation:message="caCertSecretKey requires caCertSecretRef",rule="!(has(self.tls) && has(self.tls.caCertSecretKey) && size(self.tls.caCertSecretKey) > 0 && (!has(self.tls.caCertSecretRef) || size(self.tls.caCertSecretRef) == 0))"
Expand Down Expand Up @@ -306,6 +321,10 @@ type ModelConfigSpec struct {
// +optional
AnthropicVertexAI *AnthropicVertexAIConfig `json:"anthropicVertexAI,omitempty"`

// xAI-specific configuration
// +optional
XAI *XAIConfig `json:"xAI,omitempty"`

// TLS configuration for provider connections.
// Enables agents to connect to internal LiteLLM gateways or other providers
// that use self-signed certificates or custom certificate authorities.
Expand Down
26 changes: 26 additions & 0 deletions go/api/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions go/cli/internal/cli/agent/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
OPENAI_API_KEY = "OPENAI_API_KEY"
ANTHROPIC_API_KEY = "ANTHROPIC_API_KEY"
AZUREOPENAI_API_KEY = "AZUREOPENAI_API_KEY"
XAI_API_KEY = "XAI_API_KEY"

// kagent env variables
KAGENT_DEFAULT_MODEL_PROVIDER = "KAGENT_DEFAULT_MODEL_PROVIDER"
Expand All @@ -39,6 +40,8 @@ func GetModelProvider() v1alpha2.ModelProvider {
return v1alpha2.ModelProviderAnthropic
case GetModelProviderHelmValuesKey(v1alpha2.ModelProviderAzureOpenAI):
return v1alpha2.ModelProviderAzureOpenAI
case GetModelProviderHelmValuesKey(v1alpha2.ModelProviderXAI):
return v1alpha2.ModelProviderXAI
default:
return v1alpha2.ModelProviderOpenAI
}
Expand All @@ -62,6 +65,8 @@ func GetProviderAPIKey(provider v1alpha2.ModelProvider) string {
return ANTHROPIC_API_KEY
case v1alpha2.ModelProviderAzureOpenAI:
return AZUREOPENAI_API_KEY
case v1alpha2.ModelProviderXAI:
return XAI_API_KEY
default:
return ""
}
Expand Down
98 changes: 98 additions & 0 deletions go/config/crd/bases/kagent.dev_modelconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,50 @@ spec:
- Gemini
- GeminiVertexAI
- AnthropicVertexAI
- XAI
type: string
xAI:
description: xAI-specific configuration
properties:
baseUrl:
description: Base URL for the OpenAI API (overrides default)
type: string
frequencyPenalty:
description: Frequency penalty
type: string
liveSearchMode:
description: Live search mode for real-time data retrieval
type: string
maxTokens:
description: Maximum tokens to generate
type: integer
"n":
description: N value
type: integer
organization:
description: Organization ID for the OpenAI API
type: string
presencePenalty:
description: Presence penalty
type: string
seed:
description: Seed value
type: integer
temperature:
description: Temperature for sampling
type: string
timeout:
description: Timeout
type: integer
tools:
description: Server-side tools to enable
items:
type: string
type: array
topP:
description: Top-p sampling parameter
type: string
type: object
required:
- model
- provider
Expand All @@ -278,6 +321,8 @@ spec:
- message: provider.anthropicVertexAI must be nil if the provider is not
AnthropicVertexAI
rule: '!(has(self.anthropicVertexAI) && self.provider != ''AnthropicVertexAI'')'
- message: provider.xAI must be nil if the provider is not XAI
rule: '!(has(self.xAI) && self.provider != ''XAI'')'
status:
description: ModelConfigStatus defines the observed state of ModelConfig.
properties:
Expand Down Expand Up @@ -576,6 +621,7 @@ spec:
- Gemini
- GeminiVertexAI
- AnthropicVertexAI
- XAI
type: string
tls:
description: |-
Expand Down Expand Up @@ -615,6 +661,56 @@ spec:
Production deployments MUST use proper certificates.
type: boolean
type: object
xAI:
description: xAI-specific configuration
properties:
baseUrl:
description: Base URL for the OpenAI API (overrides default)
type: string
frequencyPenalty:
description: Frequency penalty
type: string
liveSearchMode:
description: Live search mode for real-time data retrieval
type: string
maxTokens:
description: Maximum tokens to generate
type: integer
"n":
description: N value
type: integer
organization:
description: Organization ID for the OpenAI API
type: string
presencePenalty:
description: Presence penalty
type: string
reasoningEffort:
description: Reasoning effort
enum:
- minimal
- low
- medium
- high
type: string
seed:
description: Seed value
type: integer
temperature:
description: Temperature for sampling
type: string
timeout:
description: Timeout
type: integer
tools:
description: Server-side tools to enable
items:
type: string
type: array
topP:
description: Top-p sampling parameter
type: string
type: object
required:
- model
- provider
Expand All @@ -636,6 +732,8 @@ spec:
- message: provider.anthropicVertexAI must be nil if the provider is not
AnthropicVertexAI
rule: '!(has(self.anthropicVertexAI) && self.provider != ''AnthropicVertexAI'')'
- message: provider.xAI must be nil if the provider is not XAI
rule: '!(has(self.xAI) && self.provider != ''XAI'')'
- message: apiKeySecret must be set if apiKeySecretKey is set
rule: '!(has(self.apiKeySecretKey) && !has(self.apiKeySecret))'
- message: apiKeySecretKey must be set if apiKeySecret is set
Expand Down
Loading