Tool Result Clearing
Dropping a tool's response from the agent's context window after the agent has used it — to keep the context lean across long multi-tool workflows.
Production AI is not a prompt. It is a system of context, tools, permissions, traces, evals, and feedback loops.
What it is
Tool result clearing is a compaction strategy specific to tool-heavy agent workflows. After the agent has read a tool's response and acted on it, the raw response is removed from the conversation history and replaced with a short note ('called tool X, used the result to do Y'). The context stays lean even after dozens of tool calls.
Why it matters
Tool results — search results, file contents, API responses — are the largest single contributor to context-window bloat in agent workflows. A workflow that calls 20 tools and keeps all their raw responses in context will exceed any reasonable budget. Clearing the results after use is the cheapest way to keep long workflows feasible.
How it works
After a tool call completes and the agent has incorporated the result, the runtime rewrites the message history to summarize the call. The summary preserves the fact that the tool was called and what the agent concluded; it drops the verbose payload. Done correctly, the agent doesn't notice; done poorly, the agent loses critical context and asks for the same thing again.
Related resources
Shrinking an AI agent's conversation history so the most relevant context stays in the model's window without exceeding the token budget — by summarizing, truncating, or selectively dropping turns.
The total number of tokens an AI agent has available for instructions, memory, retrieved context, conversation history, and tool results — and how that budget is allocated across them.
The discipline of deciding what an AI model sees on every call — instructions, retrieved data, memory, tool definitions, examples — and how to assemble them reliably as the workflow grows.
The mechanism by which a language model invokes external functions — APIs, databases, code execution, retrieval — and reads the results back to continue its work.