Context Engineering
Agentic Context Engineering: How Evolving Contexts Make Language Models Self-Improving

Sage Holloway
21 min read
Go back to blog
SHARE

The first failure looked harmless: one edge case disappeared from a long set of instructions. Then another vanished. By the time the agent sounded cleaner and more confident, it had quietly forgotten the rules that made it useful. The context was shorter. The work was worse.
Agentic Context Engineering, or ACE, improves language-model agents at runtime by treating context as an editable playbook instead of repeatedly rewriting one prompt. A Generator acts, a Reflector extracts lessons from execution feedback, and a Curator applies localized additions, edits, or removals. This incremental loop preserves useful detail, limits context collapse, and lets strategies improve without changing model weights. Evidence comes from the ACE paper and official repository.

ACE changes the playbook in precise patches while leaving useful instructions intact.
That is the direct answer. The more useful answer begins with a distinction: a model does not become self-improving in the science-fiction sense. Its weights remain unchanged. The system improves the instructions, strategies, and lessons placed around the model during inference, which is the period when the model is actually handling a request.
This guide covers:
what ACE changes compared with prompting and fine-tuning
why repeated whole-context rewriting loses knowledge
how the Generator, Reflector, and Curator divide the work
what an evolving playbook and delta update look like
how to stop noisy feedback from becoming durable bad advice
where cost, caching, compaction, memory, tools, and evaluation fit
what the reported benchmark gains do and do not prove
It will not give you a pretend ten-line production integration. The official project is a Python library, and its repository does not guarantee turnkey integration with every agent framework or native tool-calling stack.
What Agentic Context Engineering changes
Most prompt work starts with a document and ends with a better document. You revise instructions, add an example, remove ambiguity, and ship the new version. That works when the task stays stable and a human can judge every change.
An agent creates a different problem. It takes actions across many steps, receives outcomes, encounters edge cases, and needs to carry useful lessons forward. A static prompt can describe the job, but it cannot absorb each new execution lesson on its own. A full rewrite can absorb lessons, but it may erase earlier ones while making the prose look tidier.
ACE agentic context engineering treats the context as an evolving operational artifact. The paper's architecture separates acting, reflecting, and editing. The current playbook guides an execution. Feedback from that execution becomes evidence. A bounded update changes only the relevant part of the playbook.
The result resembles learning because future runs can use strategies discovered during earlier runs. The important precision is that the system adapts through context. The underlying language model does not update its parameters.
ACE versus prompt engineering and parameter fine-tuning
Prompt engineering improves the instructions supplied to a model. It usually assumes a person or optimizer will produce a new prompt version. ACE also works on instructions, but it organizes them as individual strategies and updates them repeatedly from execution traces.
Parameter fine-tuning changes model weights, the numerical values learned during training. That can be powerful, but the result is harder to inspect and harder to selectively undo. An ACE playbook remains readable. If one rule becomes stale, an operator can locate and remove that rule without retraining a model.
This makes ACE attractive when lessons arrive continuously, need to remain auditable, or may need selective removal. It does not make fine-tuning obsolete. Fine-tuning can change broad model behavior; ACE changes the runtime material the model sees. They solve related but different jobs.
If you need the broader boundary first, read prompt engineering versus context engineering. ACE lives on the context-engineering side, but it is one specific framework inside that larger discipline.
The boundary between ACE, generic context engineering, and platform products
Generic context engineering means selecting and arranging the instructions, retrieved facts, conversation state, tool definitions, and other information a model receives. ACE is narrower. It is a method and open-source Python framework for evolving a structured context playbook from feedback.
There is also a naming trap. Some commercial products use phrases such as “agentic engineering platform” for developer portals, infrastructure workflows, or software-delivery systems. Those products may provide useful context to agents, but they are not automatically implementations of the Stanford ACE framework.
The acronym creates a second search problem because an ACE paper review can mean several unrelated research threads, while Cognition context engineering points toward a different product and memory discussion. Those deserve their own treatment. Folding them into this page would blur the job you came here to solve.
So when evaluating agentic context engineering platforms or agentic context engineering tools, ask one blunt question: does this product implement the Generator, Reflector, Curator, and localized playbook-update loop, or is it using similar language for a different layer? The label is not the architecture.
Why whole-context rewriting fails
Imagine a field mechanic’s binder that has survived ten years of strange breakdowns. One page notes that a certain rattle only appears after rain. Another records the odd bolt size on an older model. A third warns that the obvious repair can damage a hidden seal. Every few weeks, someone rewrites the entire binder to make it shorter and more elegant.
The new binder reads beautifully. It also loses the rain note, rounds the bolt size, and turns the seal warning into “use caution.” Nothing looks broken until the next machine arrives on a wet morning. Then elegance sends the mechanic in the wrong direction.
That is the failure ACE calls context collapse. Repeatedly rewriting the complete context can compress away rare, specific, high-value knowledge.
Brevity bias drops useful detail
Large language models tend to summarize when asked to consolidate a long body of material. That tendency creates brevity bias: the rewrite favors a concise representation even when the omitted details carry operational value.
The problem is not that shorter context is always worse. Duplication, obsolete instructions, and irrelevant history should leave. The problem is using length as a proxy for quality. A rare exception may consume 30 words and matter only once in 500 runs, yet save the 501st run.
The ACE paper contrasts its approach with methods such as Dynamic Cheatsheet, which repeatedly rewrite the accumulated strategy set. In the paper's context-collapse example, the context falls from 18,282 tokens at 66.7% accuracy to 122 tokens at 57.1% accuracy around adaptation step 60. That is a controlled example, not a universal collapse schedule. It shows the mechanism with unusual clarity: compression can look efficient while performance falls.

