Skip to content
Episode 112 · "Find and book me…"

LLM vs AI agent vs agentic system

Tuesday, 10:00: a guest types "find and book me a quiet hotel in Lisbon next weekend under €200". The concierge describes "Casa Silêncio, €165 a night", a hotel that isn't on StayHub, and can't book anything.

People use these three words as if they meant the same thing. They don't, and picking the wrong one can be very expensive.

30 min intermediateLLM vs agent vs agentic systemThe agent loopWorkflow vs agent (when not to use an agent)Human confirmationTool callingLLM calls are stateless
  1. Problem

    A guest types: “Find and book me a quiet hotel in Lisbon for next weekend under 200 EUR.”

  2. Why the simple system fails

    A single LLM call can only write text. It can't search live availability, can't book, and will happily invent a hotel that sounds right.

  3. Engineering concept

    Put the model in a loop with tools, memory and a goal: observe → think → act, until done. Wrap risky actions in human approval.

  4. Technology

    Agent runtime, tool calling, state store, orchestration, approval steps.

  5. Trade-offs

    Each step adds cost, latency and a chance to go wrong. Use the least autonomy that solves the problem.

01

The problem

2 min
Tuesday, 10:00. The grounded concierge has been live for a month.
  1. A guest · StayHub customer
    Find and book me a quiet hotel in Lisbon next weekend, under €200 a night.
  2. Maya · Product manager
    It replied "Casa Silêncio in Alfama, €165". Not on StayHub. And it can't book. 18% of conversations ask it to do something.
  3. You · Engineer at StayHub
    Better retrieval over hotel descriptions?
  4. Lina · Senior engineer, your mentor
    Guess first. Then we'll see what's missing.
02

The big idea

4 min
From answering to acting
The big idea

Each level of autonomy adds cost, latency and ways to fail: use the least autonomy that solves the problem.

"Find and book" needs an agent: the path depends on what search returns. But "change my booking to Saturday" always takes the same steps, and 70% of action requests look like that.

03

How it works

5 min

It starts with : the model asks our code to run a named function with arguments (like search_hotels); our code decides whether to run it and returns the result. From there, four levels:

Four levels of autonomy
  1. 1
    LLM call

    Text in, text out, one step. "What time is breakfast?" with grounded facts: ≈ €0.026, ~2 s.

  2. 2
    Workflow

    A workflow () is a fixed path decided by our code: find booking → quote change → confirm → apply. The model fills in steps. ≈ €0.03, ~3 s.

  3. 3
    Agent

    An is an LLM in a loop with a goal, tools and state, choosing the next step from what it observes: search, no luck, try nearby neighbourhoods. About 6 calls: ≈ €0.12, ~14 s.

  4. 4
    Agentic system

    An agentic system () is several agents and tools, orchestrated, with people approving the risky steps.

  5. 5
    The loop is our code

    The model proposes; the runtime decides what runs. Step budget, permissions and confirmation live in code, never only in the prompt.

04

Watch a decision being made

4 min
Worked example

Lina designs the first booking agent

Handle ≈3,200 "find and book" requests a day without inventing hotels, booking anything unapproved, or running forever.

  1. 1Route before you loop

    "A small classifier: questions to grounded answers, changes and cancellations to workflows, only open-ended find-and-book to the agent."

    Why: The agent is the most expensive, least predictable option; it should only see requests that need it.

  2. 2Give it narrow tools

    "search_hotels, get_availability, get_quote are read-only. create_booking(quote_id) is the only side effect."

    Why: Results come from live systems, so no Casa Silêncio. Booking from a quote id means it can't invent a price either.

  3. 3Run the loop in our code, gate the side effect

    "Up to 10 steps. When it asks for create_booking, pause and show the guest the exact hotel, dates and total. Only a tap runs it."

    ts
    for (let step = 0; step < 10; step++) {
      const r = await llm.call({ tools: TOOLS, messages: state.messages });
      if (r.type === "final_answer") return r.text;
      if (r.toolCall.name === "create_booking") return askGuestToConfirm(r.toolCall);
      state.messages.push(await runTool(r.toolCall, ctx));
    }
    return handOffToHuman(state);

    Why: A loop we control can be budgeted, logged and stopped; the one money-spending step gets explicit approval.

  4. 4Plan the way out

    "After 10 steps with no result, hand over to a human agent with the trace."

    Why: Agents sometimes fail. A clean escalation turns a failure into a slower success.

The whole thing in one line: Autonomy only where the path is unknown, narrow tools backed by live systems, and code (not the prompt) holding the budget and the gate on money.
05

In real life

3 min
From "suggests" to "does it for you"

Devin (Cognition): an autonomous agent

  • Presented in 2024 as an AI software engineer that plans and carries out whole tasks
  • Uses an editor, terminal and browser in a long loop
  • Powerful on open-ended work, harder to predict

Fits open-ended tasks a person reviews before they matter.

GitHub Copilot: suggest, the developer accepts

  • Suggests code as you type; nothing changes until accepted
  • Fast, cheap, predictable
  • The person controls every change

