10/17
Part 3 of 7 · When things go wrongLearn and do

Every turn sends the whole history again, so a run reads far more than its last turn

The budget matters because every turn sends the whole transcript again. Anthropic's docs describe each follow-up request as containing the original messages, the assistant's response and the tool results.

In the returns run, the first model call reads 2,400 tokens: the instructions, the tool definitions and the question. Each call and its result then add to the history, by 120, 80, 60 and 40 tokens, and every later call reads all of it. turn_sizes(first, added) lists what each call reads. You write it in this step's task.

sizes = turn_sizes(2400, [120, 80, 60, 40])
print(sizes, sum(sizes))
Predict

The returns run takes 5 model calls, and the last one reads 2,700 tokens. About how many input tokens did the whole run read?

Pick one to see what it prints.
Pick an answer above to see the rest