[00:00] (0.08s)
AI agents are literally Jarvis from Iron
[00:02] (2.96s)
Man. Well, more like Teimu Jarvis, the
[00:04] (4.72s)
Bluetooth device. So, what are AI
[00:06] (6.80s)
agents? Well, number one, they're not
[00:08] (8.64s)
secret agents. Number two, for the
[00:10] (10.32s)
purpose of this video, we're not talking
[00:11] (11.76s)
about reinforcement learning agents
[00:13] (13.20s)
because I don't get paid enough to
[00:14] (14.40s)
simplify math. Maybe in a future video,
[00:16] (16.16s)
but for now, we're talking about LLM
[00:17] (17.92s)
agents because they have all the hype
[00:19] (19.28s)
right now and they're pretty flipping
[00:21] (21.20s)
cool. Like, AI can do my taxes now.
[00:23] (23.68s)
Check out my refund it got me. Isn't
[00:25] (25.12s)
that cool? Wait, what's an audit? So
[00:27] (27.12s)
remember from now on when I say AI
[00:28] (28.88s)
agents or just agent in general, I mean
[00:31] (31.52s)
LLM agents. Okay, cool. A simple
[00:33] (33.52s)
definition. Agents are AIs that reason,
[00:35] (35.92s)
plan, and act in a continuous loop on
[00:38] (38.08s)
their own until they complete a goal. My
[00:39] (39.92s)
favorite definition, agents are just
[00:41] (41.36s)
LLMs using tools in a loop. Oh, and by
[00:43] (43.52s)
the way, if you hate my definitions and
[00:45] (45.20s)
you want to dive deeper and get a little
[00:46] (46.72s)
more technical about AI agents, I'm
[00:48] (48.40s)
going to share all my notes and
[00:49] (49.52s)
resources about AI agents for free. All
[00:51] (51.76s)
you have to do is subscribe to my free
[00:53] (53.92s)
newsletter, Sloth Bites, where I share
[00:55] (55.60s)
weekly programming advice, news, and
[00:57] (57.44s)
information to make you a better
[00:59] (59.36s)
programmer. And once you subscribe,
[01:00] (60.88s)
you'll have access to all my notes and
[01:02] (62.48s)
code examples. My goal is to make sloth
[01:04] (64.40s)
bites one of the top programming
[01:05] (65.60s)
newsletters. So, please subscribe,
[01:07] (67.68s)
please. When is something an AI agent?
[01:09] (69.60s)
Let me give you an example. Hey, search
[01:10] (70.96s)
the weather. Sure. Wait, I don't have
[01:13] (73.04s)
information about today's weather, but
[01:14] (74.32s)
here's the weather in 2023. This right
[01:16] (76.08s)
here is called non-agentic. It's
[01:18] (78.16s)
basically just normal LLM behavior where
[01:20] (80.16s)
you give it an input and it gives you an
[01:21] (81.68s)
output based on its training data. The
[01:23] (83.28s)
AI reacts to your question, but they
[01:25] (85.12s)
don't really think. They only use
[01:26] (86.48s)
whatever information they already have.
[01:28] (88.32s)
They can't plan or solve problems
[01:29] (89.84s)
outside their knowledge. Let's upgrade
[01:31] (91.36s)
the AI a little bit here. Take this
[01:32] (92.72s)
tool. I have tool. Search the weather. I
[01:34] (94.56s)
can't. Wait, I have tool. Let me use
[01:36] (96.36s)
tool. The weather is Thanks. This right
[01:39] (99.44s)
here is called an AI workflow. It's an
[01:41] (101.60s)
AI that has access to tools, which lets
[01:43] (103.52s)
it do a bunch of cool things, but it's
[01:45] (105.04s)
still just following instructions, not
[01:46] (106.72s)
making decisions on its own. Now, let's
[01:48] (108.32s)
take the AI even further. Hey, what's
[01:50] (110.16s)
the weather? The weather is Oh, wait. I
[01:52] (112.16s)
noticed you're in a different city on
[01:53] (113.44s)
vacation. The weather there is I'd also
[01:56] (116.08s)
recommend bringing a jacket. And here's
[01:57] (117.84s)
a link where you can buy one. Oh, wait.
[01:59] (119.76s)
I just noticed you are broke. Let me
[02:01] (121.84s)
find you a cheaper jacket. Here's a
[02:03] (123.44s)
cheaper jacket. Here's what you'd look
[02:05] (125.04s)
like wearing it. Broki, what you This is
[02:06] (126.96s)
an AI agent. It plans steps dynamically.
[02:09] (129.36s)
It adjusts based on new information and
[02:11] (131.04s)
it keeps working towards your goal
[02:12] (132.32s)
without needing every move hard-coded.
[02:14] (134.08s)
The key difference that transforms an AI
[02:16] (136.16s)
workflow to an AI agent is that it runs
[02:18] (138.16s)
a loop over and over until it finishes
[02:20] (140.32s)
the goal or an error happens. Basically,
[02:22] (142.64s)
they can think for themselves without
[02:24] (144.16s)
you having to do anything. I didn't tell
[02:25] (145.68s)
it I was on vacation or what to wear or
[02:27] (147.76s)
to tell me I was broke. It planned those
[02:29] (149.28s)
steps out on its own based on the tools
[02:31] (151.12s)
it had access to. I'm telling you, it's
[02:33] (153.12s)
Teimu Jarvis. So, what are the parts of
[02:35] (155.04s)
an agent? An agent consists of four
[02:36] (156.88s)
parts. the model, the tools, the memory,
[02:39] (159.20s)
and the instructions. The model, every
[02:41] (161.04s)
model has different strengths and
[02:42] (162.48s)
weaknesses. Not every task requires the
[02:44] (164.80s)
smartest model. If the task is simple
[02:46] (166.48s)
and it doesn't need much brain power,
[02:47] (167.92s)
you can use a smaller, faster model. If
[02:49] (169.76s)
the task is more complex and you need
[02:51] (171.28s)
some big brain 500 IQ thoughts, use a
[02:53] (173.44s)
larger model. The tools, you can give
[02:54] (174.88s)
your AI some tools to make it better.
[02:56] (176.48s)
For example, letting them use APIs from
[02:58] (178.24s)
other services or MCPs. For example, you
[03:00] (180.48s)
can give your AI access to today's
[03:02] (182.24s)
sponsor, ReCraft, to generate some cool
[03:04] (184.32s)
pictures, like this one. Recraft is an
[03:06] (186.08s)
image generation and editing tool that's
[03:08] (188.00s)
designed to empower creators and teams
[03:09] (189.84s)
in order to speed up the entire design
[03:11] (191.60s)
process. For example, you have a lot
[03:13] (193.04s)
more control over these images compared
[03:14] (194.64s)
to other image generation tools. But if
[03:16] (196.32s)
you need some inspiration and don't know
[03:17] (197.60s)
where to start, they have an infinite
[03:19] (199.04s)
style library that lets you find
[03:20] (200.40s)
inspiration and quickly apply it to your
[03:22] (202.40s)
own work. You can browse thousands of
[03:23] (203.84s)
curated styles like photo realism,
[03:26] (206.00s)
illustrations, and more. And once you
[03:27] (207.44s)
find a style you like, you can just
[03:28] (208.80s)
select it and use it for yourself. But
[03:30] (210.40s)
you don't have to limit yourself to just
[03:32] (212.00s)
one style. You can also use their style
[03:34] (214.00s)
mixing feature which lets you combine up
[03:35] (215.84s)
to five styles which could be from the
[03:37] (217.28s)
style library or from your own images.
[03:39] (219.12s)
And of course, since you're a
[03:40] (220.32s)
programmer, Recraft has an API that you
[03:42] (222.48s)
can use to generate visuals for whatever
[03:44] (224.40s)
projects you have in mind. ReCcraft
[03:45] (225.92s)
doesn't make design easier. It makes it
[03:47] (227.60s)
more scalable, more consistent, and way
[03:49] (229.44s)
more fun to explore creatively without
[03:51] (231.20s)
sacrificing quality. So, if you want to
[03:52] (232.80s)
try it out, you can use my promo code
[03:54] (234.48s)
sloth 11 for $1 off any paid plan, or
[03:57] (237.28s)
you can click the link in the
[03:58] (238.40s)
description. Anyways, back to tools.
[04:00] (240.08s)
Agents usually need three types of
[04:01] (241.68s)
tools: data, action, and orchestration.
[04:03] (243.76s)
Data tools. Data tools let the agent
[04:05] (245.68s)
retrieve the necessary information to do
[04:07] (247.44s)
its task. Some examples are reading from
[04:09] (249.12s)
a database, reading PDF documents, or
[04:11] (251.20s)
being able to search the web. Wait a
[04:12] (252.56s)
minute. Data tools sound a whole lot
[04:14] (254.40s)
like RAG. That's correct. Awfully smart
[04:16] (256.40s)
viewer. Why are you watching this? Now,
[04:17] (257.92s)
for the uneducated viewers, which is
[04:19] (259.68s)
fine, you're learning this right now.
[04:21] (261.04s)
Rag stands for retrieval augmented
[04:23] (263.12s)
generation. Fancy words? Simple idea.
[04:25] (265.36s)
You ask an AI a question. If it doesn't
[04:27] (267.28s)
know the answer, it goes and grabs
[04:28] (268.72s)
information from somewhere else and then
[04:30] (270.24s)
it tries to use that new information to
[04:31] (271.84s)
give you a better answer. And when you
[04:33] (273.20s)
combine this with agents, you get what's
[04:34] (274.88s)
called agentic rag. Pretty cool. Action
[04:36] (276.88s)
tools. Action tools let the agent
[04:38] (278.56s)
interact with systems like adding new
[04:40] (280.40s)
information to a database, being able to
[04:42] (282.08s)
send emails and texts, or being able to
[04:43] (283.92s)
use your computer to navigate the
[04:45] (285.28s)
internet. Orchestration tools.
[04:46] (286.56s)
Orchestration tools let agents manage
[04:48] (288.40s)
other agents to perform specialized
[04:50] (290.08s)
tasks. The memory. AI has two different
[04:51] (291.92s)
types of memories. short-term memory
[04:53] (293.68s)
like conversation history and long-term
[04:55] (295.52s)
memory like important facts saved to a
[04:57] (297.36s)
database. Memory lets me memory god dam
[04:59] (299.92s)
memory lets the agent build context so
[05:01] (301.84s)
it stays on track and slowly improves
[05:03] (303.84s)
with more information. The instructions
[05:05] (305.60s)
a lot of you also know this as prompt
[05:07] (307.52s)
engineering or prompting AI is a little
[05:09] (309.92s)
freaky. It needs some instructions
[05:11] (311.36s)
before it can do its task. Now this
[05:12] (312.96s)
video isn't about prompting. So I'll
[05:14] (314.56s)
keep it short. In simple terms you tell
[05:16] (316.16s)
the agent its role, its goal, what
[05:17] (317.84s)
success looks like, what tools it has
[05:19] (319.44s)
access to, and how it should respond. I
[05:21] (321.20s)
mean, it's prompting, not rocket
[05:22] (322.48s)
science. If you want more details on
[05:23] (323.84s)
this, then you already know where to go.
[05:25] (325.36s)
Types of AI agents. Okay, this is the
[05:27] (327.20s)
good stuff. The tutorial phase is over.
[05:29] (329.04s)
Now, depending on the goal, you can
[05:30] (330.48s)
build agents in very different ways.
[05:32] (332.48s)
There's a lot of different patterns you
[05:33] (333.76s)
can use, but I'll give you the most
[05:34] (334.96s)
common ones. Number one, a single agent.
[05:37] (337.12s)
Pretty straightforward. It's just one
[05:38] (338.40s)
agent. It does everything by itself.
[05:40] (340.00s)
It's simple, clean, and honestly, for a
[05:42] (342.32s)
lot of projects, this is enough. Number
[05:44] (344.00s)
two, multi- aent crews. Sometimes one
[05:46] (346.16s)
agent isn't enough. So, you split up the
[05:48] (348.00s)
work into a crew of specialized agents.
[05:50] (350.40s)
Each agent will have a different role.
[05:51] (351.92s)
One might be a researcher, another one's
[05:53] (353.52s)
a planner, another one's a builder. They
[05:55] (355.04s)
talk to each other, share results, and
[05:56] (356.80s)
work as a team. Number three, a
[05:58] (358.32s)
sequential workflow. This one's pretty
[06:00] (360.00s)
simple. Each agent has a task, and it
[06:01] (361.92s)
hands the results off to the next one.
[06:03] (363.52s)
Kind of like a relay race. Step one,
[06:05] (365.20s)
step two, step three. This is useful
[06:06] (366.88s)
when there's a clear fixed process.
[06:09] (369.04s)
However, this workflow is not very
[06:10] (370.88s)
flexible. Each step relies on the other.
[06:12] (372.80s)
If something happens in between the
[06:14] (374.16s)
steps, everything gets messed up. Number
[06:15] (375.84s)
four, hierarch hierarch.
[06:18] (378.40s)
Hierarchical systems. Now we're getting
[06:20] (380.32s)
fancy. In a hierarchical system, there's
[06:22] (382.16s)
a manager agent at the top. You give the
[06:24] (384.00s)
manager a big goal and it decides what
[06:25] (385.76s)
task to create and assigns those tasks
[06:27] (387.76s)
to other agents underneath it. The
[06:29] (389.36s)
manager thinks big picture while the
[06:31] (391.12s)
worker agents focus on the details.
[06:32] (392.80s)
Number five, parallel agents. Now, if
[06:34] (394.56s)
you have experienced programming, you
[06:36] (396.08s)
already know the benefits of this.
[06:37] (397.20s)
Instead of doing one task at a time, you
[06:38] (398.96s)
spin up multiple agents to work at the
[06:40] (400.72s)
same time. It's way faster and it's way
[06:42] (402.64s)
cheaper. Sometimes all you need to do is
[06:44] (404.64s)
find a way to merge all the results back
[06:46] (406.72s)
together at the end. Number six, hybrid
[06:48] (408.64s)
systems. In the real world, a lot of
[06:50] (410.32s)
smart agent systems aren't purely
[06:51] (411.92s)
sequential, purely hierarchical, or
[06:54] (414.32s)
purely parallel. They're a mix. Hybrid
[06:56] (416.32s)
systems give you the benefits of all of
[06:57] (417.84s)
them. But the issue is they're the most
[06:59] (419.76s)
complex, and they're the hardest to
[07:01] (421.44s)
design and control. So, be careful if
[07:03] (423.12s)
you're using this. Once again, there's a
[07:04] (424.72s)
lot more ways to design these agents,
[07:06] (426.32s)
but these are probably the most common
[07:07] (427.84s)
ways to design them. How to make an
[07:09] (429.12s)
agent? This is cool and all, but how do
[07:10] (430.72s)
I actually make one of these agents?
[07:12] (432.24s)
Good news. It's a lot easier than it
[07:13] (433.76s)
sounds. There's a lot of amazing tools
[07:15] (435.28s)
that make it easy. Now, if you don't
[07:16] (436.64s)
want to do a lot of programming, you can
[07:18] (438.08s)
use things like Flowwise, Make, and Nan.
[07:20] (440.48s)
But since we're programmers and we like
[07:22] (442.08s)
to make life harder for ourselves,
[07:23] (443.60s)
there's also a lot of tools that make
[07:24] (444.96s)
programming agents easier. There's
[07:26] (446.48s)
Langchain, Autogen, Crew AI, there's
[07:29] (449.04s)
Google's agent SDK, and then there's
[07:30] (450.64s)
also OpenAI's agent SDK. There's also
[07:32] (452.64s)
Cloudflare's agent SDK. Sorry,
[07:34] (454.48s)
Cloudflare for forgetting. Building a
[07:36] (456.00s)
simple agent isn't that complicated
[07:37] (457.60s)
thanks to these tools, but you can
[07:38] (458.96s)
definitely spend hours designing these
[07:40] (460.64s)
systems. They can get very complex real
[07:42] (462.72s)
fast. It's kind of like stacking Lego
[07:44] (464.32s)
blocks together. You pick your tools,
[07:45] (465.84s)
you set your rules, and you let it think
[07:47] (467.28s)
for itself. Once you have the basics
[07:48] (468.64s)
down, you can scale it up to full
[07:50] (470.32s)
autonomous systems, teams, and you can
[07:52] (472.40s)
automate a lot of things with agents.
[07:54] (474.32s)
And they're still brand new, so who
[07:56] (476.00s)
knows what agents will look like in a
[07:57] (477.52s)
few years. That's everything I know
[07:58] (478.56s)
about AI agents. Let me know if I'm
[08:00] (480.00s)
wrong about anything. If you want to
[08:01] (481.28s)
dive deeper, get more technical, and get
[08:03] (483.04s)
some code examples on how to build
[08:04] (484.24s)
agents, subscribe to my newsletter and
[08:05] (485.76s)
you'll get all my notes for free. If you
[08:07] (487.12s)
want a video on how to program AI
[08:08] (488.56s)
agents, let me know in the comments. And
[08:10] (490.24s)
uh I think that's it. Okay, bye.