[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4
SEQ. 5

Inner Monologue & Scratchpads

🔄 The Agentic Control Loop9 min70 BASE XP

Giving Agents a Private Thinking Space

Humans don't jump straight to answers — we mutter to ourselves, scribble notes, and reason through problems. The Inner Monologue pattern gives agents the same capability.

How It Works

Instead of the agent directly outputting actions, you create a structured format where the agent must write out its reasoning before deciding what to do:

## Agent Scratchpad

**Current Goal:** Find the user's order status
**What I Know:**
- User provided order ID: #12345
- I have access to the orders_db tool
**What I Need To Do:**
- Query the database for order #12345
- Check if the order has shipped
**My Confidence:** 9/10 — this is straightforward
**Decision:** Call orders_db.get_status("12345")

Why This Works

BenefitMechanismImpact
Reduced ErrorsChain-of-thought forces logical reasoning30-50% fewer tool call errors
Better DebuggingYou can read the agent's reasoningFind failures in minutes, not hours
Self-MonitoringConfidence scores trigger escalationAgent knows when to ask for help
AuditabilityFull reasoning trail is loggedCompliance and post-mortem analysis

Implementation Patterns

Pattern 1: Structured XML Scratchpad

System Prompt:
"Before every action, write your reasoning inside
<scratchpad> tags. Include:
1. Current sub-goal
2. Information gathered so far
3. Next planned action and why
4. Confidence level (1-10)
</scratchpad>
Then emit your action."

Pattern 2: Extended Thinking (Claude)

Claude's native Extended Thinking feature automates this pattern. By enabling thinking: {type: "enabled", budget_tokens: 4000}, Claude shows its reasoning in a dedicated thinking block before the final response — no custom prompting needed.

Pattern 3: Separate Reasoning Model

Use a smaller, cheap model (like Haiku) as the "inner monologue" step, then pass its analysis to the main model for the final decision. This separates reasoning cost from action cost.

🎯 Pro Tip: Always log the scratchpad/thinking output alongside tool calls. When an agent fails, the scratchpad is the first place to look — it shows you why it made the wrong decision, not just what it did wrong.

Scratchpad vs Extended Thinking

FeatureCustom ScratchpadExtended Thinking
SetupRequires prompt engineeringOne parameter toggle
VisibilityVisible in output (can be parsed)Separate thinking block (may not be cacheable)
ControlFull control over formatModel decides depth
CostCounts as output tokensSeparate thinking token budget
SYNAPSE VERIFICATION
QUERY 1 // 2
What is the primary benefit of the Inner Monologue pattern?
It makes the agent faster
It forces the agent to reason step-by-step before acting, reducing errors by 30-50%
It reduces API costs
It eliminates the need for tools
Watch: 139x Rust Speedup
Inner Monologue & Scratchpads | The Agentic Control Loop — AI Agents Academy