For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
BYO OpenAI-compatible endpoint
Configure kagent to use any provider that serves the OpenAI API, including a self-hosted gateway in front of your own models.
Many providers serve the OpenAI API rather than an API of their own. To use one, setprovider: OpenAI and point openAI.baseUrl at the provider’s endpoint. This mechanism is used by the xAI and Amazon Bedrock OpenAI-compatible paths.Create the ModelConfig
The following example uses Cohere, which serves an OpenAI-compatible endpoint.
Save the API key from your provider as an environment variable.
export PROVIDER_API_KEY=<your_api_key>Create a Kubernetes Secret that stores the API key. Create the Secret in the same namespace as the ModelConfig, such as
kagent.kubectl create secret generic kagent-my-provider -n kagent --from-literal PROVIDER_API_KEY=$PROVIDER_API_KEYCreate a
ModelConfigthat points at your provider’s endpoint.kubectl apply -f - <<EOF apiVersion: api.kagent.dev/v1alpha3 kind: ModelConfig metadata: name: my-provider-model-config namespace: kagent spec: apiKeySecret: kagent-my-provider apiKeySecretKey: PROVIDER_API_KEY model: command-a-03-2025 provider: OpenAI openAI: baseUrl: https://api.cohere.ai/compatibility/v1 EOFField Description apiKeySecretThe name of the Kubernetes Secret that stores the API key, in the same namespace as this ModelConfig. apiKeySecretKeyThe key within that Secret that stores the API key. modelThe model identifier that your provider routes on. Consult your provider’s documentation. providerThe provider to use, OpenAI.openAI.baseUrlYour provider’s OpenAI-compatible endpoint. Providers often serve this at a dedicated path, such as /compatibility/v1.
For the rest of the settings that the openAI block accepts, see OpenAI. Not every compatible provider honors every setting, so check your provider’s documentation before setting one. For every openAI field, including its type, default, and validation rules, see the API reference.
Self-hosted vLLM behind a gateway
To serve your own model, run a vLLM server behind an OpenAI-compatible gateway, such as Bifrost or LiteLLM. Requests then travel from kagent through the gateway to vLLM, and you configure the gateway as the provider endpoint.
Launch vLLM with automatic tool choice, and set model to the identifier that the gateway routes on.
Enable tool calling in vLLM
kagent sends a tools array with tool_choice: "auto" on every request. By default, kagent’s runtime registers a built-in ask_user tool on every agent, so kagent sends that array even when you do not bind any tools yourself. To prevent every agent turn from failing, launch vLLM with automatic tool choice enabled.
vllm serve Qwen/Qwen2.5-7B-Instruct \
--enable-auto-tool-choice \
--tool-call-parser hermesThe correct --tool-call-parser depends on your model family. Qwen2.5 uses hermes. Llama 3.1 uses llama3_json. Parser names change across vLLM releases, so check the vLLM tool calling docs for the current name for your model.
Use the gateway’s model identifier
Set model to the identifier that your gateway routes on, which is often provider-prefixed and can differ from the bare model name that vLLM serves internally. Point openAI.baseUrl at the gateway. LiteLLM defaults to port 4000. Bifrost defaults to port 8080.
spec:
apiKeySecret: kagent-my-provider
apiKeySecretKey: PROVIDER_API_KEY
model: vllm/Qwen/Qwen2.5-7B-Instruct
provider: OpenAI
openAI:
baseUrl: http://litellm.kagent.svc.cluster.local:4000/v1Troubleshooting a 400 from the provider
When every agent message fails with a generic provider API error (status 400), the most common cause is a vLLM server started without --enable-auto-tool-choice and a matching --tool-call-parser. Restart vLLM with both flags and try again.
TLS
A provider on your own network might present a certificate that the agent does not already trust. The tls block defines one field, disableVerify, which turns off certificate verification entirely when you set it to true. The field defaults to false.
Warning
The tls block does not accept a certificate authority (CA) bundle. An agent running on Agent SubstrateAgent SubstrateThe runtime that kagent runs agents on. It multiplexes many sandboxed Actors onto a smaller pool of pre-started Workers, suspending idle ones to snapshots.Learn more cannot mount files, so the API server rejects caCertSecretRef, caCertSecretKey, and disableSystemCAs as unknown fields. Use a certificate that chains to a public authority, or terminate Transport Layer Security (TLS) at a gateway that the agent can trust.
The following ModelConfig turns off verification for a provider on an internal network.
spec:
apiKeySecret: kagent-my-provider
apiKeySecretKey: PROVIDER_API_KEY
model: command-a-03-2025
provider: OpenAI
openAI:
baseUrl: https://llm.internal.example.com/v1
tls:
disableVerify: trueWarning
Disabling verification removes the guarantee that the agent connects to the intended server. Disable verification only for local testing, never in production.
Use the ModelConfig
Reference the ModelConfig by name from an AgentTemplate in the same namespace.
spec:
modelConfig:
name: my-provider-model-config