feat: add auto-commit option#130
Open
andrewklatzke wants to merge 2 commits intoaklatzke/AIC-2154/optimize-for-durationfrom
Open
feat: add auto-commit option#130andrewklatzke wants to merge 2 commits intoaklatzke/AIC-2154/optimize-for-durationfrom
andrewklatzke wants to merge 2 commits intoaklatzke/AIC-2154/optimize-for-durationfrom
Conversation
jsonbailey
reviewed
Apr 9, 2026
| import uuid | ||
| from typing import Any, Dict, List, Literal, Optional, Union | ||
|
|
||
| from coolname import generate_slug |
Contributor
There was a problem hiding this comment.
Are there any more popular libraries we could use here? Do we need it to be name based?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Describe the solution you've provided
Implements the "auto commit" functionality that allows you to push a variation back to LaunchDarkly when the optimization is finished. "Auto commit" is assumed true when using the
from_configmethod, but must be passed explicitly if just passing options (open to changing that).Describe alternatives you've considered
This is pushing the optimized variation back to LaunchDarkly. No alternatives considered here.
Additional context
This implements the following:
auto_commitis passed as true, will automatically attempt to write the generated variation back to LD. The project key and api key are required for this, so there is validation to ensure they're present if auto commit is passed (before any LLM executions)provider.modelNamekeys. Adds a method to fetch the model configs from the API to achieve thisfrom_optionspath, adds the baseURL so that we have 1:1 with the from_config path that allows you to specify the environment URLcoolnamedependency which generates random names in the format requested in the PRD (ie, heroku-style namingadjective-noun)output_keyfield and it will attempt to write with that key. In cases where the key is already taken, a random suffix is generated and appended to the keyHere's an example output for the following options for the
from_optionsmethod:And here is one with an auto-generated name (run via the
from_configmethod):Note
Medium Risk
Adds new write-path behavior that can create AI Config variations via the LaunchDarkly REST API, so misconfiguration (API key/project key/base_url) or API failures could cause unexpected side effects or retries.
Overview
Adds an optional
auto_commitcapability to optimization runs so a successful result can be written back to LaunchDarkly as a new AI Config variation (with optionaloutput_key, collision handling, and basic retry).Updates the options dataclasses to expose
auto_commit,project_key,output_key, andbase_url(and defaultsauto_commit=Trueforoptimize_from_config), and tracks last-run success in the client to decide whether to commit.Extends
LDApiClientwith AI Config endpoints (get_ai_config,get_model_configs,create_ai_config_variation) and adds thecoolnamedependency to generate default variation keys.Reviewed by Cursor Bugbot for commit 4cb8859. Bugbot is set up for automated code reviews on this repo. Configure here.