The paper's example shows why a radically shorter context can be a loss event, not an optimization win.
Context collapse compounds across rewrites
One rewrite may drop one nuance. The next rewrite starts from that already reduced version, so the missing nuance cannot defend itself. Later summaries compress the compression. Information loss compounds.
This is especially dangerous for long-horizon agents, meaning agents that perform many connected actions over time. Their useful knowledge often consists of awkward exceptions: a tool's surprising return shape, a sequence that avoids a timeout, or a constraint that only appears after several actions. Smooth prose is not the goal. Reliable future action is.
Why incremental updates change the failure mode
ACE replaces the rewrite-everything operation with deltas. A delta is a small, explicit change such as adding one strategy, revising one item, or removing one harmful item. Stable material stays untouched.
Incremental editing does not eliminate bad learning. It makes bad learning easier to locate. A faulty addition has an identity, a reason for inclusion, and a bounded blast radius. That gives operators something a monolithic prompt rarely offers: a practical path to inspection and rollback.
The cleaner prompt was never the prize. The prize was keeping the ugly little fact that prevents tomorrow’s failure.
How the Generator, Reflector, and Curator loop works
ACE context engineering divides adaptation into three roles. This division matters because acting, judging, and maintaining a knowledge artifact place different demands on a model. Combining them in one giant prompt may be possible, but it makes the reasoning harder to inspect and the update harder to control.

A query and current playbook guide execution; feedback becomes reflection; reflection becomes a bounded playbook delta.
Generator: act and record a trajectory
The Generator uses the current playbook to attempt a task. Its output is not only a final answer. It produces a trajectory, the ordered record of observations, decisions, tool calls, intermediate results, and outcomes created during the run.
Think of the trajectory as the evidence trail. If the agent selected the wrong tool, used an invalid formula, or recovered after a failed attempt, the trace shows where that happened. Without a useful trace, later reflection turns into guesswork.
The Generator can also mark which playbook items appeared helpful or harmful during execution. Those signals support later maintenance, but they should not be confused with truth. A model's self-assessment is still a judgment that needs corroboration from the environment when possible.
Reflector: extract lessons from feedback
The Reflector reviews the trajectory alongside feedback. Feedback may be a compiler result, a unit test, a sandbox success signal, an environment score, or another observable outcome. The Reflector's job is to turn the specific run into candidate lessons that could improve later runs.
A weak reflection says, “be more careful.” A useful reflection names the condition, action, and consequence: when a field arrives as a string rather than a number, normalize it before applying the formula. That lesson is specific enough to test and reuse.
This is also where the quality ceiling appears. If the feedback is wrong, incomplete, or merely subjective, the Reflector may derive a confident lesson from a false premise. ACE can adapt without human labels when the environment supplies reliable natural feedback, but “no labels” does not mean “no signal.”
Curator: turn lessons into bounded deltas
The Curator compares candidate lessons with the existing playbook. It decides whether to add a novel item, edit an existing one, or remove material that has proved harmful or redundant. The output is a localized operation rather than a newly rewritten playbook.

The three roles separate execution evidence, lesson extraction, and controlled editing.
The Curator is maintenance, not magic. It needs a predictable payload and deterministic application logic around it. Deterministic means the same validated operation produces the same change every time, without asking another model to reinterpret the request.
The official ACE repository is the right place to inspect the current implementation. For a visual walkthrough of the same lifecycle, this allowlisted ACE video follows the Generator, Reflector, and Curator loop. Use it to reinforce the diagram, not as a substitute for the paper or code.
The evolving playbook and incremental delta updates
The playbook is external, structured context. It holds strategies, formulas, recurring mistakes, and domain-specific lessons in a form the Generator can use on the next attempt.
The itemized playbook format
ACE stores knowledge as itemized bullets rather than one continuous essay. Items can carry stable identifiers plus helpful and harmful counters. A simplified repository-backed shape looks like this:
The identifier gives an operation a target. The counters provide evidence for later refinement. The section keeps related knowledge together, which makes retrieval and review easier than searching an undifferentiated wall of prose.

An itemized playbook makes advice addressable, measurable, and selectively removable.
This format also changes how people can audit the system. You can inspect a strategy in plain language, see whether runs marked it helpful or harmful, and delete it without touching unrelated advice. Compare that with a weight update, where the learned behavior is distributed across parameters and cannot be removed with one text edit.
Add, edit, and remove without a full rewrite
A Curator delta can be represented as structured fields such as reasoning, operations, type, section, and content. The exact implementation belongs to the official code, but the architectural rule is broader: keep proposed intent separate from the deterministic function that applies the change.
This example illustrates the documented fields and localized-operation pattern. It is not a promise that every ACE version accepts this exact standalone payload unchanged.

Structured delta fields let ordinary validation code reject malformed changes before they touch the playbook.
Why separate proposal from application? Because generated text can be malformed. A parser can require an allowed operation type, an existing target for edits, a valid section, and nonempty content. The model proposes. Code checks and applies.
Grow-and-refine controls for accumulated context
An append-only playbook eventually becomes a junk drawer. ACE addresses growth through a grow-and-refine process: add useful strategies, then prune low-utility, harmful, or redundant items. Semantic comparison can help detect duplicates, while helpful and harmful counts provide an operational signal for retention.
Do not mistake a counter for a verdict. An item used twice in rare emergencies may matter more than a generic item marked helpful 50 times. Pruning needs task-aware review, especially when failures have unequal costs.
I tried treating context maintenance as a writing problem, and it failed exactly where writing advice usually succeeds. The crispest sentence won. The most useful exception lost.
That is why context-engineering best practices should include retention policy, provenance, and evaluation, not only prompt composition.
How to keep noisy feedback from polluting the playbook
Here is the complication: incremental updates preserve good details, but they can preserve bad lessons just as efficiently.
The ACE paper identifies dependence on feedback and reflection quality as a limitation. Controlled benchmarks can provide clean signals such as task success, compiler outcomes, or sandbox results. Production systems often receive delayed conversions, ambiguous user behavior, contradictory reviewers, and partial traces. A Curator cannot manufacture certainty from that mess.
Separate strong execution signals from weak judgments
Rank feedback by how directly it measures the intended outcome. A passing deterministic test is stronger evidence than a model saying its answer “looks good.” A completed transaction may be stronger than a click. A human correction from a domain expert may be strong, but only for the scope that person actually reviewed.
A practical evidence record should retain the source, task, time, environment, outcome, and trace reference behind a proposed lesson. This is a production control pattern, not a claimed ACE default. Its purpose is simple: future reviewers need to know why an item exists.
Be wary of proxies. If you reward shorter completion time, the agent may learn to skip verification. If you reward user clicks, it may learn sensational phrasing. The playbook will faithfully encode whatever the loop treats as success.
Validate Curator operations before applying them
Put a non-model validation layer between Curator output and durable context. At minimum, check that:
the payload parses against the expected schema
the operation type belongs to an allowlist
an edit or removal points to an existing stable ID
the section is valid for this playbook
the content is nonempty and within the accepted size
the operation does not silently rewrite unrelated items
the source evidence remains attached for audit
These checks do not prove a lesson is true. They prevent malformed or overbroad operations from becoming truth by accident.

A production validation path can quarantine weak evidence before it becomes durable context. This pattern is not an ACE default.
Confidence scores and cross-model consensus can be useful design options, but the packed official sources do not establish them as standard ACE behavior. Even when used, they are weak substitutes for execution evidence. Two models can agree on the same plausible mistake.
Quarantine, prune, and roll back suspect strategies
Do not force every candidate lesson into an immediate yes or no. A quarantine state lets you collect more evidence before promotion. Run the candidate against replayed traces, a shadow evaluation set, or a limited traffic slice. Promote it only when the relevant outcome improves without damaging protected cases.
Keep versions of the playbook and an append-only operation log. If performance drops, you should be able to identify the recent deltas and restore the last known-good version. This is where context poisoning becomes relevant: durable agent memory expands the attack surface because malicious or misleading inputs may be converted into future instructions. The deeper threat model belongs in the guide to context poisoning.
Pruning should follow evidence too. Remove clearly harmful items, merge true duplicates, and review stale rules against current tools and policies. Avoid automatic deletion merely because a rare item has low usage. Silence is not proof of uselessness.
Cost, context growth, and compaction
An evolving playbook creates an obvious concern: if the context keeps growing, will every request become slower and more expensive?
Sometimes. Larger inputs still consume context-window capacity and can affect latency. ACE's reported evaluation also shows why billed cost does not necessarily rise in direct proportion to raw playbook length.
What the paper reports about cache reuse and billed input cost
The paper reports that a GPT-5.1 evaluation reached 91.8% cache reuse and 82.6% lower billed input-token cost. A key-value cache, or KV cache, reuses model computation for an unchanged prompt prefix. If a stable playbook appears in the same place across requests, the provider may avoid recomputing much of it.

These are results from a controlled GPT-5.1 evaluation, not a provider-wide cost guarantee.
The qualification matters. Cache behavior depends on the provider, model, request layout, cache policy, and how much of the prefix remains identical. Changing content near the start may invalidate reuse downstream. Pricing can also distinguish cached and uncached input differently.
So do not copy 82.6% into a budget forecast as though it were a universal discount. Measure cache hits, billed cached tokens, uncached tokens, latency, and task success in your own environment.
When compaction complements an evolving playbook
Compaction summarizes or removes old conversational material when a history grows too large. It solves a different problem from ACE's localized playbook editing. A system may compact transient conversation history while preserving a stable playbook of reusable lessons.
For example, Haystack's HistoryCompactor represents the broader long-horizon pattern of compressing history. Anthropic's guidance on effective context engineering for AI agents also describes compaction and structured note-taking as context controls. These techniques can sit beside ACE, but they are not evidence that ACE itself owns every memory function.
The useful boundary is durable versus transient. Durable lessons belong in the reviewed playbook. Temporary observations, intermediate tool output, and conversational detail belong in working state and may be compacted later.
Why benchmark economics may not transfer unchanged
A benchmark repeats structured tasks under controlled conditions. Production traffic may vary tool definitions, user-specific data, system instructions, and retrieved documents on every request. That variability can reduce prefix stability and cache reuse.
Measure the whole system, not one token number. A larger playbook that prevents retries could save money even with lower cache reuse. A bloated playbook that adds latency without improving outcomes could cost more despite excellent caching. The relevant unit is cost per successful task, with quality and latency beside it.
For a broader treatment of shrinking histories without erasing durable state, see Anthropic context management.
Where ACE fits in an agent stack
ACE is one layer in an agent system. It does not replace the application, orchestration engine, memory stores, tools, or evaluation system around it.

