# Agentic AI

> Turn your model into an agent. Every punctuation token becomes a tool call, a real text message to a real person, and generation picks up again once the reply is back.

Turn your <GlossaryTerm id="language-model">language model</GlossaryTerm> into
an <GlossaryTerm id="agent">agent</GlossaryTerm>. Nothing about the model
changes: you add a rule for when to pause, what to ask, and how to carry on once
the answer comes back.

![](../../assets/images/hero-tool-use.avif)

## You will need

- any model you can generate from: a
  [pre-trained booklet](https://www.llmsunplugged.org/modules/pretrained-generation/) works best, but a
  [grid](https://www.llmsunplugged.org/modules/training/) or a [cutouts spread](https://www.llmsunplugged.org/modules/generation/) is fine
- dice, pen and paper as per [Generation](https://www.llmsunplugged.org/modules/generation/)
- at least one phone per group, and three friends or group chats who'll reply
  within a few minutes

## Your goal

Generate a passage in which every sentence ends with a tool call: the model
writes until it lands on punctuation, you text a friend for what comes next, and
the reply goes into the text. Stretch goal: design a tool of your own (see the
variation below) and bolt it on the same way.

## Key idea

In practice, calling a language model an "agent" comes down
to <GlossaryTerm id="tool-use">tool use</GlossaryTerm>: the model produces
something that the system around it treats as a request, generation pauses, the
request goes out to a tool, and the result is written back into the text before
generation continues. The loop is _generate → call tool → splice in the result →
keep generating_. Here the tool is a text message to a friend.

## The recipe

1. **Generate** from your model as usual, rolling for each next <GlossaryTerm id="token">token</GlossaryTerm>.
2. When you land on a **punctuation token** (`.`, `,`, `!`, `?`), pause. That's
   a tool call.
3. Text **What comes next? "[the sentence so far]…"** (everything since the last
   full stop) to three friends or group chats.
4. **Write down** the whole of the first reply, then the punctuation token you
   rolled.
5. **Continue** generating from that punctuation token.

Replies take time. If none has arrived by the time you hit the next punctuation
token, leave a gap and back-fill it when one does.

## Worked example

Your text so far is "the cat sat", and the next roll gives you `.`. Pause:
that's a tool call.

Text `What comes next? "the cat sat..."` to three friends. The first reply back
is "down by the river".

Write `down by the river`, then the `.` you rolled anyway, and carry on
generating from `.`:

> _the cat sat down by the river. …_

The punctuation is the trigger, the question plus the sentence so far is the
tool's input, and the reply is the tool's result. The reply's words probably
aren't in your model's <GlossaryTerm id="vocabulary">vocabulary</GlossaryTerm>, which is why you resume from the punctuation
you rolled: the model can always continue from `.`, even when it has no row for `river`.

## Instructor notes

### Running it

- brief the room on the recipe before anyone rolls, and walk the worked example
  slowly; steps 2 and 4 are where groups go wrong (forgetting to write the
  punctuation back in after the reply)
- ten minutes is plenty; keep groups moving and circulate
- groups without a willing friend can text a group chat, a colleague across the
  room, or use one of the tools from the variation below

### Variation: trigger-word cutouts

For the cutouts flavour, and for groups who want to _design_ tools as well as
call one, add explicit trigger tokens to the model instead of using punctuation.
Each tool has a trigger word, a capability and a return format:

| Trigger word | Tool                    | Capability                        | Returns                      |
| ------------ | ----------------------- | --------------------------------- | ---------------------------- |
| `ACTION`     | a chosen person         | perform a small physical action   | a word for what they did     |
| `GOOGLE`     | someone with a phone    | search the web for a continuation | one word from the top result |
| `FRIEND`     | everyone texts a friend | ask them what comes next          | first reply wins             |

Add the trigger cutouts to the spread where they fit contextually (`GOOGLE`
after `a` or `the`, `ACTION` after `we` or `I`), each closing with a `.` on the
same cutout so the chain resumes cleanly after the tool returns. The CLI does
this for you:
`llms_unplugged cutouts -i data/<text>.txt -n 2 --tool ACTION --tool GOOGLE`
seeds each trigger at the corpus's most common contexts and prints it
black-on-gold so it can't be mistaken for a corpus word.

Other tools to try, on the same pattern: `LOOK` (an object in the room returns a
word for what it is), `NAME` (the room points at someone), `TIME` (a clock),
`ASK` (a designated expert returns a short phrase). In each case something
outside the model returns some text, and a closing token brings you back.

### Discussion questions

- what did the tool calls add that the bare model couldn't? Did the friends'
  words fit the text, or derail it?
- how does the model "know" to call a tool? (it doesn't; it just landed on the
  trigger)
- who was running the loop? (you were: you decided when to pause, who to ask,
  and what to splice back in. Take that away and the agent acts on its own)
- what would you be comfortable letting an agent do without asking you first?
  Where's the line, and why: reversibility, who gets blamed, whether you'd
  notice a mistake?
- could a tool's reply change what the model generates next? (here, no; see
  below)

### Connection to current LLMs

Calling a model an "agent" comes down to tool use in a loop. As Simon Willison
[puts it](https://simonwillison.net/2025/Sep/30/designing-agentic-loops/),
an <GlossaryTerm id="llm">LLM</GlossaryTerm> agent is something that "runs tools in
a loop to achieve a goal", which is what your model just did.

<GlossaryTerm id="tool-use">Tool use</GlossaryTerm> (also called "function
calling") is how modern <GlossaryTerm id="chatbot">AI assistants</GlossaryTerm>
act in the world:

- **the agentic loop**: generate → detect a tool call → execute the tool → feed
  the result back → continue generating, just like your punctuation-and-text
  cycle
- **the harness**: the software around the model that pauses it, makes the call,
  and splices the result back in. In the room, that was you
- **structured calls**: real models emit a JSON-formatted tool call (function
  name, arguments), while your model triggers on a full stop; the loop around
  them is the same
- **examples**: web search, code execution, database queries, sending an email,
  booking a flight, moving money
- **chaining**: real agents make many tool calls in sequence, planning and
  adjusting as results come in

A real model reads the tool's result and conditions on it, whereas your bigram
carries on from the punctuation as if the reply never happened, because one word
of <GlossaryTerm id="context-window">context</GlossaryTerm> can't hold it.
Everything the friend contributed is in the transcript, while the model's next
choice depends only on the full stop. The
[In-context Learning](https://www.llmsunplugged.org/modules/in-context-learning/) module is where the text
you've already written starts to feed back in.

Source: <https://www.llmsunplugged.org/modules/agentic-ai/>\
Licence: [CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/)\
Cite as: Swift, B. (2026). _LLMs Unplugged: Understand how AI language models work by building one yourself._ https://doi.org/10.5281/zenodo.17403824
