Context Engineering with DeepAgents: Write, Select, Compress, Isolate
Speaker
Antanas Daujotis
With over 20 years in the trenches of engineering, he now focuses on the messy reality of getting agentic systems to work in production.
Abstract
Context Engineering is the new prompt engineering. As agentic workflows grow, just appending messages to a list causes context poisoning and latency spikes. In this talk, we'll look at a better architecture using the deepagents library. We'll explore the four pillars of context engineering: Write, Select, Compress, and Isolate. You'll learn how to treat context as a finite resource and build autonomous agents that can solve complex tasks without crashing your context window.
Description
Most of us start building agents as a simple while loop that appends to a list of messages. It works for demos but falls apart in production. As the context fills up, LLMs hallucinate, latency spikes, and costs go through the roof. To build robust agents, we need to stop treating the Context Window like a log file and start treating it as a managed resource.
In this talk, we'll apply the four pillars of context engineering using the deepagents library:
-
Write (The Scratchpad): We'll use tools like write_file and write_todos. Instead of keeping the whole plan in the chat history, the agent maintains a dynamic to-do list as a separate state object. This separates execution state from conversation history.
-
Select (Just-in-Time Retrieval): The LLM shouldn't need to know everything; it just needs to know where to find it. We'll show how an agent can dump raw search data into files and only read specific lines when necessary, keeping the main context window clean.
-
Isolate (The Sub-Agent Pattern): We'll solve "Context Poisoning" by spawning child agents for sub-tasks. We'll visualise a setup where a Child Agent starts with 0 tokens, does the messy reasoning, and returns only the final answer. The Parent Agent never sees the noise.
-
Compress (The Handoff): We'll show summarisation at boundaries, where complex execution traces are compressed into concise reports before passing them back up the chain.