Module 2 · Tools, Knowledge, Memory & Research Design · scripted

Self-Dialogue: Tools Made of Prompts

25 minoutcomes: tool-design

What is a tool made of?

We've been designing the outside of tools — names, descriptions, parameters. Now open one up. Every tool so far had the same thing inside: code. The agent's conversation with the computer reached classical computation — arithmetic, files, queries, messages.

But we learned early on that prompting changed what counts as computation. An LLM can compute things no classical program could: draft a marketing plan. Judge a summary. Read a receipt. Reason about a mess of evidence. So a tool's implementation now has a choice of substrate:

The two substrates

codedeterministic computation arithmetic · files · queries · exact rules
a promptcomputational thought extract · judge · draft · summarize · see

A tool made of a prompt works exactly like any other tool from the outside: the agent calls extract_receipt(image), and behind the tool, the system sends a prompt to an LLM — a fresh, self-contained exchange — and returns its answer as the tool result. I call this self-dialogue: the system talking to itself. One precision matters: it is not the agent's own conversation talking — it is the system spawning a disposable, separate conversation on the agent's behalf. It runs, answers, and vanishes.

The same language laws, in the new substrate

Everything we know about designing the action language transfers unchanged — including the specific-to-generic axis:

Two substrates, one design space

CODE substratePROMPT substrate
specificget_customer(id) extract_receipt(image)
(nouns)refund_order(id) classify_ticket(text) draft_reply(points, tone)
genericrun_sql(statement) summarize(text, focus)
(verbs)
universalexecute_code(script) send_prompt(messages)
(one word)

send_prompt is the execute_code of the prompt substrate: a universal word. The coverage law applies verbatim — if the judgments your agent will need are unenumerable, you need the universal word; if you can name them, nouns like extract_receipt are cheaper, safer, and easier to audit. What the language can't say, the agent can't think.

Why not just do it in the loop?

The agent's own conversation runs on an LLM — couldn't it read the receipts itself? It could. Watch what that costs. The task: forty expense receipts to reconcile.

Two ways to read forty receipts

IN THE LOOPAS A PROMPT TOOL
Forty images enter theextract_receipt(image) runs forty
loop's conversation.separate, disposable exchanges.
The recurrence bills themEach image is paid ONCE, inside
again on EVERY laterits own call — the loop's
iteration: step 6 re-readsconversation receives only forty
all forty receipts tostructured rows.
approve one taxi ride.Loop iterations stay small; the
The wall fills; thetrajectory stays on the actual
trajectory drifts throughtask: reconciliation.
noise.
Example 1 · The receipt tool at work
user

Reconcile my Molde trip expenses against the department rules. Tools: extract_receipt(image), check_rule(expense), report(text).

assistant
⟨tool_use⟩
extract_receipt(image = "receipt_012.jpg")
user
⟨tool_result⟩
{ vendor: "Hotel Alexandra", date: "2026-08-24", amount: 1890,
  currency: "NOK", category: "lodging" }
assistant
⟨tool_use⟩
check_rule(expense = "lodging 1890 NOK")
user
⟨tool_result⟩
Within limit (max 2000 NOK/night).
NoteBehind that first tool call, a whole multimodal prompt ran: an LLM looked at the image and produced structured fields. The heavy work — and the image itself — lived and died inside the call. Only five clean fields came home to the loop.

The principle deserves its own line, because it is the first context-isolation mechanism in the course:

The firebreak principle

A prompt tool is a firebreak for context.
The scratch work stays inside; only the answer comes back.

The human version: you're in a meeting and need to work something out. You don't reason aloud into the minutes — you step out, use scratch paper, and come back with the answer. The loop's conversation is the meeting minutes. Self-dialogue is the scratch paper.

Minutes and scratch paper
  • What, exactly, is in the loop's conversation after Example 1's first call? What is not in it?
  • What would iteration 12 of the naive version be paying for?
  • What's the scratch-paper work in your own research workflow — the thing you'd never write into the minutes?

The agent becomes the prompt engineer

Now the universal word — and a twist. Give the agent send_prompt and it can compose sub-prompts itself. Watch what it writes:

Example 2 · The agent casts its own shadows
user

Something went wrong with last night's data sync. Here's the 3,000- line log as a file. What happened? Tools: read_file(path), send_prompt(instructions, content).

assistant
⟨tool_use⟩
read_file(path = "sync-log.txt")
user
⟨tool_result⟩
[3,000 lines]
assistant
⟨tool_use⟩
send_prompt(
  instructions = "You are reading a data-sync log. Report ONLY:
                  (1) the first ERROR line and its timestamp,
                  (2) the last successful sync step before it,
                  (3) any retry attempts after it. Ignore routine
                  INFO lines entirely. Three bullet points, verbatim
                  quotes.",
  content = "[the 3,000-line log]"
)
user
⟨tool_result⟩
• First ERROR 02:14:31 — "connection reset by peer (db-replica-2)"
• Last success 02:14:29 — "batch 88/120 committed"
• Retries: 3 attempts 02:14–02:20, all failed with same error
assistant

The sync failed at batch 88 when db-replica-2 reset the connection at 02:14; three retries hit the same error, so the replica — not the data — is the likely culprit. Recommend checking replica health before rerunning.

NoteRead the sub-prompt the agent wrote: a stated role, an exact output format, explicit instructions about what to ignore. That is prompt engineering — done by the agent. Everything we've learned about casting shadows now applies to what agents write for other LLMs: the agent has become the fire.

The ladder

Step back and see where this sits. There is now an axis running through every word in the agent's language — how much mind is inside it?

The ladder

1. Code tool       no mind inside.
                   A calculator answers.

2. Prompt tool     one thought inside.
                   A fresh, disposable exchange: no tools, no loop.
                   It runs, answers, and vanishes.   ← this lesson

3. ?               a whole conversation inside —
                   with its own role, tools, and loop.
                   (Later. You already know its name.)

Rung 2 dramatically expands what an agent's tools can do — every judgment, extraction, and drafting task becomes a callable word — while keeping the loop's conversation clean. Rung 3 is one short step up.

Your turn

Take the agent you've been designing and find its heaviest operation — the one that would dump the most context into the loop. Redesign it as a prompt tool: write the tool's name and parameters, then write the actual sub-prompt inside it. Decide precisely: what stays inside the call, and what five lines come back?