Skip to main content
PromptPalPromptPal
Pricing
Sign inGet started free
  1. Home
  2. /
  3. Blog
  4. /
  5. General

Agentic Context Engineering: Prompts and Examples

Agentic context engineering treats an agent's context as a playbook that gets updated from experience. Here is how it works, with three copy-ready prompts to try.

Author: PromptPal TeamNovember 19, 2026Updated November 21, 20267 min read
blog-5 (1)
On this page
  1. What it means, in plain terms
  2. The idea behind the paper
  3. A playbook that works as a data structure
  4. Prompt 1: the generator
  5. Prompt 2: the reflector
  6. Prompt 3: the curator
  7. Examples beyond support tickets
  8. Keep a human in the loop at first
  9. Where to keep the three prompts and the playbook
  10. When this isn't worth it
  11. Next step

Agentic context engineering is the practice of letting an AI agent improve its own context over time instead of you rewriting the prompt by hand. The agent runs a task, reflects on what worked, and a separate step edits a living playbook of instructions and lessons that gets fed into the next run. The term comes from a research paper of the same name, and the idea is simple enough to use today with three prompts and a place to keep them.

What it means, in plain terms

Plain context engineering is deciding what goes into the model's context window: instructions, examples, retrieved documents, tool results, memory. If that's new to you, our piece on context engineering versus prompt engineering covers the basics.

The agentic version adds a feedback loop. You don't curate the context once. The system curates it continuously, using what happened in previous runs as the raw material.

Think of a support agent that keeps failing on refund requests for annual plans. In a static setup, you notice, open the system prompt, and add a rule. In an agentic setup, a reflection step sees the failure, writes down the lesson, and a curation step adds it to the playbook as one short entry. Nobody opened a file.

The idea behind the paper

The paper (Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models) frames context as an evolving playbook rather than a fixed prompt. As I read it, it splits the work into three roles:

  • Generator. The agent that does the task, using the current playbook.

  • Reflector. Reads the attempt and its outcome, and extracts concrete lessons: what helped, what caused the failure.

  • Curator. Merges those lessons into the playbook as small incremental updates, not a full rewrite.

The paper is aimed at two problems you'll recognise if you've ever tried to have a model improve its own prompt.

The first is brevity bias. Ask a model to optimise a prompt and it tends to compress it into something tidy and generic. The specific details that made the prompt useful, like the odd edge case or the exact tool quirk, get smoothed away.

The second is context collapse. If the model rewrites the entire context every round, accumulated knowledge can get squashed into a shorter, vaguer version. You lose in one rewrite what took twenty runs to learn.

The fix in both cases is the same: never rewrite the whole thing. Make small, itemised additions and edits. Check the paper itself for its exact setup and results rather than relying on my summary. What follows is a practical version you can run with any chat model or agent framework.

A playbook that works as a data structure

The playbook should be a list of discrete entries, not a paragraph of prose. Each entry gets an ID, a short rule, and a note on when it applies. Discrete entries can be added, edited or removed one at a time, which is what keeps the context from collapsing.

Here is what a few entries might look like for a support agent:

  • [R-04] Annual plan refunds: check the purchase date before quoting policy. Refund eligibility depends on it.

  • [R-09] If the customer pastes an error code, search the help centre for that exact code before suggesting generic fixes.

  • [R-12] Never promise a callback time. Say a teammate will follow up and create a ticket.

Notice they're specific. That specificity is the whole point, and it's what brevity bias destroys.

Prompt 1: the generator

This is the working agent's system prompt. The playbook is a slot you fill at runtime. Keep the instruction short and make the agent report which entries it used, because the reflector needs that.

Prompt template
You are [agent role] working for [company or team].

Your task: [one-sentence description of the task type, e.g. resolve a customer support ticket].

Below is your playbook: lessons learned from earlier tasks. Follow the entries that apply. If two entries conflict, prefer the more specific one and say so.

<playbook>
[paste current playbook entries here]
</playbook>

