Module 1 · Foundations of Agentic AI · scripted
What Is an AI Agent?
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 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 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:
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.
When are you going, and for how many days?
Late August, three days.
Late August has long days and decent hiking weather. Are you more interested in mountains and outdoor time, or city, culture, and food?
Mountains — but I have a bad knee, so nothing too steep.
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?
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.
- 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:
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.
Step 1: In a large bowl, whisk 2 eggs with 1 dl sugar until pale and slightly foamy. Tell me when you're there.
Done — pale yellow and foamy.
Step 2: Add 3 dl kefir (or buttermilk) and whisk it in. Then tell me what the mixture looks like.
Done. It's thin, like cream.
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?
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:
Done, but something's off — the batter is really thick, almost like dough. I can barely stir it.
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.
Four spoonfuls. Now it flows off the spoon slowly.
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.
- 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.
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?