Module 3 · Agent Tools, Knowledge, Memory & Research Design · scripted
Self-Dialogue: Tools Made of Prompts
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
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
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
You have the following tools available for use:
- extract_receipt( image )
- check_rule( expense )
- report( text )
Task: Reconcile my Molde trip expenses against the department rules.
⟨tool_use⟩
extract_receipt(image = "receipt_012.jpg")⟨tool_result⟩
{ vendor: "Hotel Alexandra", date: "2026-08-24", amount: 1890,
currency: "NOK", category: "lodging" }⟨tool_use⟩
check_rule(expense = "lodging 1890 NOK")⟨tool_result⟩
Within limit (max 2000 NOK/night).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.
- 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:
You have the following tools available for use:
- read_file( path )
- send_prompt( instructions, content )
Task: Something went wrong with last night's data sync. Here's the 3,000-line log as a file. What happened?
⟨tool_use⟩
read_file(path = "sync-log.txt")⟨tool_result⟩
[3,000 lines]⟨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]"
)⟨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 errorThe 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.
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.
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?