Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could learn from every interaction without constantly rewriting their prompts? Each execution can reveal useful lessons, but these insights are often lost once the task ends. After exploring prompt optimization with TextGrad and GEPA, this episode introduces Agentic Context Engineering (ACE), which takes a different approach: continuously improving an evolving playbook of reusable knowledge rather than rewriting prompts. In this episode, we explore how ACE works, how to implement it in Python, and what a banking intent classification experiment reveals about its effectiveness and limitations. You’ll learn: * How does ACE enable continuous improvement? The roles of the evolving playbook and the Generator-Reflector-Curator architecture. * How can ACE be implemented? Building feedback loops, updating the playbook, and enabling offline and online adaptation. * How should the results be evaluated? Measuring classification accuracy, examining accumulated knowledge, and understanding the trade-offs of evolving context. 👉 Enjoyed this episode? Subscribe to The AI Practitioner to get future articles and podcasts delivered straight to your inbox: aipractitioner.substack.com Get full access to The AI Practitioner at aipractitioner.substack.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
[music]
SPEAKER_02Welcome back to The AI Practitioner. I'm Lina Faik, ML Engineer, Consultant and Lecturer in Advanced Machine Learning at Sorbonne University. I help companies turn their data into real outcomes with AI, and this is where I share what I learned from actual projects. The deep technical write-ups live on Substack at AIPractitioner.substack.com, and these conversations are the audio companion. Today I'm joined by Sam, an engineer who builds with data and software, and who is curious about LLM agents but hasn't worked hands-on
SPEAKER_02with this particular method. Sam, welcome.
SPEAKER_01Thanks Lina, happy to be here. So what's on the table today?
SPEAKER_02Picture this. A customer writes to a bank's support chat. Why is my transfer taking so long to complete? An agent has to route that message to one of 11 closely related intents, and it picks transfer timing, the intent for general questions about how long transfers take. The expected answer was transfer not received by recipient.
SPEAKER_01Ouch.
SPEAKER_02Ouch indeed, but a wrong answer is not the interesting part. The interesting part is what happens next. In most setups, that lesson dies right there. Today's topic is ACE, short for Agentic Context Engineering, an approach where that failure becomes a written lesson the agent can reuse. It's part 4 of my series on prompt optimization.
SPEAKER_01Hold on though, misrouted messages happen all the time. Why not just fix the prompt, add one line saying delayed transfers are not timing questions and move on?
SPEAKER_02For one mistake, that works. The trouble appears over time. The ACE paper points to three limits of classic prompt optimization. First, brevity bias. Repeated optimization tends to favor short instructions and useful domain details get squeezed out. Second, context collapse. Rewriting the whole prompt can slowly erase what was learned before. Third, static adaptation. Once the prompt is deployed, it doesn't absorb new feedback until you run another optimization cycle.
SPEAKER_01Context collapse sounds like the scary one.
SPEAKER_02It is the one I find most intuitive. Imagine summarizing your own notes every week and each time keeping only the highlights. After a few rounds you're left with vague generalities and the sharp details are gone.
SPEAKER_01Okay, so what does Ace do instead?
SPEAKER_02It treats the agent's context as an evolving playbook rather than a fixed set of instructions. The playbook is a collection of small entries. Each one holds a reusable strategy, a domain concept, or a known failure mode. When something new is learned, ACE adds or refines one entry and leaves the rest untouched. The model's weights never change. All the learning happens in the text the model receives at inference time. The paper came out in October 2025 and was accepted at ICLR 2026.
SPEAKER_01So it's a memory for the agent, written in plain language?
SPEAKER_02Yes, with some bookkeeping. Each entry carries an identifier and counters that track whether feedback on it was helpful, harmful, or neutral. That makes the memory traceable.
SPEAKER_01And who writes those entries? A human?
SPEAKER_02Three specialized roles all played by language models. The generator does the task using the current playbook and produces an answer with its reasoning. The reflector looks at successes and failures and extracts lessons. The curator turns those lessons into structured updates to the playbook.
SPEAKER_01Why three? Couldn't one model do all of it?
SPEAKER_02Separating the roles keeps each change traceable. You can see what was predicted, what lesson was drawn and what edit resulted. The price is extra model calls and we'll come back to that.
SPEAKER_01Walk me through the transfer example then.
SPEAKER_02The playbook starts empty. The generator answers transfer timing because it latches onto the word long. The environment says no, the right intent is transfer not received by recipient. The reflector diagnoses the root cause the model relied on the surface queue of duration without asking whether the customer wanted general processing times or was reporting a specific transfer that never completed. Its key insight is that timing language alone does not establish transfer timing. The curator then writes that into the playbook as one new entry.
SPEAKER_02The reflector's full structured output and the resulting entry are printed in the article, so I'll leave them there.
SPEAKER_01Hmm, I want to push back on that. The message never says the recipient didn't get the money. Is that label even right?
SPEAKER_02Good catch, and the article says it openly. The label is not entirely unambiguous, so part of the lesson reflects the dataset's labeling convention. In the final playbook, that entry even carries a warning. Treat this as an example-specific mapping, not a general rule for every incomplete transfer.
SPEAKER_01So the system noticed it was overgeneralizing.
SPEAKER_02It refined its own entry, yes. But I'd stay careful. ACE can record inconsistencies like this and it cannot resolve them without reliable feedback. Ambiguous labels in, misleading strategies out. That's a real limitation of any feedback-driven learning.
SPEAKER_01Yeah. And how are entries edited? Does the curator rewrite the playbook?
SPEAKER_02Never wholesale. The curator proposes small local changes called Delta updates. In the framework I use, there are four kinds. Add an entry, update one, tag one with feedback or remove one. I won't walk through the code on mic, but every step of that loop is implemented in the article.
SPEAKER_01And the playbook just keeps growing?
SPEAKER_02That's the obvious worry. The paper proposes a grow and refine principle. New strategies get added, existing ones get updated in place, and entries are compared using semantic embeddings, so that near duplicates can be merged. You can run that after every update or only once the playbook passes a length threshold. It trades extra processing for a more compact playbook.
SPEAKER_01Got it. How was the experiment set up?
SPEAKER_02I used a subset of Banking77, a public dataset of banking customer messages, 11 close intents around transfers, card delivery and fees, 44 messages for training, 44 for validation, which ACE doesn't use here, and 440 for the final test on unseen messages. Feedback comes straight from the labels. In production, it could come from a support agent correcting a routing decision.
SPEAKER_01That's a realistic source.
SPEAKER_02Right, and Ace learns in two modes. Offline, it makes one pass over the training messages and updates the playbook after each one. That produced 14 entries. Online, I simulated two weeks of production traffic, 51 messages. For each one, the agent predicts, gets feedback and updates before the next message. And in week two, three new top-up intents appear, with no extra offline training.
SPEAKER_01Wait, new intents and no retraining at all?
SPEAKER_02None. The playbook grew from 14 to 24 entries including a new rule for the top-up cases. One of them says to classify by the attempted operation and the reported outcome, not merely by the funding instrument. It helps separate a failed top-up from a declined card payment. New knowledge went in without rewriting anything that was already there.
SPEAKER_01Okay, show me the numbers.
SPEAKER_02On the 440 unseen messages, overall accuracy goes from 80% for the seed agent to 84% for the ACE agent. The biggest gain is on transfers not arrived, from 72 to 78. Fees stay flat at 94.
SPEAKER_01Four points. Honestly, that sounds modest.
SPEAKER_02It is, and the article doesn't dress it up. The more interesting view is underneath. Compared with the seed agent, ACE fixes 30 errors but introduces 13 new ones. The net is 17 more correct messages.
SPEAKER_01So the playbook also breaks things.
SPEAKER_02Sometimes, yes. Higher aggregate accuracy doesn't mean every entry is beneficial. That's exactly why the counters and the inspectable entries matter. You can read the playbook and spot rules that help and rules that look suspicious.
SPEAKER_01And does the online part actually pay off compared with a frozen playbook?
SPEAKER_02There are signs of it. In Week 1, transfer refusal accuracy rises from 50% to 67% for the learning agent. In Week 2, top-up accuracy goes from 83% to 89%. But the stream is tiny, so those gains rest on a few examples. It's a direction, not proof.
SPEAKER_01How does ACE compare with TexGrad and JIPA, the other two methods in your series?
SPEAKER_02In one line each. Textgrad uses an LLM to write feedback on errors, then revises the prompt, a bit like gradient descent in words. JIPA generates several prompt candidates from execution traces and keeps the best. ACE keeps a playbook and edits individual entries. On test accuracy, Textgrad and JIPA both reach 82% and ACE reaches 84. The net gains are 7, 8 and 17 messages. The full per intent tables are in the article.
SPEAKER_01So ACE wins?
SPEAKER_02I'd be careful with that word. The methods use different optimization budgets and ACE also learns from the production stream. This experiment doesn't establish a universally better method.
SPEAKER_01What about cost? You mentioned extra calls earlier.
SPEAKER_02On task model calls, ACE needs only 95, against 528 for TexGrad and 412 for JIPA. But that excludes the reflector and curator calls, so it is not a total cost comparison, and the context is long, 2700 words for ACE against 391 for JIPA, which still reaches 82%. A longer context makes every later inference more expensive.
SPEAKER_01So when would I pick which?
SPEAKER_02Textgrad suits iterative refinement, especially in multi-step LLM pipelines. JIPA suits a compact prompt found through candidate exploration. ACE suits recurring tasks where feedback keeps arriving after deployment. And they can be complementary, use Textgrad or JIPA to periodically optimize the base prompt, and let ACE maintain the task-specific knowledge, validating any update on held-out data before it ships.
SPEAKER_01Let me make it concrete. If I'm at my desk on Monday morning and want to try this on my own agent, where do I start?
SPEAKER_02With the feedback signal. Ask who tells the agent it was wrong. A label, a customer, a support agent's correction. The article is clear that everything downstream depends on feedback quality. Then run a small offline pass and read the playbook entries by hand before trusting them. The full walkthrough and the series are on Substack at AIPractitioner.substack.com and the complete code is on GitHub for paid subscribers. The link is in the caption.
SPEAKER_01So the real work is deciding what counts as a good lesson.
SPEAKER_02Exactly. The agent's context stops being a fixed instruction and becomes a memory you can read, audit and correct. That is powerful, as long as what goes into that memory is trustworthy. [music]
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could continuously improve their...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could improve their own prompts...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if the key to better AI agents isn’t writing...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if improving an AI agent’s performance had less...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. Standard RAG works well when the answer is contained...