Edited by humans. Written by AI. How our editing works
All articles

Why AI Agents Fail: Lessons in Context Management

Arize's Sally-Ann DeLucia spent a year learning context management the hard way. What broke, what held, and what even Claude Code couldn't solve.

Yuki Okonkwo

Written by AI. Yuki Okonkwo

May 12, 20268 min read
Share:
Woman presenting on AI agents with Alyx and Arize logos visible, showing before/after comparison of conversation context…

Photo: AI. Mei Fujimoto

There's a particular flavor of engineering pain that comes from building a tool with the tool you're building. Sally-Ann DeLucia knows it well.

DeLucia is head of product at Arize, an AI observability platform, and for the past year she's been a core contributor on Alyx — an AI agent designed to help teams analyze the trace data their AI applications generate. At the AI Engineer conference, she gave a 16-minute talk that was less a polished product story and more a candid post-mortem: here's what we tried, here's what broke, here's what actually worked, and here's what's still unsolved.

The interesting part isn't just the solutions. It's the sequence of failure that led to them.

The Loop That Couldn't Be Escaped

To understand why Arize's context problem was uniquely gnarly, you need to know what Alyx runs on. Arize is an observability platform — it collects traces and spans (structured records of what an AI system did, when, with what inputs and outputs) from AI applications. Alyx is built on top of that data. It analyzes it to help teams understand their systems.

Which means Alyx was generating trace data while analyzing trace data. Every interaction added more spans to the very dataset it was trying to reason over.

"The system analyzing the data was constrained by the data," DeLucia said. "That was a major problem for us."

Concretely: Alyx would run on trace data, the spans would grow, it would hit the context limit, fail, log that failure as more trace data, and try again. Bigger context. Another failure. More data. The loop didn't have a natural exit — it just kept feeding itself until something broke.

That's not just an Arize problem. Any agent operating on data it's also generating will eventually face this. The specific shape of the loop is novel; the underlying pressure isn't.

Three Attempts at a Fix

DeLucia walked through three strategies, in the order they tried them. The progression matters.

Naive truncation was first. Keep the first hundred characters of context, drop everything else. Simple, and it kind of worked — until it didn't. The problem was predictable in retrospect: an agent that can only see the beginning of a conversation loses the thread entirely. Follow-up questions looked like new conversations. Ask Alyx about common inputs, get an answer. Ask a follow-up about one of those inputs — blank. DeLucia's summary was blunt: "Over-truncation broke the reasoning."

Summarization was next, and this one felt like the obvious move. LLMs are good at summarizing. Why not compress the context window into a shorter representation and pass that forward? The pitch was appealing. The execution was unreliable.

The core issue DeLucia identified: summarization outsources judgment. You're handing the model a pile of context and saying "you decide what matters." That's precisely the thing you want to control. "There was no control over what was important," she said. The summaries were inconsistent. Different runs produced different compressions. The model was making curatorial decisions it wasn't equipped to make reliably, and there was no way to audit or constrain those decisions.

