Curiosity
Circular agent-loop diagram with five nodes and iteration counter in Curiosity style.

The agent loop

An agent isn't magic — it's an LLM in a loop with access to tools.


User turn
  → LLM picks next step (tool call or final answer)
  → Tool router validates + calls endpoint
  → Tool returns JSON result
  → LLM receives result
  → (repeat until final answer or iteration cap)
  → Final answer sent to user

Cap iterations at 8. Uncapped agents can loop indefinitely on ambiguous tasks.


A worked example — support assistant answering "Why does my MBA-2024 battery drain overnight?":

  1. LLM calls SearchTickets("battery drain MBA-2024", productSku: "MBA-2024", limit: 5)
  2. Tool returns 5 tickets; LLM identifies 2 as relevant
  3. LLM calls GetNeighbours(uid: "ticket-42", edge: "Resolution", limit: 1)
  4. Tool returns: "firmware update v3.2 fixes overnight drain"
  5. LLM composes answer with citations [1] [2]
  6. Total: 3 model calls, 2 tool calls, ~2 seconds

Keep the tool catalog small. Overlapping tools cause unreliable selection. Aim for fewer than 10 tools per chat surface, each with a distinct, non-overlapping purpose.

LLM agents