Cost and latency spiked after a prompt change. Traces show agents repeatedly calling the same tool and re-planning in long loops until max tokens. Which optimization strategy should you implement?
Select an answer to reveal the explanation.
Short Explanation
C addresses the spike. Token optimization includes token limits, loop controls, and tool-call discipline. Cap iterations, detect repeated identical tool calls, stop on recurring failures, and right-size models per subtask. Unlimited loops burn money. Biggest model everywhere is costly and unnecessary. Hiding metrics guarantees surprise bills. Foundry tracing of tokens, prompts, and execution makes these controls observable—wire them into the orchestration middleware.
Full Explanation
Correct Answer — “Implement token budgets and loop controls: max iterations per...”
Optimizing token usage covers token limits, loop controls, and tool calls. Runaway re-planning loops need hard iteration caps, duplicate tool-call detection, early termination on repeated failures, and model tiering by task difficulty under quality gates.
Why “Remove all maximum iteration limits so agents can loop until the...” is wrong: Unlimited loops maximize token spend and latency.
Why “Always use the largest available model for every subtask...” is wrong: Largest models for every subtask inflate cost without proportional benefit.
Why “Hide token metrics from developers to avoid premature optimization” is wrong: Without token visibility, teams cannot detect or fix waste.
Exam tip: Loop controls + tool-call dedupe + token budgets after prompt-driven cost spikes.
Prefer to study offline? Printable PDF study book + test engine ($7.50, unofficial). These questions stay free here.