Module 1 · Foundations of Agentic AI · scripted

What Is an AI Agent?

25 minoutcomes: agent-architectures, prompt-engineering

From conversations to agents

A prompt is a conversation with a trajectory, and the LLM's outputs condition where that trajectory goes next. Now connect this to agents. The simplest way to think about an AI agent:

An AI agent is a conversation in which the LLM takes actions that influence the external world — and what it learns about the world comes back into the conversation.

As the conversation evolves, the LLM takes an action. The action has some impact on the external world. The LLM learns something about the world from what comes back, and uses it to make its next decision. It is trying to take actions that steer the conversation toward a state that says: the goal has been achieved.

The agent loop, first form

Two things to hold on to, because everything later builds on them:

The two constraints

The LLM's entire understanding of the world is captured in the conversation.
If the world changed and the conversation doesn't say so, the LLM doesn't know.
All the LLM can do is describe, in the conversation, what it wants done.
Words are its only actuator.

The simplest agent: a human in the loop

The simplest possible agent takes its actions through a person. The LLM asks a human to do something in the world; the human does it and reports back what happened; the LLM uses the report to decide what to ask for next. The agent's job is to steer the human through a process toward a goal — and the human's job is to be its hands, eyes, and ears.

The human as actuator

To build one, we need a prompt that hands the LLM the lead. That prompt is a known pattern.

The flipped interaction pattern

In ordinary use, the human drives: the human decides what to ask and what background to provide. The flipped interaction pattern — from the prompt-pattern catalog in White et al., A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT — reverses this. You give the LLM a goal and have it lead the conversation by asking you questions until it can achieve the goal.

The pattern — four things your prompt establishes

The goal — what the interaction should produce
That the LLM, not the human, leads by asking questions
When it has enough — the condition for stopping
How many questions at a time — typically one

The simplest version of this is the LLM asking the user questions about the state of the world in order to gather information. The simplest action an agent can take is a question:

The question as the simplest action

Why one question at a time? Watch it work:

Example 1 · Flipped interaction — planning a trip
user

I'm planning a trip to Molde, Norway. Ask me one question at a time, until you have enough information to create an itinerary for me.

assistant

When are you going, and for how many days?

user

Late August, three days.

assistant

Late August has long days and decent hiking weather. Are you more interested in mountains and outdoor time, or city, culture, and food?

NoteLook at the shape of the second question: it already builds on "late August" — and it is a fork, chosen to split the space of possible itineraries.
user

Mountains — but I have a bad knee, so nothing too steep.

assistant

Good to know — that rules out the Romsdalseggen ridge. Would you rather do gentler walks near the fjord, or drive scenic routes like the Atlantic Ocean Road with short stops?

NoteThe knee changed everything. The famous ridge hike vanished from the plan, and the next question adapted to what the model just learned. Asking is the action; the answer is new information about the world; the next question is a new decision conditioned on it.

This pattern shines when you don't know the domain well enough to construct the right context up front. The alternative — dumping what you have into one prompt and saying "give me the thing" — forces the model to guess and assume, and you get the average trip to Molde, not yours. In flipped interaction the LLM pulls in exactly the context it needs, adapting each question to what it just learned.

The action view
  • List the "actions" the LLM took in Example 1.
  • What did each action change about the conversation?
  • Which question could it not have asked at the start?

Taking action in the world

Now aim the same pattern at the world itself. The LLM's questions become instructions, and the human's answers become reports of what actually happened:

Example 2 · Cooking sveler, one step at a time
user

Help me make sveler (Norwegian griddle cakes). Tell me what to do, one simple step at a time. I'll perform each step and tell you what happened. Based on what happened, decide what to do next.

assistant

Step 1: In a large bowl, whisk 2 eggs with 1 dl sugar until pale and slightly foamy. Tell me when you're there.

user

Done — pale yellow and foamy.

assistant

Step 2: Add 3 dl kefir (or buttermilk) and whisk it in. Then tell me what the mixture looks like.

user

Done. It's thin, like cream.

assistant

Perfect — that's what we want before the flour. Step 3: Sift in 250 g flour, 1 tsp baking soda, and ½ tsp hornsalt if you have it. Fold gently — don't overmix. How does the batter look?

NoteThe LLM has never seen this kitchen. Its entire knowledge of the bowl, the batter, the stove is what the human reports. Its only actuator is the instruction it writes next.

When the world surprises the agent

The real test of an agent is not following a script — it's what happens when the world reports something the plan didn't expect:

Example 3 · The batter fights back
user

Done, but something's off — the batter is really thick, almost like dough. I can barely stir it.

assistant

Then we stop and fix that before anything touches the pan — thick batter makes rubbery sveler. Add milk one tablespoon at a time, stirring gently after each, until it flows slowly off the spoon like thick paint. Tell me how many spoonfuls it takes.

user

Four spoonfuls. Now it flows off the spoon slowly.

assistant

That's right where we want it. The kefir was probably extra thick — brands vary. Now: medium heat, a little butter on the pan, and pour a small test cake, about the size of your palm. Tell me what the surface does in the first minute.

NoteNo recipe said "if batter is too thick after step 3, add four spoonfuls of milk." The report changed the trajectory: the model paused the plan, introduced a repair step, invented a doneness test ("flows like thick paint"), and even explained the likely cause. Its next decision came from the conversation — not from a predetermined branch.
Where did the plan go?
  • The original plan had no "fix thick batter" step. Where did that step come from?
  • What would traditional software have needed to handle this moment?
  • What does the model actually "know" about this kitchen right now? Make a list — then check: every item on your list is in the conversation.

This is the whole agent idea in miniature. An agent is a conversation with a trajectory; the LLM acts by writing into it; the world answers back through it; and the LLM steers — adapting, repairing, re-planning — using nothing but the evolving conversation.

Your turn

Write a flipped-interaction prompt for your research domain: a goal you understand deeply, where the LLM must interview you one question at a time before producing anything. Run it. Where did its questions surprise you? Where did it adapt to an answer?