ACE evolves the playbook within a wider stack. It does not absorb every neighboring responsibility.
Stateful orchestration and memory boundaries
An orchestration layer controls the sequence of agent steps and carries state between them. It might invoke the Generator, record the trajectory, wait for feedback, call the Reflector, validate a Curator delta, and persist the next playbook version.
The packed evidence does not verify a turnkey ACE integration with LangGraph or LlamaIndex. You can map ACE concepts into a state machine, but that mapping remains your architecture work unless an official adapter says otherwise.
Memory also needs boundaries. The playbook stores reusable strategies. A database may store user facts, documents, or episodic traces. Retrieval may select only relevant items for a particular task. A context graph can represent relationships and provenance across those items, but ACE does not require every system to become a graph.
Tool definitions, MCP, and selective loading
Tool definitions tell a model what actions it can call and what arguments those actions accept. MCP, or Model Context Protocol, is a protocol for connecting AI applications to external tools and data sources. Both consume context and affect execution, but neither is automatically managed by ACE.
The official repository marks a tool-calling extension as “coming soon.” Treat that as roadmap language, not a guarantee that native MCP or general tool calling works in the current main library. You can still place tool-use lessons in a playbook, while the surrounding application handles actual invocation.
As tool catalogs grow, a selective loader such as a SearchableToolset pattern can retrieve only relevant definitions. That reduces context pressure. It is an adjacent context-engineering technique, not proof of a built-in ACE feature.
Evaluation and observability around the loop
Evaluation measures whether the evolving system gets better. Observability records what happened: which playbook version ran, which items were used, what tools were called, what feedback arrived, and which delta followed.
Track at least task success, failure category, playbook version, delta rate, rollback rate, context size, cache reuse, latency, and cost per successful task. The exact metric set should match the harm profile. A medical-support workflow needs different gates from a sandbox coding benchmark.
TGC and SGC are AppWorld goal-completion measures used in the evaluation context. They matter when reading the paper, but production teams should not transplant benchmark metrics without mapping them to real user outcomes.
What the results show, and what they do not
The agentic context engineering paper reports gains across agentic and domain-specific tasks. Those results support the core claim that evolving context can improve performance. They do not guarantee that attaching ACE to an arbitrary workflow will produce the same numbers.
Benchmark gains and model coverage
The paper reports an average gain of 10.6% on the AppWorld agent suite, 8.6% across the FiNER and XBRL Formula finance tasks, 15.0% on DDXPlus medical diagnostics, and 5.1% on BIRD-SQL text-to-SQL.

