Skip to content

feat: implement additional config optimization api fields#196

Open
andrewklatzke wants to merge 3 commits into
aklatzke/AIC-2263/sdk-dx-improvementsfrom
aklatzke/AIC-2599/sdk-field-additions
Open

feat: implement additional config optimization api fields#196
andrewklatzke wants to merge 3 commits into
aklatzke/AIC-2263/sdk-dx-improvementsfrom
aklatzke/AIC-2599/sdk-field-additions

Conversation

@andrewklatzke
Copy link
Copy Markdown
Contributor

@andrewklatzke andrewklatzke commented Jun 1, 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

We added first class support for some fields on the UI --

  • Latency optimization
  • Token optimization
  • Auto commit toggle

This PR pulls them into the SDK. token/latency optimization are using their previous paths for now in this PR. Rather than the regex approach we just use the flags from the API now. The latency/cost optimization paths will be updated in a subsequent PR.

Describe alternatives you've considered

The initial implementation of these two code paths for optimizations were kind of hacky to begin with (just using a dictionary to look up words that might mean they want to do it). This was the intended solution.


Note

Medium Risk
Changes when latency/cost gates and judge templates apply (explicit flags vs inferred text) and alters config-judge loading and auto-commit gating, which can shift optimization outcomes for existing runs.

Overview
Wires LaunchDarkly agent optimization API fields into the Python SDK: latencyOptimization, tokenOptimization, and autoCommit on remote configs, plus optional variation_key on OptimizationOptions / GroundTruthOptimizationOptions to start from a specific AI config variation (REST fetch; requires API key and project_key).

Latency and token behavior no longer infer goals from acceptance-statement keyword regexes. Gates, judge prompt augmentations, variation prompts, and model-pricing warnings now key off latency_optimization and token_optimization booleans (from options or API). When unset/false, those paths stay off.

Config judges resolve via raw flag variation() and local {{key}} interpolation (including message_history / response_to_evaluate) instead of LDAIClient.judge_config. System-only judge templates get an auto-built user turn.

optimize_from_config maps the new API fields into built options; auto-commit runs only when both the fetched config’s autoCommit and caller options allow it. Tests drop regex helpers and cover the new flags, judge path, and variation_key validation.

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

@andrewklatzke andrewklatzke requested a review from a team as a code owner June 1, 2026 22:56
Comment thread packages/optimization/src/ldai_optimizer/client.py
@andrewklatzke andrewklatzke changed the title implement additional config optimization api fields feat: implement additional config optimization api fields Jun 1, 2026
@andrewklatzke
Copy link
Copy Markdown
Contributor Author

Now additionally includes the content from here (fix): #197

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 509240f. Configure here.

Comment thread packages/optimization/src/ldai_optimizer/client.py
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.

1 participant