# Everything You Need To Know About AI Agents

## Метаданные

- **Канал:** The Coding Sloth
- **YouTube:** https://www.youtube.com/watch?v=XBuv4HHTRjI
- **Источник:** https://ekstraktznaniy.ru/video/31428

## Транскрипт

### Segment 1 (00:00 - 05:00) []

AI agents are literally Jarvis from Iron Man. Well, more like Teimu Jarvis, the Bluetooth device. So, what are AI agents? Well, number one, they're not secret agents. Number two, for the purpose of this video, we're not talking about reinforcement learning agents because I don't get paid enough to simplify math. Maybe in a future video, but for now, we're talking about LLM agents because they have all the hype right now and they're pretty flipping cool. Like, AI can do my taxes now. Check out my refund it got me. Isn't that cool? Wait, what's an audit? So remember from now on when I say AI agents or just agent in general, I mean LLM agents. Okay, cool. A simple definition. Agents are AIs that reason, plan, and act in a continuous loop on their own until they complete a goal. My favorite definition, agents are just LLMs using tools in a loop. Oh, and by the way, if you hate my definitions and you want to dive deeper and get a little more technical about AI agents, I'm going to share all my notes and resources about AI agents for free. All you have to do is subscribe to my free newsletter, Sloth Bites, where I share weekly programming advice, news, and information to make you a better programmer. And once you subscribe, you'll have access to all my notes and code examples. My goal is to make sloth bites one of the top programming newsletters. So, please subscribe, please. When is something an AI agent? Let me give you an example. Hey, search the weather. Sure. Wait, I don't have information about today's weather, but here's the weather in 2023. This right here is called non-agentic. It's basically just normal LLM behavior where you give it an input and it gives you an output based on its training data. The AI reacts to your question, but they don't really think. They only use whatever information they already have. They can't plan or solve problems outside their knowledge. Let's upgrade the AI a little bit here. Take this tool. I have tool. Search the weather. I can't. Wait, I have tool. Let me use tool. The weather is Thanks. This right here is called an AI workflow. It's an AI that has access to tools, which lets it do a bunch of cool things, but it's still just following instructions, not making decisions on its own. Now, let's take the AI even further. Hey, what's the weather? The weather is Oh, wait. I noticed you're in a different city on vacation. The weather there is I'd also recommend bringing a jacket. And here's a link where you can buy one. Oh, wait. I just noticed you are broke. Let me find you a cheaper jacket. Here's what you'd look like wearing it. Broki, what you This is an AI agent. It plans steps dynamically. It adjusts based on new information and it keeps working towards your goal without needing every move hard-coded. The key difference that transforms an AI workflow to an AI agent is that it runs a loop over and over until it finishes the goal or an error happens. Basically, they can think for themselves without you having to do anything. I didn't tell it I was on vacation or what to wear or to tell me I was broke. It planned those steps out on its own based on the tools it had access to. I'm telling you, it's Teimu Jarvis. So, what are the parts of an agent? An agent consists of four parts. the model, the tools, the memory, and the instructions. The model, every model has different strengths and weaknesses. Not every task requires the smartest model. If the task is simple and it doesn't need much brain power, you can use a smaller, faster model. If the task is more complex and you need some big brain 500 IQ thoughts, use a larger model. The tools, you can give your AI some tools to make it better. For example, letting them use APIs from other services or MCPs. For example, you can give your AI access to today's sponsor, ReCraft, to generate some cool pictures, like this one. Recraft is an image generation and editing tool that's designed to empower creators and teams in order to speed up the entire design process. For example, you have a lot more control over these images compared to other image generation tools. But if you need some inspiration and don't know where to start, they have an infinite style library that lets you find inspiration and quickly apply it to your own work. You can browse thousands of curated styles like photo realism, illustrations, and more. And once you find a style you like, you can just select it and use it for yourself. But you don't have to limit yourself to just one style. You can also use their style mixing feature which lets you combine up to five styles which could be from the style library or from your own images. And of course, since you're a programmer, Recraft has an API that you can use to generate visuals for whatever projects you have in mind. ReCcraft doesn't make design easier. It makes it more scalable, more consistent, and way more fun to explore creatively without sacrificing quality. So, if you want to try it out, you can use my promo code sloth 11 for $1 off any paid plan, or you can click the link in the description. Anyways, back to tools. Agents usually need three types of tools: data, action, and orchestration. Data tools. Data tools let the agent retrieve the necessary information to do its task. Some examples are reading from a database, reading PDF documents, or being able to search the web. Wait a minute. Data tools sound a whole lot like RAG. That's correct. Awfully smart viewer. Why are you watching this? Now, for the uneducated viewers, which is fine, you're learning this right now. Rag stands for retrieval augmented generation. Fancy words? Simple idea. You ask an AI a question. If it doesn't know the answer, it goes and grabs information from somewhere else and then it tries to use that new information to give you a better answer. And when you combine this with agents, you get what's called agentic rag. Pretty cool. Action tools. Action tools let the agent interact with systems like adding new information to a database, being able to send emails and texts, or being able to use your computer to navigate the internet. Orchestration tools. Orchestration tools let agents manage other agents to perform specialized tasks. The memory. AI has two different types of memories. short-term memory like conversation history and long-term memory like important facts saved to a database. Memory lets me memory god dam memory lets the agent build context so