Fits frequent small steps a person approves.

06

What goes wrong

3 min
Using an agent where a workflow fits

Known paths become slower, costlier, less predictable.

Instead

Workflows for fixed paths; agents only where the next step depends on results.

Side effects without a gate or idempotency key

One wrong step or blind retry books or charges twice.

Instead

Confirmation bound to the exact action, an per booking, a status check before retrying.

No step budget

A confused agent loops and never answers.

Instead

A hard step and cost budget in code, then escalation to a person.

07

Trade-offs

3 min
DesignChoose whenCost / waitMain risk
Single LLM callQuestions answerable from provided facts€0.026, ~2 sCan't act
WorkflowKnown paths: change, cancel, invoice€0.03, ~3 sRigid when reality differs
AgentThe next step depends on results€0.12, ~14 sWanders; needs budgets and gates
Thursday, 11:00. Planning the actions rollout.
  1. Maya · Product manager
    One agent for everything: questions, changes, cancellations, bookings. One system.
  2. Karim · CTO
    Changes and cancellations are 70% of actions, always the same steps. As agent runs: €0.12 and 14 s instead of €0.03 and 3 s.
  3. Maya · Product manager
    Two systems means two things to build and test.
08

Your job as tech lead

4 min

Claude Code can write the code for this. You still own the decisions, and you have to know what good looks like to accept or reject its work.

Decisions you own
  • Which requests get which design: a grounded answer, a workflow for change or cancel, or an agent only for open-ended "find and book".
  • Which tools have side effects (create_booking spends money) and need the guest's confirmation, enforced in code.
  • The limits on every agent run (steps, time, cost) and an idempotency key per confirmed booking.
Tell Claude Code
Concierge action requests: 70% are changes or cancellations. Build those as a fixed workflow (extract booking ref with structured output, validate in code, call the booking API). Only open-ended "find and book" goes to an agent with `search_hotels`, `get_availability`, `get_quote`, `create_booking`. In the runtime, not the prompt: `create_booking` runs only after the guest confirms hotel, dates and total, with an idempotency key; cap runs at 10 steps and €0.30. Plan first, then report cost, latency and success per path on 50 recorded conversations.
Check before you accept
  • Change and cancel requests take the workflow; only open-ended ones reach the agent.
  • The confirmation is a check in runtime code that blocks create_booking, not a sentence in the prompt.
  • A simulated timeout and retry on create_booking gives exactly one booking and one charge.
Red flags
  • Every request routed through the agent "for flexibility".
  • "Always ask before booking" in the system prompt as the only safeguard.
  • An agent loop with no step, time or cost limit.
09

Check yourself

2 min
Q1/3Decision
StayHub processes 2M payment-receipt emails/month: extract amount and booking id, then update the booking. A teammate proposes an autonomous agent with tools. Best response?
How confident are you?

Next episode: a guest wants a quiet hotel in Lisbon under €150. Twenty minutes and 41 tool calls later, the agent is comparing hotels in Porto.

Finished?

Mark it complete to update your skill map.

Go deeper (optional)You don't need this to understand the lesson. Open it when a project needs the details: Technical deep dive, Interactive simulation, Visual diagram, Analogy, Why it matters, Check your understanding, Practice ladder, Explain it yourself.
10

Technical deep dive

The loop is our code
LLM callWorkflowAgentAgentic system
Who decides the next step?Nobody: one stepOur codeThe model, each iterationModels + orchestrator + people
Can act?NoYes, via fixed tool callsYes, chooses toolsYes, many tools and agents
Model calls1Fixed, smallVariable (3 to 50+)Many
StayHub cost / wait€0.026, ~2 s€0.03, ~3 s€0.12, ~14 sHigher
Autonomy increases left to right, and so do cost, latency and ways to fail.
Worked example

Lina designs the first booking agent

Let the concierge handle "find and book" requests (≈3,200 a day) without inventing hotels, without booking anything the guest didn't approve, and without running forever.

  1. 1Route before you loop

    A small classifier sends questions to grounded answers, changes and cancellations to workflows, and only open-ended find-and-book requests to the agent.

    Why: The agent is the most expensive and least predictable option; it should only see requests that need it.

  2. 2Give it narrow tools

    search_hotels(city, dates, max_price, tags), get_availability(hotel_id, dates), get_quote(...) are read-only. create_booking(quote_id) is the only side effect.

    ts
    const TOOLS = [
      { name: "search_hotels", readOnly: true,  schema: SearchArgs },
      { name: "get_availability", readOnly: true, schema: AvailArgs },
      { name: "get_quote", readOnly: true,  schema: QuoteArgs },
      { name: "create_booking", readOnly: false, schema: { quote_id: "string" } },
    ];

    Why: Results come from our live systems, so it can't invent Casa Silêncio. Booking from a quote id means it can't invent a price either.

  3. 3Run the loop in our code

    Up to 10 steps. Each step: call the model with goal, tools and state; run the requested read-only tool; save state.

    Why: A loop we control can be budgeted, logged and stopped. A loop inside a prompt can't.

  4. 4Gate the side effect

    When the model asks for create_booking, pause and show the guest: "Hotel Alfama 12, 14–16 Nov, €178/night, total €356. Book?" Only a tap runs it.

    Why: The one irreversible, money-spending step gets a person's explicit approval, bound to that exact quote.

  5. 5Plan the way out

    If 10 steps pass without a result, hand over to a human agent with the trace, instead of a vague "sorry".

    Why: Agents fail sometimes. A clean escalation turns a failure into a slower success.

