Skip to content

feat: add runVariantExperiment for AI-driven tool variant optimization#213

Merged
steve-calvert-glean merged 1 commit into
mainfrom
feat/variant-experiment
Jun 15, 2026
Merged

feat: add runVariantExperiment for AI-driven tool variant optimization#213
steve-calvert-glean merged 1 commit into
mainfrom
feat/variant-experiment

Conversation

@steve-calvert-glean

Copy link
Copy Markdown
Contributor

Code changes:

  • Introduces a first-class runVariantExperiment API to run multi-round, metric-driven MCP tool-metadata experiments (baseline + variants via toolOverrides, comparison, ranking, regression-guarding, and structured apply/reject/inconclusive proposals), exposes its types from the public surface, documents the high-level vs manual loops with runnable snippets, and adds an optimize-mcp-tool-metadata skill to let agents iteratively propose and evaluate tool-description/schema variants without mutating datasets or server source.

Promotes the runtime tool-override experiment loop from a documented
userland pattern to a first-class API. runVariantExperiment establishes
a baseline, injects each candidate variant via toolOverrides, compares
against the original baseline, ranks by a chosen metric, disqualifies
regressing candidates by default, and emits a structured apply/reject/
inconclusive proposal. A proposeVariants callback supports iterative
agent-driven rounds with convergence control.

Includes the optimize-mcp-tool-metadata skill for agent-driven
workflows, docs, and runnable snippets for both the high-level API and
the manual low-level loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@steve-calvert-glean steve-calvert-glean requested a review from a team as a code owner June 13, 2026 14:42
@steve-calvert-glean steve-calvert-glean added the enhancement New feature or request label Jun 13, 2026

@aditya-scio aditya-scio left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@aditya-scio aditya-scio left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@aditya-scio aditya-scio left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a nice API lift. Pulling the baseline → variant → compare loop into runVariantExperiment makes the experimentation model much more usable for agents and for humans, while still keeping the important invariant that the dataset/server source are not mutated. The default regression guard is also the right default, otherwise it’s too easy to optimize into local wins that make the overall tool worse.

@steve-calvert-glean steve-calvert-glean merged commit 5b600ea into main Jun 15, 2026
1 check passed
@steve-calvert-glean steve-calvert-glean deleted the feat/variant-experiment branch June 15, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants