Skip to content

feat: ability to specify variation key on config or from_options for optimization package#162

Open
andrewklatzke wants to merge 1 commit intoaklatzke/AIC-2263/sdk-dx-improvementsfrom
aklatzke/AIC-2371/allow-variation-selection
Open

feat: ability to specify variation key on config or from_options for optimization package#162
andrewklatzke wants to merge 1 commit intoaklatzke/AIC-2263/sdk-dx-improvementsfrom
aklatzke/AIC-2371/allow-variation-selection

Conversation

@andrewklatzke
Copy link
Copy Markdown
Contributor

@andrewklatzke andrewklatzke commented May 4, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Describe the solution you've provided

Adds the ability to specify a specific variation when setting up your configuration within LaunchDarkly, or specify a specific variation key in the from_options method as long as the API key is present. This allows a user to optimize against a specific variation rather than the default.

Describe alternatives you've considered

This is a relatively straightforward feature request. Allowing users to specify a specific variation cuts down on toil of managing your agents in the UI (don't need to change targeting or create a dummy config).

Additional context

This is purely additive. Functionality for configs not using the variation key, or that don't have it set, is unchanged -- it will continue using the default pulled via the SDK.


Note

Medium Risk
Introduces a new code path that fetches AI config variations via the LaunchDarkly REST API (including model/tools overrides) and changes validation behavior when variation_key is set, so misconfiguration or API errors can now fail runs earlier.

Overview
Adds support for pinning an optimization run to a specific AI Config variation via a new variation_key option (and variationKey in config-driven runs), instead of always using the SDK-evaluated variation.

When provided, _get_agent_config now fetches the requested variation over the REST API (new LDApiClient.get_ai_config_variation) and uses its instructions, tools, and modelConfigKey as the optimization baseline; callers now enforce that LAUNCHDARKLY_API_KEY and project_key are set for this path. Tests are expanded to cover the new option wiring, API behavior, and error propagation.

Reviewed by Cursor Bugbot for commit c5e39eb. Bugbot is set up for automated code reviews on this repo. Configure here.

@andrewklatzke andrewklatzke requested a review from jsonbailey May 4, 2026 22:36
@andrewklatzke andrewklatzke requested a review from a team as a code owner May 4, 2026 22:36
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.

2 participants