Context Engineering Starts with Retrieval
Agents work with a limited context window. Information retrieval breaks in three ways. Inefficient searching wastes tokens and time. Too much context at once fills the window. Irrelevant or stale context confuses the model. The Deep Agents harness keeps searches small out of the box. Built-in filesystem tools search before they read. Glob matches file names. Grep finds matching lines. Read_file reads a page at a time. Oversized tool results get offloaded. The full result saves to files. The agent gets just the path and a preview. For custom search tools, use retrieve, offload, delegate. Save results to files. Return the paths. Let subagents read them. The main agent only sees what is relevant. Imagine taking an open book exam. You technically have all the answers. But finding the right one feels harder. When do you know your sources are correct? How do you optimize your time? You do not blow all your energy on redundant searches. Finding the right information efficiently is not straightforward. Hand an agent a question. It faces a similar predicament. It has a limited context window. Like humans, it must retrieve information to complete tasks. It cannot have everything memorized. When searching, agents struggle with specific problems.
Three Ways Information Retrieval Breaks
Inefficient searching costs tokens and time. An agent that searches clumsily fills its context. It opens every file just to see what is inside. It keeps rewording the same query. This wastes energy before it finds anything useful. Too much context at once fills the window in a single move. One search dumps a full data export. A dozen documents fill the space instantly. There is no room for the work itself. Irrelevant or stale context looks convincing to a model. Outdated or off-topic information mimics the right answer. Once it enters the context window, the agent builds on it. The mistake carries through every step after. Luckily, there are several techniques at an agent's disposal. It is the job of an agent harness to apply these techniques strategically. The harness gets the model the right context at the right time. This applies to the given task. The Deep Agents harness uses these methods.
Built-in Filesystem Tools
One common way for an agent to search is with a filesystem. If an agent opens every file to see what is inside, it searches inefficiently. Each file it reads lands in its context window. It can fill up just from looking. A better approach checks names and keywords first. This is like scanning a book's index. You do not read every page during an open-book exam. Two common filesystem tools do exactly that. Glob finds files by name pattern. For example, *.md finds last week's notes on Company A. Grep searches inside files without loading them into the context window. It matches literal text. It can return matching files, matching lines, or counts. Every deep agent comes with these tools built in. They include ls, read_file, write_file, and edit_file. The same tools work no matter where the files live. They work on agent state, local disk, a persistent store, or a sandbox. They all go through the agent's backend.