Reported average gains across four evaluation groups. These are controlled benchmark results, not production guarantees.
ACE was evaluated across open and proprietary model families including DeepSeek-V3.1, GPT-OSS-120B, GPT-5.1, and Llama-3.3-70B-Instruct. Gains varied with the backbone. Stronger reasoning can produce stronger trajectories and reflections; weaker reflection can introduce noisier lessons.
The paper also reports a 14.8% AppWorld gain over standard ReAct baselines without ground-truth labels, using natural execution feedback. ReAct is an agent pattern that interleaves reasoning with actions. Again, adaptation without labels still relies on meaningful outcomes from the environment.
Controlled feedback versus production noise
Benchmarks offer repeatable tasks and scoring. A compiler either accepts a program or it does not. A sandbox can often report task completion. Real organizations face missing events, changing policies, biased reviewers, seasonal behavior, and users who abandon a workflow for reasons the agent never sees.
That gap does not invalidate the results. It tells you what to test next. Begin with a workflow where outcomes arrive quickly and can be attributed to a specific run. Add replay tests and protected cases. Promote lessons gradually. Watch whether the playbook improves success outside the examples that generated it.
Workloads that do not need evolving context
Simple question answering, fixed-rule transformations, and short tasks with stable instructions may not justify ACE's extra calls, state, validation, and review. A well-designed static context can be cheaper and easier to reason about.
ACE becomes more compelling when tasks repeat, trajectories expose reusable lessons, feedback is trustworthy, and the cost of forgetting exceeds the cost of maintaining the loop. If those conditions are absent, the clever architecture becomes ceremony.
FAQ
How does Agentic Context Engineering prevent context collapse?
ACE stores advice as itemized playbook entries with stable identities and changes them through localized deltas. Because the Curator does not rewrite the entire playbook after every run, useful earlier details can remain intact while specific items are added, edited, or removed.
Does a larger playbook mean much higher API and serving costs?
Not necessarily. The paper's GPT-5.1 evaluation reported 91.8% cache reuse and 82.6% lower billed input-token cost, but those figures depend on controlled conditions and should not be generalized to every model or provider. Measure cache stability, latency, and cost per successful task in your own stack.
Is the official ACE framework code open-source?
Yes. The researchers publish the core Python framework in the official ACE GitHub repository. The repository is the authority for current features and setup, especially where older discussions predate the code release.
How does ACE compare with parameter fine-tuning?
Fine-tuning changes model weights. ACE changes human-readable runtime context, which makes learned strategies easier to inspect, share, edit, and selectively remove. The two methods can complement each other, but ACE does not give a base model capabilities it fundamentally lacks.
Can ACE adapt without ground-truth labels or human supervision?
Yes, when the environment provides useful natural feedback such as compiler outcomes or sandbox success. The paper reports a 14.8% AppWorld gain over standard ReAct baselines without ground-truth labels. No labels does not mean no evidence; noisy or missing outcomes weaken the loop.
Which benchmarks evaluated ACE, and what gains were reported?
The paper reports average gains of 10.6% on AppWorld, 8.6% across FiNER and XBRL Formula, 15.0% on DDXPlus, and 5.1% on BIRD-SQL. These results span agent tasks, finance, medical diagnostics, and text-to-SQL under controlled evaluation conditions.
How does ACE perform across different language models?
The research evaluated multiple open and proprietary families, including DeepSeek-V3.1, GPT-OSS-120B, GPT-5.1, and Llama-3.3-70B-Instruct. ACE improved over relevant baselines across families, but the size of the gain varied because trajectory and reflection quality depend partly on the backbone model.
How does the Curator decide which strategies to add or prune?
The Curator compares reflected lessons with the current playbook, adds novel useful items, and supports grow-and-refine maintenance. Stable IDs plus helpful and harmful signals make items addressable, while redundant, low-utility, or harmful bullets can be pruned. Production systems should preserve evidence and review rare but consequential rules before deletion.
What are the main limitations and failure modes of ACE?
ACE depends on feedback quality and reflection quality. Noisy signals can create spurious lessons, playbooks can grow, extra model calls add overhead, and tool-calling support remains a stated extension rather than a capability to assume. Simple or fixed-rule workloads may gain too little to justify the machinery.
Try this decision test before adopting ACE
Take one recurring agent workflow and write down five things: how many connected steps it runs, what reusable lessons appear in its traces, how quickly reliable feedback arrives, how costly forgetting is, and who can review a bad update. If you cannot answer at least four of those, keep the context static for now.
If you can answer them, run a small offline adaptation loop. Version the playbook, validate every delta, protect a replay set, and compare cost per successful task against the static baseline. Do not begin by asking whether the playbook can grow. Ask whether the evidence deserves to become memory.
The next generation of agents may look less like models that magically learn and more like systems that maintain their operating knowledge with care. That future is less cinematic. It is also much easier to debug.
Until then...
Sage
PS. Pick one rule your agent follows today and trace where it came from. If nobody can find the evidence, you have already discovered your first maintenance task.
Author
Practical guides, tool teardowns & AI engineering workflows.
Related Articles