Task input:
<task>
[task input]
</task>

Respond in this format:
1. Answer: [your final output for the task]
2. Entries used: [list playbook IDs you relied on, or 'none']
3. Gaps: [anything you needed but the playbook did not cover, in one line each]

The Gaps line is cheap and useful. It gives the reflector a head start on what's missing.

Prompt 2: the reflector

The reflector sees the task, the generator's output, and some signal about how it went. That signal could be a human thumbs-up, a test result, a rubric score, or a customer reply. Without any signal, reflection turns into the model guessing about itself, which is not worth running.

Prompt template
You are a reviewer analysing one attempt at [task type].

Inputs:
<task>[task input]</task>
<attempt>[generator output, including entries used and gaps]</attempt>
<outcome>[what happened: test result, rubric score, human feedback, or customer reply]</outcome>
<playbook>[current playbook entries]</playbook>

Do the following:
1. State in one sentence whether the attempt succeeded or failed, and why, based only on the outcome above.
2. List lessons as separate items. For each lesson give:
   - type: new_rule | fix_existing_rule | remove_rule | no_change
   - target: playbook ID if it concerns an existing entry, otherwise 'new'
   - lesson: one or two sentences, specific enough to act on (include names, formats, thresholds or error messages where relevant)
   - evidence: the part of the task or outcome that supports it
3. Do not propose a lesson that the evidence does not support. If the attempt was fine and the playbook was fine, return a single no_change item.

Do not rewrite the playbook. Only report lessons.

The last line matters. Separating reflection from editing is what stops the model from collapsing the playbook on every pass.

Prompt 3: the curator

The curator takes the lessons and produces a delta: a short list of operations against the playbook. Your code (or you, by hand) applies them.

Prompt template
You maintain a playbook of rules for an agent doing [task type].

Current playbook:
<playbook>[current playbook entries with IDs]</playbook>

Lessons from recent attempts:
<lessons>[reflector output, one or more runs]</lessons>

Produce a list of update operations. Allowed operations:
- ADD: new entry with a new ID, a rule, and a 'applies when' note
- EDIT [ID]: replace the text of one entry
- MERGE [ID, ID]: combine two near-duplicate entries into one, keeping every specific detail from both
- REMOVE [ID]: delete an entry that the evidence shows is wrong or obsolete

Rules:
- Keep every specific detail (names, formats, error codes, thresholds). Never replace a specific rule with a general one.
- Do not reword entries that are unaffected by the lessons.
- Skip lessons that duplicate an existing entry.
- Maximum [number] operations per run.
- If nothing needs to change, return 'NO CHANGES'.

Output only the operations, one per line.

The 'keep every specific detail' rule is your direct defence against brevity bias. The cap on operations keeps each run's changes reviewable.

Examples beyond support tickets

The pattern fits any repeatable task where you can tell good output from bad.

  • Coding agent. Outcome is the test suite result. Typical playbook entries: 'run the linter before committing', 'this repo's migrations live in /db/migrate, not /migrations'. Our post on AGENTS.md, skills or MCP covers where that kind of context can live.

  • Sales research agent. Outcome is whether the rep used the brief. Entries like 'lead with the most recent funding or hiring news, reps ignore generic company descriptions'.

  • Data extraction agent. Outcome is a validation failure. Entries like 'dates in these invoices are DD/MM/YYYY, not US format'.

In all three, the value comes from small facts that nobody would think to put in a first-draft prompt.

Keep a human in the loop at first

Fully automatic curation is where this goes wrong. A bad lesson, say the agent concluding that a rule is wrong because of one odd outcome, gets written down and then followed on every future run.

Start by reviewing every curator output yourself. You'll quickly learn which operations you approve nearly always (ADD with clear evidence) and which you question (REMOVE). Automate the first kind only once you trust it. Spot-check the rest.

Where to keep the three prompts and the playbook

