Hook

—
Google just dropped a free 8-minute lesson on building your first AI agent. In this video you're going to learn what AI agents are, not just in theory, but in practice. We'll look at the ideas behind modern agents and then build your very first AI agent step by step using Google's ADK. By the end, you'll understand how agents reason, act, and adapt. And you'll have code that you can actually run yourself. So, what are AI agents? At the simplest level, an agent is software that doesn't just answer, it can decide and take action. Instead of generating a single response like a traditional chatbot, an agent looks at your request, figures out what steps need to be taken, maybe calls an API, runs code, looks at the results, and then decides what to do next. One of the clearest explanations comes from the research paper ReAct: Synergizing reasoning and acting in language models. The idea in that paper was simple but powerful. Language models shouldn't just generate text in one go, they can reason, step by step, take action, maybe call a tool or API, observe the results, and then decide what to do next. That cycle of reasoning, acting, observing, and adjusting is the foundation of how modern AI agents work. Systems with reasoning, planning, and memory with enough autonomy to adapt and make decisions on behalf of the user. Now, not all agents behave the same way. A useful way to think about them is in three broad patterns. First, we have sequential agents. These run step by step, like an assembly line. Step one, then step two, then step three. They're predictable but rigid. Second, reactive agents. These decide in the moment. They look at the current state and ask what should I do next? Maybe tool A one time, tool B the next. They're flexible but they don't plan ahead. Lastly, we have deliberate or planning agents. These pause to sketch a plan, then execute. Think about booking travel. You don't just book dates, hotels, randomly. You plan ahead. So, which of these is the right one for you? It depends on the problem. For simple, predictable flows, sequential is fine. For dynamic, reactive work, it works better. And for multi-step goals with dependencies, you want planning agents. Okay, that's a high-level view. Now, let's actually build an agent. So we can see these ideas in action. Building a blog-writing agent with Google ADK. You give it a topic, it will generate a structured blog outline, turn that outline into a full-length blog post, and then suggest alternative titles and hooks. This is where ADK's categories come in. As we walk through the code, notice how the planner and writer agents are LLM agents, which are wrapped in loop agents, which are workflow agents. The planner agent's job is to take the user's topic and delegate tasks to the appropriate tools. It generates a structured blog outline based on the delegated task. The writer agent takes the structured outline and drafts a full, comprehensive blog post. The planner and writer are wrapped in loop agents, which are workflow agents. These handle retries automatically if validation fails. And if we ever wanted something beyond that, ADK would also let us extend the base agent. So, let's set up the environment and then go line by line through the code. First, you need to install the UV and then install Google ADK because we need to use ADK in this. And then, let's create a file called agent.py in your IDE. We need to import these key libraries and then we can start building out our very first agent. We give it the name blog planner, so it's easy to identify and we tell it which model to use, which comes from our environment file. The description is just a human readable note that the agent will use to understand its purpose. You are a blog content strategist. Produce a clear Markdown outline with the following: A. Title, B. Intro, C. Four to six main sections, each with two to three bullets, and a conclusion. The output key is blog_outline. Finally, look at the output key. We set it to blog_outline. This means whatever this agent writes will be stored in shared state under that name, so the next agent can pick it up automatically. Next, we add a second agent, the outline validation checker. This one doesn't write anything new, it just checks the outline. Its instruction is strict. Check the blog post outline in state blog_outline. If it has a title, intro, four to six sections, and two to three bullets per section, and two to three bullets, respond okay. Else, respond retry, and list missing pieces. That way, we can automatically decide whether to accept the outline or retry. Now, we connect the planner and the checker in a loop agent called robust blog planner. The planner runs first, then the checker. If the checker says okay, we're done. If not, the loop runs the planner again until the validation passes up to three times. This gives us a safety net, so if the model forgets something, it has another chance to get it right. Now, we create another agent, the blog writer. This one takes the outline we just saved and turns it into a full Markdown blog post. The instructions tell it how to write. Audience: software engineers. Give topics and focus on practical insight. Include concise code snippets where helpful. Output only the final article in Markdown, no fence around the whole post. The finished draft is saved in shared state under blog_post. Finally, we connect the planner and the writer in a loop agent called robust blog writer. The planner runs first, then the writer. If the writer fails, it retries up to three times. The root agent, called blogger, is simple. It takes a user topic, it plans, it writes, and it delivers the results. Your sub-agents will then work together to create a blog post. You just gave it a topic, and it's going to plan, write, and deliver the results. You've now successfully written and run your first AI agent script with Google's ADK. You started from the idea of what AI agents are, then walked through the code step by step, and finally saw it come to life in terminal. The root agent only has access to the two tools we exposed: the planner and the writer. It works flow-controlled. It plans, it writes, it checks. It's workflow is clear and controlled. You give it a topic, it plans, it writes, and it delivers the results. Thanks for watching! Check out the description for all the resources and code mentioned in this video. Check out this next video to learn how to connect your AI agent to external tools.
Their other posts in the index, biggest breakout first.