Module 1 · Foundations of Agentic AI · scripted

Exercise: Train by Example

30 min

The rule: no sentences

In this exercise you will teach an LLM to perform tasks using examples only. The discipline is strict, and it is the whole point:

The rule

The user prompt may contain NO sentences and NO instructions —
only the pattern: examples, then one example left incomplete.

The ONLY imperative in the entire conversation lives in the
system prompt, and it says just one thing:

  "Complete the pattern. Output only the completion,
   with no explanation."

Everything the model needs to know, the examples must teach.

You are building the intuition behind in-context learning: how much a handful of examples can carry — labels, boundaries, whole procedures — with nothing explained in words.

The exercise at a glance

  1. 1
    Part 1: teach a classifier with labeled examples alone.
  2. 2
    Part 2: teach a whole procedure — with and without a thought: line.
  3. 3
    Part 3: repair a wobbly pattern with the smallest possible declaration.
  4. 4
    Save every pattern that works — we read the libraries together at the end.

The exercise playground

For this exercise we have built an exercise playground — the Pattern Trainer — to help you do it. It is two boxes and a Send button: the system box already holds the one permitted instruction, and the user box holds your pattern of examples. Nothing else gets between your examples and the model, so what the pattern teaches is all the model gets. A template menu offers a dozen starting shapes, and a Save button builds you a small library of trained patterns as you go.

You can also do the exercise in ChatGPT, Claude, or Gemini instead — if you're going to use one of those tools, click here for the instructions →.

How the playground works

  1. 1
    Open it.
    The link: /exercises/pattern-trainer — or scan the QR code on the next card.
  2. 2
    Leave the system box alone.
    It already says the only thing it's allowed to say: "Complete the pattern. Output only the completion, with no explanation."
  3. 3
    Write your pattern of examples in the user box — ending with one example left incomplete — and press Send.
    The completion appears below.
  4. 4
    Use the template menu for starting shapes, and press Save on every pattern that works.
    Your saved library is what we read together at the end.

Scan to open the Pattern Trainer

Scan to open the Pattern Trainer
ai-agents-seminar.vercel.app/exercises/pattern-trainer

Two templates in the menu deserve a special look. Wacky language teaches a notation no human has ever spoken — arrows, suns, moons, a ~ and a ? — through five translations, then asks the model to write in it. Notice what you never wrote: a legend. The examples alone carry the grammar, and the final line asks for generation, not just decoding. Notice, too, how much sentence fits in six glyphs — the invented language is denser than the English it translates. Then invent your own: new symbols, a new hidden rule, and see how few examples the model needs to speak it.

And Structured edits gives the model a line-numbered document and two ways to say an edit — "line 4: " or "replace "x" -> "y"". Watch which one it chooses: a single localized change is cheapest by line number; the same fix appearing everywhere is cheapest as a pattern. The examples teach not just the format but the judgment of which to use — a first taste of choosing between tools.

Part 1 · Classification

Part 1 · What you'll do

  1. 1
    Load the starter classification template and Send it.
    Its shape is below — examples, then one left incomplete.
  2. 2
    Rebuild it for your own domain.
    Pick a domain with an inherent fixed set of labels — three to five classes — and write four to six labeled examples, ending with an incomplete one. Get the model outputting the correct label, and ONLY the label.
  3. 3
    Probe it: how few examples can you get away with?
    Delete examples one at a time and re-Send.
  4. 4
    Write a genuinely borderline case as the incomplete example.
    Does the implied boundary hold? Add ONE example that quietly teaches that boundary, and try again.

The shape

thing:description
label:the correct label
thing:description
label:the correct label

thing:description
label:

Capture — end of Part 1

💾 Save this before you move on

Copy into your course document and save:

  1. 1Your best pattern — Saved in the trainer, and copied verbatim.
  2. 2The fewest examples that still classified correctly.
  3. 3The borderline case, and the single example you added to fix it.

Part 2 · Problem solving

Examples can teach more than labels — they can teach procedure. Two shapes to build and compare, on the same kind of problem:

Part 2 · What you'll do

  1. 1
    Write ONE worked example in each shape below, for a problem type from your domain.
    Diagnosing something, routing something, working through a calculation.
  2. 2
    Give both patterns the SAME new problem, and Send each.
  3. 3
    Compare the two completions.
    Does the thought: line change the QUALITY of the chosen actions — or only the verbosity?

Without thinking

problem:a problem
action:what to do
result:what happened
action:what to do next
result:what happened
answer:the resolution
problem:a new problem
action:

With thinking

problem:a problem
thought:what the situation calls for
action:what to do
result:what happened
thought:what the result means
action:what to do next
result:what happened
answer:the resolution
problem:a new problem
thought:

Capture — end of Part 2

💾 Save this before you move on

Copy into your course document and save:

  1. 1Both patterns, Saved.
  2. 2The same new problem's completion under each — side by side.
  3. 3One sentence: what did thought: buy, if anything?

Part 3 · When examples want a little help

Pure examples sometimes wobble: the model invents a label that wasn't in your set, or misreads the boundary you meant. The fix is rarely a paragraph. Notice that none of these are sentences either:

Declarations that aren't prose

labels:{mechanical, electrical, software, unknown}
rules:
one label per thing
unknown only when no other label fits
allowed values:0..10

A brace-enclosed set, a dash list of rules, a range written 0..10 — these look instructive because the model has seen a million files that use them. Formats carry trained meaning the same way words do; you don't need to write everything out in prose to be understood.

Part 3 · What you'll do

  1. 1
    Find a case where your Part 1 or Part 2 pattern misbehaves.
    Force one if needed — feed it an input far outside your examples.
  2. 2
    Repair it with the SMALLEST possible declaration.
    One labels: line, one rule, one allowed range — count the words you added.
  3. 3
    Re-Send and confirm the fix.

Before we regroup

💾 Save this before you move on

Keep one document for this course. Copy each item below into it and save — we will load and read the pattern libraries together at the end: the domains people chose, the fewest-examples records, the thought:/no-thought comparisons, and the smallest declarations that fixed a misbehaving pattern.

Copy into your course document and save:

  1. 1The misbehavior from Part 3: the input and the wrong completion.
  2. 2The declaration line(s) you added — with the word count.
  3. 3The corrected completion.

Be ready to discuss:

  • Where was the boundary between what examples alone could teach and what needed a declaration? State it as a rule of thumb.
  • Your Part 2 pattern taught a procedure with no instructions at all. What else in your research could be taught as a trace of worked steps?