@@ -183,7 +183,9 @@ def build_new_variation_prompt(
183183 history , model_choices , variable_choices , initial_instructions
184184 ),
185185 variation_prompt_duration_optimization (model_choices ) if optimize_for_duration else "" ,
186- variation_prompt_cost_optimization (model_choices , quality_already_passing = quality_already_passing ) if optimize_for_cost else "" ,
186+ variation_prompt_cost_optimization (
187+ model_choices , quality_already_passing = quality_already_passing
188+ ) if optimize_for_cost else "" ,
187189 ]
188190
189191 return "\n \n " .join (s for s in sections if s )
@@ -628,10 +630,13 @@ def variation_prompt_cost_optimization(
628630 "## Cost Optimization:" ,
629631 "The acceptance criteria for this optimization implies that token usage / cost should be reduced." ,
630632 "*** IMPORTANT: All quality acceptance criteria are currently passing. ***" ,
631- "The goal of this variation is to reduce cost WITHOUT changing the behavior or quality of the agent's responses." ,
633+ "The goal of this variation is to reduce cost WITHOUT changing the behavior or quality"
634+ " of the agent's responses." ,
632635 "Do NOT alter the instructions in ways that would change what the agent says or how it reasons." ,
633- "Only apply changes that reduce token usage or switch to a cheaper model while preserving the same output quality." ,
634- "If you cannot reduce cost without risking quality, keep the instructions unchanged and only consider a cheaper model." ,
636+ "Only apply changes that reduce token usage or switch to a cheaper model while preserving"
637+ " the same output quality." ,
638+ "If you cannot reduce cost without risking quality, keep the instructions unchanged and"
639+ " only consider a cheaper model." ,
635640 "" ,
636641 ]
637642 else :
@@ -650,14 +655,16 @@ def variation_prompt_cost_optimization(
650655 "- Remove redundant, verbose, or repeated phrasing from the instructions." ,
651656 "- Collapse multi-sentence explanations into a single concise directive." ,
652657 "- Remove examples or few-shot demonstrations unless they are essential for accuracy." ,
653- "- Eliminate instructional scaffolding that the model does not need (e.g. 'You are a helpful assistant that...')." ,
658+ "- Eliminate instructional scaffolding that the model does not need"
659+ " (e.g. 'You are a helpful assistant that...')." ,
654660 "- Use bullet points instead of prose where possible — they are more token-efficient." ,
655661 "" ,
656662 "### Reducing token usage (output tokens):" ,
657663 "- Instruct the agent to be concise and avoid unnecessary elaboration." ,
658664 "- Specify the exact format and length of the expected response (e.g. 'Respond in one sentence.')." ,
659665 "- Set or reduce max_tokens if the current value allows longer responses than needed." ,
660- "- Avoid instructions that encourage the agent to 'explain its reasoning' unless required by the acceptance criteria." ,
666+ "- Avoid instructions that encourage the agent to 'explain its reasoning' unless required"
667+ " by the acceptance criteria." ,
661668 "" ,
662669 "### Reducing per-token cost via model selection:" ,
663670 "- Consider switching to a cheaper model from the available choices if quality requirements can still be met." ,
0 commit comments