You now have four artefacts that change at different speeds: three stable prompts and one playbook that changes constantly. Treat them separately.

  1. Save the generator, reflector and curator prompts in your PromptPal library, as a collection named for the task so they stay together.

  2. Keep the playbook as its own prompt, so each curator run produces a new version you can compare against the last one.

  3. When the agent's behaviour shifts after an update, diff the versions and roll back the entry that caused it. That's what prompt version control is for.

  4. If the agent runs in n8n, LangChain, CrewAI or your own code, fetch the current playbook at runtime rather than pasting it into the workflow.

Step 4 is the one people skip, and it's the one that makes the loop real. A playbook pasted into a workflow node is frozen the day you paste it.

When this isn't worth it

Skip it if the task runs a handful of times a month. You'll learn more from editing the prompt yourself after each run.

Skip it if you have no outcome signal. Reflection without evidence produces confident-sounding nonsense.

Skip it for one-off creative work where there's no right answer to learn from. And if your context is already too long, adding entries will make things worse before it makes them better. Prune first, using the MERGE and REMOVE operations above.

The approach pays off for agents that repeat a task many times with checkable results: support, coding, extraction, triage, research briefs.

Next step

If your agents run outside the chat window, set up your playbook and prompts so they're delivered at runtime. See how to deliver governed prompts and context to AI agents over MCP and through n8n, LangChain and CrewAI.

Tags:context engineeringai agentsprompt engineeringagentic workflowsprompt versioning

Read this article as Markdown

Stay Updated

Get the latest blog posts and AI prompt engineering tips delivered to your inbox.

No spam, unsubscribe at any time. We respect your privacy.

On this page

  1. What it means, in plain terms
  2. The idea behind the paper
  3. A playbook that works as a data structure
  4. Prompt 1: the generator
  5. Prompt 2: the reflector
  6. Prompt 3: the curator
  7. Examples beyond support tickets
  8. Keep a human in the loop at first
  9. Where to keep the three prompts and the playbook
  10. When this isn't worth it
  11. Next step

Turn ideas into prompts that work

Describe what you need and PromptPal writes a reusable prompt in your style for ChatGPT, Claude and Gemini.

Try PromptPal free

Related Posts

Continue reading

General · November 21, 2026

Codex System Prompt: What It Is and How to Customize It

The Codex system prompt is built in, but you control the instructions layered on top. Here is where each one goes, with copy-ready AGENTS.md and task prompts.

General · November 21, 2026

Claude Code Prompt Library: 5 Prompts to Save and Reuse

Build a Claude Code prompt library you actually reuse: five copy-ready prompts for planning, bug fixes, refactors and reviews, plus how to store and version them.

General · November 21, 2026

Prompt Engineering Job: What It Is and How to Get One

What a prompt engineering job involves day to day, which skills get you hired, and how to build a portfolio of tested, versioned prompts that proves you can do it.

Ready to get started?

Join thousands of developers and teams using PromptPal to build better AI prompts.

Start for freeContact Sales

Footer

Get better at AI, one email a week

One great prompt, one quick tip, and what’s new in ChatGPT, Claude and Midjourney. Five minutes, every Thursday.

No spam. Unsubscribe in one click.

PromptPalPromptPal

Great prompts for any AI, in seconds. Free to start, no account needed.

Create a prompt
Browser extensionConnect to Claude, ChatGPT, Cursor
Featured on SaaSearch

Product

  • Prompt builder
  • Browser extensionNew
  • Connect to your AI
  • Pricing

Prompt generators

  • ChatGPT
  • Claude
  • Gemini
  • Midjourney
  • Perplexity
  • See all

Use cases

  • Students
  • Writers
  • Solo builders
  • Everyday users
  • Developers
  • AI teams

Resources

  • Guides
  • Blog
  • Prompt Store
  • Docs
  • Compare
  • Help center

Company

  • About
  • Contact
  • Enterprise
  • Press

© 2026 Securestack Technologies Inc.

PrivacyTermsRefund policyChangelog

PromptPal