Back to library
AI
best practice

Keep Agent Conversations Lean by Managing Web Search Results

Drop consumed search blocks to prevent AI 'context bloat.'

Use the new response management features to prevent raw web search results from inflating your conversation context and slowing down the model.

Claude

The Scenario

You are using a Claude-powered agent to do market research. Usually, the chat gets 'clogged' with long snippets from every website it visits.

Before & after

The old way

Working with web-enabled agents often results in 'context bloat,' where pages of raw search results fill your screen and eat up token limits, making the chat slow and hard to read after 15 minutes of work.

With AI

By asking Claude to use the 'response_inclusion' logic (via API or refined prompting), the AI only keeps the specific answer, keeping the chat 'clean' and efficient in under 1 minute.

The Prompt

Search the web for [SPECIFIC_TOPIC]. Once you have found the answer, extract only the relevant facts into a summary and discard the raw search result blocks from our context to keep this session efficient. [PASTE_URL_IF_SPECIFIC]

New updates to the web search and fetch tools allow for the management of result blocks. In your prompts, you can now instruct the agent to discard irrelevant search data once it has extracted the specific answer you need to save 'context space.'

Source

Claude Platform - Claude API Docs
"adding a response_inclusion parameter to drop consumed result blocks from the API response for agentic workflows."