Free live cohort on Google Meet — register your interest →

Session 5

Tool Use & Single-Agent Loops

The Question You'll Be Asked

"Explain how tool use works in LLMs and describe the agent loop."

The moment you move from "I've used ChatGPT" to "I build AI systems," this is the question that draws the line. Deliver it in 60–90 seconds without reciting.

5 Beats Interviewers Listen For

Miss one and they probe.

  1. Who executes — the LLM requests, your code runs it, never the reverse
  2. The loop cycle — observe → reason → act (tool call) → execute → inject result → observe again
  3. What makes a good tool definition — name, description (the field that matters most), typed schema
  4. Failure modes + one fix each — infinite loop, hallucinated tool call, tool output poisoning
  5. When NOT to loop — a single prompt with sufficient context beats a loop every time

The Model Answer

"Tool use is the mechanism where an LLM produces a structured call — a tool name and arguments — and the host application decides whether to execute it. The model never runs code directly. An agent loop wraps this in a cycle: observe the context, reason, emit a tool call, inject the result, and reason again, until a stop condition — usually the model returning plain text instead of a tool call. A good tool definition needs three things: a precise name, a description that tells the model when to use it — not just what it does — and a typed parameter schema. The main failure modes are infinite loops from missing stop conditions, hallucinated tool names, and tool output poisoning when untrusted content is injected directly into context. The key judgment call: if a single prompt with the right context can answer the question, don't build a loop — loops add latency, cost, and failure surfaces."

Say This, Not That

Say

  • "The model requests, my code executes"
  • "The description is the most important field"
  • "Validate the tool name against an allowlist"
  • "Loops add latency — use one only when needed"

Avoid

  • "The LLM calls the function" (it never does — it only requests)
  • "Just give it lots of tools and let it figure it out"
  • Skipping tool output poisoning — the most probed security follow-up
  • Claiming an agent loop is always better than a single prompt

Want the project that goes with this?

All 12 sessions are free to read, right now, no account needed — you just finished session 5. What the email list adds is the build: one real, deployable AI project every fortnight, with what to build, how to build it, and why it matters for the role you're aiming at. Reply to any of them and a person answers.

No spam. Unsubscribe anytime. Replies go to a real person.