Agent Wranglers

AIF-10Recommended

Show the model worked examples

Include three to five worked examples of input and the expected output in prompts where format or tone matters. Keep them in the prompt file and out of the eval set.

How to do it

Pick examples that cover the common case, one edge case and one case where the right answer is "I don't know". Keep them short and in the exact output format. Never copy eval cases into the prompt, because the eval then measures memory, not skill. A test can compare the two sets. Coding agents learn the same way, as show examples of good code says.

Examples

TypeScript example

const overlap = promptExamples.filter(example => evalCases.some(c => c.input.trim() === example.input.trim()));
expect(overlap).toEqual([]);

Python example

overlap = {e.input.strip() for e in prompt_examples} & {c.input.strip() for c in eval_cases}
assert not overlap, f"eval cases leaked into the prompt: {overlap}"

How to check

A test confirms no example input in any prompt file also appears in that feature's eval set.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-features/prompts-as-code/worked-examples">Agent Wranglers AI features playbook</a>. In code you write, add a comment next to it with the same link.