(Worth noting: this failure mode is specific to using summarization as a context management layer, not as a general capability. LLMs can summarize well when the task is clear. When summarization is the context strategy, the model needs to know what's signal and what's noise — and it usually doesn't.)

Smart truncation with a memory store is what they actually ship. Keep the head of the conversation, keep the tail, drop the middle — but don't discard it. The middle gets stored in a retrievable memory layer, indexed so Alyx can pull it back when it decides something from earlier is relevant. System prompt stays intact. Duplicate tool call results get collapsed to the latest version. The agent maintains access to the full history without it all living in the active context window at once.

"Context decides what the model sees," DeLucia said. "Memory decides what survives."

The distinction is conceptually clean: the context window is working memory, the store is long-term memory, and the agent mediates between them. What makes it work, according to DeLucia, is that the agent retains some agency over retrieval — it can go back for something it flagged as important — without the memory layer being so autonomous that it becomes unpredictable.

Long Sessions Break Everything Eventually

Here's a failure mode that smart truncation didn't fully solve: users don't restart chats.

This seems obvious in retrospect, but it wasn't baked into early design assumptions at Arize. The team built and tested context management strategies against reasonable conversation lengths. What they found, as real users started using Alyx across longer workflows, was that failures were appearing late — way late, like turn 15 or 20 — and nobody knew until a user complained or DeLucia went looking in the data.

The fix she described is what she calls long session evals: load the first 10 turns of a conversation, then test what happens on turn 11. Make the failure mode synthetic and reproducible, so it shows up in testing instead of in production. It's not a revolutionary concept — it's basically just "write tests for the thing that was breaking" — but the insight that long sessions needed their own evaluation category is worth marking.

The subtext here is about how usage patterns outrun design assumptions. When DeLucia started, she was seeing fewer than 10 turns per conversation. Now she's seeing 20-plus. Users are traveling across the full Arize application with Alyx open, asking questions across contexts, using it for extended workflows. The product is succeeding in a way that creates new engineering problems. That's a good problem to have, but it's still a problem.

The Sub-Agent Pattern as Pressure Relief

Even with smart truncation and long session evals, some tasks were just too heavy for one context window. Arize's search task — where Alyx queries across hundreds of spans to find patterns — involves multiple queries, large intermediate results, and step-by-step reasoning that compounds on itself.

DeLucia's team's answer: move that work out of the main agent entirely. The main conversation stays light — chat history and minimal context. When heavy computation is needed, the main agent delegates to a sub-agent that handles all the data-intensive work in its own context. Results come back to the main agent; the heavy context stays sequestered.

"Not all context belongs in the same agent," DeLucia said. "Offload the heavy task. The main conversation can stay small."

This is the sub-agent pattern as context management, which is a slightly different framing than how it usually gets discussed. Sub-agents are often pitched as a parallelism tool — do multiple things at once. Here the argument is simpler: one context window has a ceiling, so stop trying to fit everything in one context window.

What Claude Code Couldn't Settle

Here's the bit I found most telling. During the Q&A, an audience member asked about cache invalidation — specifically, the lengths Anthropic apparently went to in Claude Code to avoid cache-busting their context management. The Claude Code source had been partially released and people had been reading it.

DeLucia's answer was honest: they haven't invested heavily in cache optimization yet. They're focused on long-term memory first because that's where user complaints are coming from.

But earlier in the talk, she'd mentioned something that I keep turning over. When Arize looked at what Claude Code was doing for context management after the release, they found something close to their own approach — head/tail preservation with compression and storage. "We were kind of hoping to get a little bit of a secret from them," DeLucia said. "But I guess we'll all just have to keep doing our own research there."

The team that built one of the most capable coding agents in production independently converged on something that looks like what a year-old product team at an observability startup figured out through trial and error. That's either a sign that the head/tail-plus-memory-store approach is genuinely the right answer for now, or it's a sign that everyone is solving the same problem with similar tools and nobody has found the real unlock yet.

DeLucia would probably say both things are true. Her unsolved list includes real long-term memory across sessions, principled context budgeting (right now the first-100/last-100 heuristic is just a heuristic), and clear metrics for context quality that don't rely entirely on downstream evals.

What she doesn't put on the unsolved list: the premise that context engineering has quietly become the central problem in agent development. That one she considers settled.


Yuki Okonkwo is Buzzrag's AI & Machine Learning Correspondent.

From the BuzzRAG Team

AI Moves Fast. We Keep You Current.

Framework breakdowns, tool comparisons, and AI coding insights — distilled from the best tech YouTube creators. Free, weekly.

Weekly digestNo spamUnsubscribe anytime

More Like This

Man in dark shirt gesturing while discussing AgentCraft game interface with fantasy strategy gameplay and "Games =…

This Developer Turned Coding Agents Into an RTS Game

Ido Salomon built AgentCraft to solve a weird problem: managing multiple AI coding agents feels like playing StarCraft. So he made it literally look like that.

Yuki Okonkwo·3 months ago·6 min read
Two men in professional attire at an AI Engineer Europe event, with Google DeepMind branding and "Agentic Panel" text…

Inside Google DeepMind's Messy Reality of AI Agents at Scale

Google DeepMind engineers have worse token quotas than paying customers. KP Sawhney and Ian Ballantyne reveal what running AI agents at Google scale actually looks like.

Yuki Okonkwo·2 months ago·8 min read
Three presenters stand before a whiteboard with AI architecture diagrams, with overlaid text reading "AI Engineer Europe…

When Your AI Agent Should Actually Be a Workflow

Most AI 'agents' should be workflows instead. A technical workshop reveals why autonomy isn't always better—and how to choose the right architecture.

Bob Reynolds·3 months ago·7 min read
Bold yellow "NO MORE CHAOS" text with blue glowing arrow and digital brain illustration, green checkmark icon indicating…

Can Harness Engineering Fix AI Agent Chaos?

Archon promises to turn chaotic AI coding agents into deterministic systems via harness engineering. Here's what that actually means—and what it doesn't solve.

Yuki Okonkwo·2 months ago·7 min read
Man speaking at AI Engineer Europe conference, displaying agent builder tools including Cursor, Claude Cowork, and Harvey…

4 Patterns the Best AI Agents Actually Share

Flinn AI's Mardu Swanepoel studied Harvey, Cursor, Manus, and Claude to find what top agents share. The answer: focus, transparency, personalization, reversibility.

Yuki Okonkwo·2 months ago·
Man in dark shirt smiling in front of blue interface displaying context engine technology, with AI Engineer Europe and…

The Context Problem AI Agents Can't Solve Alone

Peter Werry of Unblocked explains why RAG, MCP servers, and bigger context windows won't save your AI agents—and what a real context engine actually requires.

Yuki Okonkwo·2 months ago·7 min read
Skeptical man with beard next to glowing AI box with arrow pointing to broken red bug icon, with text "AI FIX THIS? STILL…

AI Can Write Code, But Can It Make Software Stop Sucking?

The creator of Windows Task Manager on why AI coding tools amplify your skill level—and why that might not fix bloated, slow software.

Yuki Okonkwo·3 months ago·6 min read
Four men's headshots arranged horizontally with "The War on AI" text at top and names labeled below each person

Opus 4.7 Drops Amid Molotov Cocktails and AI Fear

Anthropic's Opus 4.7 launches as a 20-year-old throws a Molotov cocktail at Sam Altman's house. The AI world is splitting in two—and it's getting violent.

Yuki Okonkwo·3 months ago·6 min read

RAG·vector embedding

2026-05-12
2,007 tokens1536-dimmodel text-embedding-3-small

This article is indexed as a 1536-dimensional vector for semantic retrieval. Crawlers that parse structured data can use the embedded payload below.