Add a model
Add a model from a second provider, and run an agent on it beside your default model.
About this tutorial
Use case: your team wants to run an agent on a different provider, or to compare two models on the same task.
An agent reaches its model through a model configuration, which names a provider, a model, and where the API key is stored. The installation created one, default-model-config, from the API key that you set. In this tutorial, you add a second configuration for another provider in the kagent UI, and create an agent that uses it. Your other agents keep the model that they have.
This tutorial stands on its own. You do not need any of the use cases to follow it. For the settings of each provider, see Configure models.
Time: about 10 minutes.
Before you begin
- Install kagent.
- Have an API key for the provider that you want to add. This tutorial uses Anthropic.
Add the model
Follow the steps in the kagent UI, or apply the same resources as YAML from the command line.
Open the kagent UI
kagent dashboardThe command forwards the UI to http://localhost:8082 and opens it in your browser. Leave it running while you work.
Add the model

In the sidebar, click Models, and then click New Model.
From the Provider list, choose a provider, such as Anthropic.
From the Model list, choose a model, such as
claude-sonnet-5-5. To use a model that is not listed, type its name.Leave Name empty to name the configuration after the model, and leave Namespace as
kagent.Under Authentication, leave API key selected, and enter your API key. kagent stores the key in a Kubernetes Secret that the controller creates.
Click Create model. The Models page lists the new configuration with its provider, its model, and the Secret that holds the key.
Run an agent on the new model
Create an agent that uses the new configuration, so that you can try the model without changing the agents that you already have.
In the sidebar, click Agents, and then click New Agent.
In the Name field, enter
second-opinion.In the Template section, select Inline, and fill in the template.
Field Value Model configuration The configuration that you created, such as kagent/claude-sonnet-5-5.Description Answers on a second modelSystem prompt You are a concise, helpful assistant.Click Create agent, and then click Refresh until the agent is Ready.
To compare the two models, send the same message to this agent and to an agent that uses default-model-config.
To move an existing agent to the new model instead, open the agent’s edit form, choose the configuration from the Model configuration list, and click Save agent.
Verify the model
Check that the model configuration exists, with the provider and model that you chose. If you named it differently, use your name.
kubectl get modelconfig claude-sonnet-5-5 -n kagentExample output:
NAME PROVIDER MODEL claude-sonnet-5-5 Anthropic claude-sonnet-5-5If you created the
second-opinionagent in the kagent UI, check that it is ready.kubectl get agent second-opinion -n kagentExample output:
NAME READY AGE second-opinion True 2mClick the agent name to open its chat page, and send it a message. The agent answers from the new model.
What you built
A second model configuration, and an agent that runs on it while your other agents keep their model. Along the way, you used these features:
| Feature | What you did | Read more |
|---|---|---|
| Model configurations | Added a ModelConfig for a second provider, with its API key in a Secret | Configure models |
| Agents and inline templates | Pointed one agent at the new configuration | About agents |
Clean up
Delete the agent, if you created it.
kubectl delete agent second-opinion -n kagentDelete the model configuration. Before you delete it, note the name of its Secret on the Models page. The YAML tab names the Secret
claude-sonnet-5-5.kubectl delete modelconfig claude-sonnet-5-5 -n kagentDelete the Secret that holds the API key.
kubectl delete secret claude-sonnet-5-5 -n kagent