The whole thing in one line: Lina routed only open-ended requests to an agent, gave it narrow tools backed by live systems, ran the loop in code with a step budget, gated the single booking step behind the guest's confirmation, and planned an escalation path.
11

Interactive simulation

12

Visual diagram

Click a component

“Find and book a hotel for me”: an agent in a loop, with a human approval gate before the side effect.

13

Analogy

  • Planning a tripA travel expert you phone onceAI systemsAn LLM
  • Planning a tripA booking form with a fixed checklistAI systemsA workflow
  • Planning a tripA personal assistant with a laptopAI systemsAn agent
  • Planning a tripA whole travel agency with a supervisorAI systemsAn agentic system
  • Planning a tripClient signs before anything is chargedAI systemsHuman approval for risky actions

Where the analogy breaks: a human assistant knows when they're out of their depth. An agent will happily keep looping, so you must set limits on steps, spending and actions.

14

Why it matters

"Let's add an agent" is one of the most expensive sentences in AI engineering, when it's the wrong tool.

An agent that loops 12 times makes 12 or more model calls, each resending a growing history. That's slower and pricier.

Errors also stack up. If each step works 95% of the time, a 10-step chain succeeds only about 60% of the time. More freedom means more ways to go wrong.

So the real question isn't "agent or not?". It's "which actions may the system take without asking a person?"

Workflow vs agent

Workflow

  • Path fixed by your code
  • Predictable cost and speed
  • Easy to test

Default for known tasks.

Agent

  • Picks its own steps
  • Handles surprises
  • More calls, more risk

For open-ended goals.

15

Check your understanding

Q1/3Scenario
Match each hotel feature to the simplest architecture that fits:
Translate a review from Dutch to English
Cancel a booking from an email: extract id → cancel API → reply
“Find me somewhere quiet in Lisbon, flexible dates”, then book
Plan a group trip: flights, hotels, budget approval by a manager
How confident are you?
16

Practice ladder

Step 1 · Trace

Trace an agent run

Scenario Warm-up

The agent's goal: "Quiet hotel in Lisbon, 14–16 Nov, under €200/night, then book it." Its trace so far:

  1. search_hotels(city: "Lisbon", dates: 14–16 Nov, max_price: 200, tags: ["quiet"]) → 0 results
  2. Model: "No results with the quiet tag. I'll search without it and check reviews."
  3. search_hotels(city: "Lisbon", dates: 14–16 Nov, max_price: 200) → 7 hotels
  4. get_availability(hotel_id: "alfama-12", dates: 14–16 Nov) → 2 rooms
  5. get_quote(hotel_id: "alfama-12", room: "double", dates: 14–16 Nov) → quote Q-88213, €178/night

Trace what should happen next, step by step, and say where the runtime (not the model) is in charge.

Step 2 · Complete

Add the missing guards

Code Practice

This agent loop is missing three guards. Add them: a step budget, a gate on side effects, and an escalation when the budget runs out.

async function runAgent(goal: string, ctx: Ctx) {
  const state = await loadState(ctx.taskId, goal);
  while (true) {                                    // (1) ???
    const r = await llm.call({ tools: TOOLS, messages: state.messages });
    if (r.type === "final_answer") return r.text;
    const call = r.toolCall;
    // (2) ???
    state.messages.push(await runTool(call, ctx));
    await state.save();
  }
  // (3) ???
}
Step 3 · Solve

Route five requests

Design Practice

Decide for each request whether it should be handled by a single grounded LLM call, a workflow, or the agent, and say why in one line.

  1. "What time is breakfast at Hotel Ribeira?"
  2. "Please cancel booking LIS-2280."
  3. "Somewhere by the sea in Portugal for a long weekend in May, two kids, under €250, near a beach we can walk to."
  4. "Can I add an extra bed to my booking POR-3315?"
  5. "Send me my invoice for last month's stay."
Step 4 · Decide

Should the agent cancel without asking?

Decision Stretch

Maya: "Guests hate the extra tap. When someone clearly says 'cancel booking LIS-2280', let the cancellation workflow run without the confirmation step."

Facts: cancellations are about 4,000 a day. About 1 in 300 cancellation requests in the logs refers to the wrong booking (guests with two bookings, typos). Some cancellations lose a non-refundable payment. A cancelled room is often resold within hours.

Write a short decision: "We chose X over Y because…, accepting the risk of…".

17

Explain it yourself

A product manager asks: “Should our hotel booking feature be an agent?” Explain the difference between an LLM, an agent and an agentic system, and how you'd decide.

0 words