Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Tool results go right before the assistant's next reasoning turn, at the recency end of context, which is exactly where the native tool-use message formats from Anthropic, OpenAI, and Google place them.
Think about a relay race where one runner hands a baton to the next. If the first runner drops the baton at the starting line and the second runner is at the finish, the handoff fails, the baton is too far away to be useful. A tool result is the baton, and the next model turn is the runner waiting for it. The handoff has to happen at the exact spot where the next runner is standing. Placing tool output at the top of a long conversation is like leaving the baton back at the starting line; the next runner cannot see it through everything that has happened in between. The native chat format for tool use is just a relay rule: hand the baton off right at the spot where the next leg of the race begins.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
State the answer: tool result goes at the recency end, immediately before the next assistant turn. Walk through the lost-in-the-middle attention curve and explain why recency is the durably strong zone. Tie this to the native tool-use message formats of Anthropic, OpenAI, and Google, which encode the placement by construction. Cover the failure modes: pinning at the top, stashing in the system prompt, building a custom tool_results dictionary. Close with the cross-turn recall pattern: durable observations live in agent state with a recall tool, not in pinned prompt regions.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Pinning tool outputs at the top of the conversation in the belief that primacy gives them priority, in a long trajectory that just buries them in the middle.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.