AI Folks
  • Courses
  • Web Of AI
  • Pricing
  • Enterprise
Log in
PreviousWhen workflows failNextAn agent in n8n

Vibe Coder · Unit 16: AI Agents · Lesson 1 of 9

What an agent is

An agent is a model in a loop with tools: it decides the next step, acts, looks at the result and goes again. When to use one, and when a plain workflow is better.

Read the short notes and pictures.Do everything inside a blue frame.

Steps you write, and steps it chooses

In the n8n unit you drew every step. That is the right design when you know what should happen: a signup always gets a row and an email. Some jobs do not have fixed steps. "Find out why this customer’s invoice failed and fix it" might need one lookup or six, in an order nobody can know in advance. That is a job for an agent.

The loop

A contour map, hand-drawn. Four nodes in a loop: read the goal, pick an action, act, look at the result, and back to pick an action.
An agent repeats one loop until the job is done.

An agent is a language model placed in a loop. On each turn it looks at the goal and everything that has happened so far, and chooses what to do next. Usually that is calling a tool. The tool’s result is added to what it knows, and it chooses again. The loop ends when the model decides the goal is met, or when a limit you set is reached.

Model

The language model that reads and decides. A stronger model plans better and costs more.

Instructions

The system prompt: the job, the rules, what good looks like, and when to stop or ask.

Tools

Functions the model may call. Each has a name, a description and inputs. The description is how the model knows when to use it.

Memory

The conversation and tool results so far, and anything saved between sessions.

Tools make the agent

A model alone can only produce text. Tools are what let it look things up and change things. Choose them with care: every tool is something the agent can get wrong. A support agent might get "look up an order" and "draft a reply", but not "issue a refund".

Workflow or agent

A contour map, hand-drawn. Two cards compare a workflow, where you know the steps, with an agent, where the steps depend on what it finds.
Known steps: a workflow. Unknown steps: an agent.

Good for a workflow

Send a welcome email on signup.
Post a daily sales summary.
Copy new form entries to a table.

Good for an agent

Answer a customer question using
the docs and their account.
Research a lead and write a brief.
Triage a bug report and find the cause.
Many good products are mostly workflow with one agent step in the middle, where the judgement is.

The costs are real

Each turn of the loop is a model call, so an agent costs more and takes longer than a single prompt. It can also loop, pick the wrong tool, or act on bad information. Start with the simplest thing that works, and add autonomy only where it pays for itself.

  1. 1

    Give it one job

    A narrow agent is easier to test and to trust.

  2. 2

    Give it the fewest tools

    Read-only where you can.

  3. 3

    Set limits

    A maximum number of steps and a spending cap.

  4. 4

    Keep a person in the loop

    For anything that sends, spends or deletes.

ActivityYour turnWrite it yourself first, then compare.

For your product, write down one job that suits a workflow and one that suits an agent. For the agent, list the tools it would need and mark each as read or write.

ActivityBuild stepAn agent that works for your product

Design your agent on paper

Choose one job in your product that needs judgement. Write the agent’s goal in one sentence, its instructions in a short paragraph, the tools it needs with read or write beside each, and its limits.

Done when

You will build this design in the next lesson.

Keep these

  • An agent is a model in a loop with tools.
  • Use a workflow for known steps and an agent for unknown ones.
  • Keep the job narrow, the tools few and the limits clear.
Back toVibe CoderNext lessonAn agent in n8n