Repository navigation
feat: Add harness optimizer agent and its configuration editing tools - #4037
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
3492b0c to
b34ba2b
Compare
cc43c65 to
fbe29cd
Compare
julian-risch
left a comment
There was a problem hiding this comment.
I left a couple of comments but didn't spot anything. It's a lot of code!
I was wondering also if some kind of LLM-based summarization might be needed after running this for some time because the history builds up. Reasoning why a certain edit was made, plus why it didn't seem to improve results, what else to try...
Other than that I don't have any comments, sorry. :D
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Agreed, we saw the optimizer's input grow over longer runs too. Right now only the most recent outcome is shown in full, and earlier ones are condensed to their headline metrics, hypothesis and diff. An LLM summary of what was tried and why it didn't help would be a good next step. I'd like to do that as a follow-up, tracked in https://github.com/deepset-ai/haystack-private/issues/594. |
…olset The editor holds one proposal turn's YAML in memory and carries the editing tools as its own methods. propose_candidate passes it to the optimizer agent in `tools` for that run, so the agent no longer needs a state entry for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate tool methods Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ools Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editing tools assume calls in one step run in the order they were made, so the optimizer agent uses tool_concurrency_limit=1. propose_candidate reads the editor's YAML directly instead of through its read_config tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…luators to_dict/from_dict The optimizer agent from create_harness_optimizer_agent is now complete: its editing tools read and write a ConfigurationDraft and KnownConfigurations in the agent's state, and ValidateConfig holds the evaluator and loader. propose_candidate passes each turn's starting point as state and returns a ProposalResult. HarnessEvaluator gains to_dict/from_dict so the agent can be serialized with its evaluator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@julian-risch Since your review I've removed the |
julian-risch
left a comment
There was a problem hiding this comment.
Just one change request blocking my approval. mcp-haystack version requirement needs to be updated. Otherwise looks good to me.
…didate keyword-only

Related Issues
Proposed Changes:
First part of the harness optimization work: an agent that edits a configuration's YAML into one improved candidate. The loop that calls it (
HarnessOptimizationExperiment) follows in #4069.create_harness_optimizer_agent(*, evaluator, loader, ...)builds the optimizer agent. It has:read_config,edit_config,validate_config,submit_candidate,restore_candidate,finish, plusinspect_componentsubmit_candidateandfinishas exit conditionsdocumentation_tools=True)to_dict/from_dict, evaluator included, and defaults togpt-5.6-terrawith low reasoning effort.propose_candidateruns one turn. It passes the starting point to the agent as state (ConfigurationDraft: the YAML to edit;KnownConfigurations: every configuration measured so far) and returns aProposalResult(the submitted candidate orNone, the finish reason, failed validations).optimization/tools.pyread and write that state.ValidateConfigruns the evaluator'svalidateon each draft. A candidate must be validated before it can be submitted, and known configurations can't be resubmitted.OptimizationObjectivesgates candidates (quality floor, reported usage) and ranks them by cost, duration or quality.HarnessEvaluatorgainsto_dict/from_dict(implemented byRetrievalHarnessEvaluator), so the agent can serialize its evaluator.pyyaml, andmcp-haystackfor tests.How did you test it?
Unit tests in
tests/optimizationand forRetrievalHarnessEvaluatorserialization.hatch run test:unit,hatch run test:typesandhatch run fmt-checkpass locally.One optimizer turn on its own (needs
OPENAI_API_KEY):How the experiment calls it each turn:
HarnessOptimizationExperiment.runin #4069.Notes for the reviewer
optimization/utils.pyis left out of the API docs.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.