← All demos
k_ai-basics · Demo 03 · AI agents

Watch an AI agent think

Pick a tool, use it, answer

Imagine you ask a friend a question. Before answering, they stop and think: "Do I know this? Do I need my calculator? Should I look it up?" Then they do that, and then they answer.

That stop-and-think step is what makes an AI an agent. It doesn't just answer. First it decides how to answer, and it may use a tool along the way.

The agent on this page has two tools: a calculator, and a small book of 6 trivia facts. It picks a tool with a simple rule, not real thinking. So you can see every step, including the mistakes.

6 examples: which tool did it pick?

Each example shows a question, then every step the agent took.

[THINKING] deciding what to do · [TOOL CALL] the tool it picked, and what it typed in · [TOOL RESULT] what the tool gave back · [FINAL ANSWER] what you would see

  1. You ask: what is 12 times 4

    [THINKING] Checking whether this needs a tool...
    [TOOL CALL] calculator("12 * 4")
    [TOOL RESULT] 48
    [FINAL ANSWER] 12 * 4 = 48

    ✅ Right tool. It saw numbers and the word "times", so it used the calculator.

  2. You ask: what is twelve times four

    [THINKING] Checking whether this needs a tool...
    [THINKING] No tool matches — not math, not one of my trivia topics.
    [FINAL ANSWER] I can only do math (e.g. "12 * 4") or answer a handful of trivia questions. Try one of those!

    ❌ No tool. It is the same question, with the numbers written as words. The rule only spots digits like 12, so it gives up.

  3. You ask: what is the fastest land animal

    [THINKING] Checking whether this needs a tool...
    [TOOL CALL] search_trivia("what is the fastest land animal")
    [TOOL RESULT] The cheetah, which can sprint up to about 100-120 km/h (60-75 mph) in short bursts.
    [FINAL ANSWER] The cheetah, which can sprint up to about 100-120 km/h (60-75 mph) in short bursts.

    ✅ Right tool. The question matches one of its 6 trivia facts, so it looked it up.

  4. You ask: how many moons does saturn have

    [THINKING] Checking whether this needs a tool...
    [TOOL CALL] search_trivia("how many moons does saturn have")
    [TOOL RESULT] Jupiter has over 95 confirmed moons, and astronomers keep finding more. Only Saturn has more.
    [FINAL ANSWER] Jupiter has over 95 confirmed moons, and astronomers keep finding more. Only Saturn has more.

    ❌ Wrong answer, said with confidence. You asked about Saturn, but it has no Saturn fact. "How many moons … have" is close to its Jupiter fact, so it answers about Jupiter instead.

  5. You ask: tell me a joke

    [THINKING] Checking whether this needs a tool...
    [THINKING] No tool matches — not math, not one of my trivia topics.
    [FINAL ANSWER] I can only do math (e.g. "12 * 4") or answer a handful of trivia questions. Try one of those!

    ✅ Honest. None of its tools can tell a joke, so it says so instead of making something up.

  6. You ask: I have 3 apples and eat 1, how many are left?

    [THINKING] Checking whether this needs a tool...
    [TOOL CALL] search_trivia("I have 3 apples and eat 1, how many are left?")
    [TOOL RESULT] Jupiter has over 95 confirmed moons, and astronomers keep finding more. Only Saturn has more.
    [FINAL ANSWER] Jupiter has over 95 confirmed moons, and astronomers keep finding more. Only Saturn has more.

    ❌ Wrong tool. A person sees an easy sum. But there is no "minus" or "−" for the calculator rule to spot. "How many … have" looks like the Jupiter question, so you get a fact about moons.

The lesson: an agent is only as good as the way it picks its tools. This one follows a simple rule. So it misses questions written a little differently, and it can pick the wrong tool without noticing. Real AI agents let the AI decide, which is much smarter. But they can still pick wrong.

Try it yourself

Tap an example to put it in the box. Then change it a little and watch the steps change. Can you find another question that tricks it?

Getting the agent ready in your browser…

What the agent does: