GENAI 102
M07 · L03
Building Agentic Systems

The Agent Loop & Tools

At the heart of an agent is a loop: think → call a tool → observe the result → decide the next step. The tools you give it define what it can do.

01 / 08
GENAI 102
M07 · L03
One Step at a Time

How the Loop Turns

The agent does not answer in one shot. It runs the same cycle over and over until the job is finished.

  • The model plans its next move
  • It calls a tool to act in the world
  • It reads the tool's output and updates its thinking
  • It repeats until the task is done — or it gives up
02 / 08
GENAI 102
M07 · L03
Just Enough, Not More

Choosing the Tools

Give the agent exactly the tools the task needs — an API call, a database query, code execution. Too few and it gets stuck; too many and it wanders.

The trade-off
Every extra tool is also more to secure. A small, well-chosen tool set is easier to trust and to debug.
03 / 08
GENAI 102
M07 · L03
How Tools Are Exposed

The Tool Surface

Tools reach the agent through a few common shapes. The names matter less than the idea: a clear, safe boundary between the model and the world.

  • MCP — a standard way to expose tools and data to a model
  • CLI / shell — running commands the way a person would in a terminal
  • Sandboxed code execution — the agent writes and runs code in a walled-off space
04 / 08
GENAI 102
M07 · L03
Knowing When to Quit

Observe and Stop

An agent needs a clear success test and a stop condition. Without them it either loops forever, burning cost, or declares victory too early and ships the wrong result.

Two guardrails
“How do I know I'm done?” and “When do I give up?” — answer both before you let the loop run.
05 / 08
GENAI 102
Build It
From Concept to Capstone

Build It

How to implement: for one agent feature, list the tools it needs and its stop condition — “done when the task is stored” or “done when the answer is produced.”

  • Weekly AI Tasks tracker — the agent's tools are “add task,” “query tasks,” and “summarize”; the stop condition is a stored task or a delivered summary.
  • Personal brand site — the tools are “read source file” and “write section”; stop when every section has grounded copy.
06 / 08
GENAI 102
Knowledge Check

Check what stuck

Three questions from this lesson. Answer to see why — the explanation appears whether you were right or wrong. Nothing is scored or saved.

Question 1 of 0
Score 0/0

07 / 08
GENAI 102
Summary
Recap

What you learned

An agent is a loop — think, act with a tool, observe, repeat. Give it exactly the tools the task needs, expose them safely, and always define how it knows it is done.

08 / 08