---
title: "Agentic Context Engineering: Prompts and Examples"
description: "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."
url: https://www.promptpal.app/blog/agentic-context-engineering-examples-prompts
author: "PromptPal Team"
published: 2026-11-19T08:20:56.677Z
updated: 2026-11-21T22:28:22.207Z
category: "General"
tags: ["context engineering", "ai agents", "prompt engineering", "agentic workflows", "prompt versioning"]
language: en
reading_time_minutes: 7
image: https://images.ctfassets.net/xzkuxcljsk12/7ufwS8nvNrt1Ig9kl4dAbj/df6eb9ba9632813952a8a1fd7a6bcfd0/blog-5__1_.png
publisher: PromptPal
---

# 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.

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](https://promptpal.app/blog/context-engineering-is-not-prompt-engineering-why-the-distinction-actually-matters) 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.

> `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.

> `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.

> `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](https://promptpal.app/blog/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](https://promptpal.app/features/collections) 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](https://promptpal.app/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](https://promptpal.app/features/agent-platforms) over MCP and through n8n, LangChain and CrewAI.

---

Originally published at https://www.promptpal.app/blog/agentic-context-engineering-examples-prompts
