Skip to content

fix(cli): allow minimal installs without a provider API key#1632

Open
officialasishkumar wants to merge 2 commits intokagent-dev:mainfrom
officialasishkumar:fix/minimal-install-without-provider-key
Open

fix(cli): allow minimal installs without a provider API key#1632
officialasishkumar wants to merge 2 commits intokagent-dev:mainfrom
officialasishkumar:fix/minimal-install-without-provider-key

Conversation

@officialasishkumar
Copy link
Copy Markdown
Contributor

Summary

  • let the minimal install profile skip the default ModelConfig so it can be used as a provider-less bootstrap path
  • stop the CLI install flow from requiring provider credentials when the selected profile does not install a default model configuration
  • cover the new behavior with CLI unit tests and Helm chart tests

Testing

  • go test ./core/cli/internal/cli/agent
  • make helm-version >/dev/null && helm unittest helm/kagent
  • helm template test-install helm/kagent -f go/core/cli/internal/profiles/minimal.yaml --set providers.default=openAI | rg -n 'default-model-config|kagent-openai|kind: ModelConfig'

Closes #1622

Copilot AI review requested due to automatic review settings April 6, 2026 18:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the CLI install flow and Helm chart so that the minimal installation profile can be used as a provider-less bootstrap path (i.e., without requiring a provider API key or installing a default ModelConfig).

Changes:

  • Add a Helm value (providers.createDefaultModelConfig) and guard Helm templates so the default ModelConfig/Secret can be skipped.
  • Update the minimal embedded profile YAML to disable default ModelConfig creation and adjust CLI install credential checks accordingly.
  • Add unit tests covering the new CLI behavior and Helm template rendering behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
helm/kagent/values.yaml Adds providers.createDefaultModelConfig defaulting to true.
helm/kagent/templates/modelconfig.yaml Conditionally renders the default ModelConfig based on createDefaultModelConfig.
helm/kagent/templates/modelconfig-secret.yaml Conditionally renders the provider API key Secret based on createDefaultModelConfig.
helm/kagent/tests/modelconfig_test.yaml Adds a helm-unittest case asserting ModelConfig is not rendered when disabled.
helm/kagent/tests/modelconfig-secret_test.yaml Adds a helm-unittest case asserting Secret is not rendered when disabled.
go/core/cli/internal/profiles/minimal.yaml Disables default ModelConfig creation for the minimal profile.
go/core/cli/internal/profiles/profiles.go Adds helper to indicate whether a profile installs the default ModelConfig.
go/core/cli/internal/profiles/README.md Updates minimal profile description to reflect no default model config.
go/core/cli/internal/cli/agent/install.go Skips provider credential enforcement when the selected profile doesn’t install a default ModelConfig; refactors profile resolution.
go/core/cli/internal/cli/agent/install_test.go Adds unit tests for profile resolution and credential requirement logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 97 to 110
@@ -92,13 +110,9 @@ func InstallCmd(ctx context.Context, cfg *InstallCfg) *PortForward {
helmConfig := setupHelmConfig(modelProvider, apiKeyValue)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the selected profile does not install a default ModelConfig (e.g. minimal), the CLI skips the API-key requirement, but it still reads the provider API key from the environment and passes it into Helm values (via setupHelmConfig). If the env var is set, this will store credentials in the Helm release even though the chart won’t create ModelConfig/Secret resources. Consider avoiding reading/passing apiKey into Helm when the profile disables default ModelConfig creation (and/or omit the providers..apiKey value entirely in that case).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stopped passing provider values into Helm when the selected profile skips the default ModelConfig, so the minimal install path no longer stores an unused API key in the release. Included in 8cb2bcf.

Comment on lines +1 to 4
{{- if ne .Values.providers.createDefaultModelConfig false }}
{{- $dot := . }}
{{- $model := index $dot.Values.providers $dot.Values.providers.default }}
{{- if and $model.apiKeySecretRef $model.apiKey }}
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This template indexes .Values.providers using .Values.providers.default without a fallback. If providers.default is unset/empty, Helm can error before reaching the apiKey checks. modelconfig.yaml defensively defaults the provider key to "openAI"; modelconfig-secret.yaml should mirror that defaulting (or otherwise guard against a missing providers.default) to keep chart behavior consistent and robust.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirrored the modelconfig.yaml fallback here, so an empty providers.default now falls back to openAI instead of indexing a missing key. Added a Helm unit test in 8cb2bcf.

Treat the minimal install profile as a provider-less bootstrap path so kagent install --profile minimal no longer blocks on OPENAI_API_KEY.

Add a chart flag to skip rendering the default ModelConfig and enable it in the minimal profile so the installation does not create a broken default provider configuration.

Refs kagent-dev#1622

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@officialasishkumar officialasishkumar force-pushed the fix/minimal-install-without-provider-key branch from 2be4e9e to 8cb2bcf Compare April 7, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] kagent install hard-requires OPENAI_API_KEY even when not using OpenAI

2 participants