File tree Expand file tree Collapse file tree
packages/optimization/src/ldai_optimizer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2229,10 +2229,17 @@ async def _execute_agent_turn(
22292229 agent_response .usage ,
22302230 _find_model_config (self ._current_model or "" , self ._model_configs ),
22312231 )
2232+ # Build a _meta entry capturing raw cost and latency telemetry for every
2233+ # iteration, regardless of which optimization goals are enabled. This
2234+ # surfaces the measurements in the API/UI even when the gates are inactive.
22322235 result_ctx = dataclasses .replace (
22332236 optimize_context ,
22342237 completion_response = completion_response ,
2235- scores = scores ,
2238+ scores = {** scores , "_meta" : JudgeResult (
2239+ score = 0.0 ,
2240+ duration_ms = agent_duration_ms ,
2241+ estimated_cost_usd = agent_cost ,
2242+ )},
22362243 duration_ms = agent_duration_ms ,
22372244 usage = agent_response .usage ,
22382245 estimated_cost_usd = agent_cost ,
You can’t perform that action at this time.
0 commit comments