Documentation
Custom Models and Model Capabilities
When using custom models or overriding model capabilities in kagent, you need to specify what features your model supports. This is done through the modelInfo
configuration.
Model Capabilities
Capability | Description |
---|---|
vision | Process and understand images |
functionCalling | Use tools and execute actions |
jsonOutput | Generate valid JSON responses |
family | Model architecture type (e.g., "gpt", "llama") |
structuredOutput | Generate formatted responses |
multipleSystemMessages | Support multiple system prompts |
Provider Requirements
Provider | ModelInfo | Note |
---|---|---|
OpenAI | Optional | Pre-configured for standard models |
Anthropic | Optional | Pre-configured for Claude models |
Ollama | Required | Must specify all capabilities |
Custom | Required | Must specify all capabilities |
Configuring Custom Models
Often you may want to use a custom model with an existing provider, for example if you're using a self-hosted model exposed via the OpenAI API. Or if you're using a proxy to the OpenAI API.
The example below will add an API key, but given that this is a custom provider, the key is optional.
- Create a Kubernetes Secret that stores the API key, replace
<your_api_key>
with an actual API key:
export OPENAI_API_KEY=<your_api_key>kubectl create secret generic kagent-openai -n kagent --from-literal OPENAI_API_KEY=$OPENAI_API_KEY
- Create a ModelConfig resource that references the secret and key name, and specify the model you want to use:
apiVersion: kagent.dev/v1alpha1kind: ModelConfigmetadata:name: custom-openai-model-confignamespace: kagentspec:apiKeySecretRef: kagent-openaiapiKeySecretKey: OPENAI_API_KEYmodel: <insert-model-name> # This should match the model name passed to the provider.provider: OpenAIopenAI:baseUrl: https://your-custom-openai-provider.com# Required: Specify model capabilitiesmodelInfo:vision: falsefunctionCalling: truejsonOutput: truefamily: "unknown"structuredOutput: truemultipleSystemMessages: false
If you don't need an API key you can elide the apiKeySecretRef
and apiKeySecretKey
fields.
- Apply the above resource to the cluster.
Once the resource is applied, you can select the model from the Model dropdown in the UI when creating or updating agents.
See provider documentation for specific configuration: