Skip to content

< all problems94 · Level 05, Agents

Answer in One Call, Not Five

easy · optimize · Agents

answer(question, model) is correct and costs five model calls: one to split the question into subtasks, one per subtask, one to merge. Every one of the questions it is asked fits in a single prompt. Make it give the same answers in at most two calls.

model.ask(prompt) is the only model. It is scripted so the problem is deterministic: it answers every topic it finds in the prompt, and only those.

  1. answer(question, model) returns a string.
  2. For the three questions in the tests, the answer must be exactly what the five-call version returns today. Run the starter first and keep the outputs.
  3. model.calls must be 2 or fewer after any one call to answer.
  4. The question itself must reach the model. A function that pattern-matches the question and skips the model fails the fourth test, which asks something the scripted model does not know.

This is an optimize problem. Nothing is wrong with planner, workers and merger as a shape; it is wrong for a question that one agent answers in one turn. Five calls are five times the latency and five times the bill for the same string.