- [Instructor] Before we start building our agent,
let's quickly discuss what is an agent anyway.
The term agent gets used everywhere lately
and so much that it can be confusing.
Let's first look at what's not an agent.
What you see here is an automated workflow.
It runs a fixed sequence of predefined steps,
triggered by maybe a webhook or a file change,
and then produces an output.
Everything is fully deterministic.
No AI involved.
It just follows the script.
Next up is an automated AI workflow.
This one still has a clear input and output,
but now we use AI inside the workflow to perform a task,
for example, classifying a new email
or summarizing a meeting transcript.
Here, a large language model helps with part of the job,
but the overall process is still predictable:
clear input, clear output.
Now, let's look at an agent workflow,
and this is where things change.
We still have a goal and an output in mind,
but we don't define how to reach it exactly.
Instead, we give the agent instructions,
a few tools it can use,
and let it decide the steps on its own.
It reasons through the process,
choosing which action to take next.
The result isn't deterministic anymore.
It's more probabilistic,
driven by the agent's reasoning rather than static rules.
So, when should you use an AI agent?
Agents are most effective when the goal is clearly defined,
but there are multiple flexible paths to reach it.
There's a limited number of actions available
and the order doesn't really matter,
and ideally, actions can be corrected,
meaning the agent can go back and forth
until the goal is achieved.
Let's take our pre-sales agent as an example.
Its goal is to generate a quote
that meets all required fields.
The tools it has is collecting customer info
through the chat,
collecting prices, generating the quote,
and then finally drafting an email.
It doesn't matter which of these happens first,
as long as the final quote is valid,
and if something's missing, like customer info,
the agent can simply ask again.
Now, when shouldn't we use an AI agent?
If the goal is unclear
or there are either too few or too many steps
to reach that goal,
agents aren't really a good fit.
When there are just a few steps,
a classical automation or AI workflow
is usually the better path.
On the other hand, if the agent has too many tools,
the process quickly becomes unreliable and unmanageable.
Right now, there's no hard rule for what too many means,
but personally, I try to keep it under 10 tools per agent.
Agents also struggle when the order of steps is strict
or when mistakes can't be corrected,
such as in high-stakes or irreversible scenarios.
In those cases, a traditional workflow
is almost always the better choice.
So, to sum it up,
an AI agent combines three essential components,
an AI model with instructions,
memory to keep track of the short-term context,
and a defined set of tools
that allow it to interact with other systems.
Together, these give the agent
the autonomy to act towards a goal:
reasoning, choosing, and executing steps on its own,
which brings me to one of my favorite definitions
of an AI agent,
by Simon Willison.
He says, "An agent is an LLM that runs tools in a loop
to achieve a goal,"
and that's the definition we'll use going forward.
Simple, practical, and exactly what we'll be building
throughout this course.