### Segment 2 (05:00 - 08:00) [5:00]

it stays on track and slowly improves with more information. The instructions a lot of you also know this as prompt engineering or prompting AI is a little freaky. It needs some instructions before it can do its task. Now this video isn't about prompting. So I'll keep it short. In simple terms you tell the agent its role, its goal, what success looks like, what tools it has access to, and how it should respond. I mean, it's prompting, not rocket science. If you want more details on this, then you already know where to go. Types of AI agents. Okay, this is the good stuff. The tutorial phase is over. Now, depending on the goal, you can build agents in very different ways. There's a lot of different patterns you can use, but I'll give you the most common ones. Number one, a single agent. Pretty straightforward. It's just one agent. It does everything by itself. It's simple, clean, and honestly, for a lot of projects, this is enough. Number two, multi- aent crews. Sometimes one agent isn't enough. So, you split up the work into a crew of specialized agents. Each agent will have a different role. One might be a researcher, another one's a planner, another one's a builder. They talk to each other, share results, and work as a team. Number three, a sequential workflow. This one's pretty simple. Each agent has a task, and it hands the results off to the next one. Kind of like a relay race. Step one, step two, step three. This is useful when there's a clear fixed process. However, this workflow is not very flexible. Each step relies on the other. If something happens in between the steps, everything gets messed up. Number four, hierarch hierarch. Hierarchical systems. Now we're getting fancy. In a hierarchical system, there's a manager agent at the top. You give the manager a big goal and it decides what task to create and assigns those tasks to other agents underneath it. The manager thinks big picture while the worker agents focus on the details. Number five, parallel agents. Now, if you have experienced programming, you already know the benefits of this. Instead of doing one task at a time, you spin up multiple agents to work at the same time. It's way faster and it's way cheaper. Sometimes all you need to do is find a way to merge all the results back together at the end. Number six, hybrid systems. In the real world, a lot of smart agent systems aren't purely sequential, purely hierarchical, or purely parallel. They're a mix. Hybrid systems give you the benefits of all of them. But the issue is they're the most complex, and they're the hardest to design and control. So, be careful if you're using this. Once again, there's a lot more ways to design these agents, but these are probably the most common ways to design them. How to make an agent? This is cool and all, but how do I actually make one of these agents? Good news. It's a lot easier than it sounds. There's a lot of amazing tools that make it easy. Now, if you don't want to do a lot of programming, you can use things like Flowwise, Make, and Nan. But since we're programmers and we like to make life harder for ourselves, there's also a lot of tools that make programming agents easier. There's Langchain, Autogen, Crew AI, there's Google's agent SDK, and then there's also OpenAI's agent SDK. There's also Cloudflare's agent SDK. Sorry, Cloudflare for forgetting. Building a simple agent isn't that complicated thanks to these tools, but you can definitely spend hours designing these systems. They can get very complex real fast. It's kind of like stacking Lego blocks together. You pick your tools, you set your rules, and you let it think for itself. Once you have the basics down, you can scale it up to full autonomous systems, teams, and you can automate a lot of things with agents. And they're still brand new, so who knows what agents will look like in a few years. That's everything I know about AI agents. Let me know if I'm wrong about anything. If you want to dive deeper, get more technical, and get some code examples on how to build agents, subscribe to my newsletter and you'll get all my notes for free. If you want a video on how to program AI agents, let me know in the comments. And uh I think that's it. Okay, bye.
