
A walkthrough of Google's Imagen 3 text-to-image model and building an AI agent that reads your Gmail, flags urgent messages, and drafts replies. Uses the Compose platform to connect the agent to Gmail and CrewAI to define its tasks and tools.
Chapters
All right, let's see. Um, I just need to bring myself on. Cool. Hey, hey everyone. Um, for those that are joining, this is Sunday. Uh, I see 3 people watching on YouTube, which is pretty cool. Uh, you know, what a better way to spend the weekend. Um, well, the later end of the weekend. Uh, it's Sunday, I'm on the East Coast, and I'm just kind of gaming out what I need to be doing this coming week. And so this is part of that. Uh, So I decided to go live. I want to share some stuff that I've found over the weekend, stuff that I've been working on, and, uh, just to experiment with stuff before the beginning of the week. So, uh, let me check it out. So this is— I shared this on, I think, on a TikTok, or yeah, and, and, um, and a Short. Essentially, I think here Google released a new model for images. It's called Imagen 3, and it does pretty good actually. Um, compared to— let's see, it does pretty good compared to like other models that are out there. Uh, this was just generating images. And if we run this, um, of course you have to get the API key from— if you're trying to run this same code, you have to get the API key from their studio. And of course you have to put in a credit card to get access to that. But it's pretty neat. And this is just the entire call here, uh, passing the model And, uh, the, the kind of like the prompt that you want to generate. So here for this stream, I said, you know, I want to work on like agents that are automating your Gmail account, for example. They would kind of go in there, get your latest email accounts or your emails that have come in from your inbox, and then try to classify them to see which one ranks the best in terms of uh, you know, which ones are urgent that I should actually respond to, or which ones are like maybe not as important. And if they're important, then maybe, you know, generate a draft or that I can just kind of go and look through it, and then you hit respond directly, right? And that'd be pretty good managing Gmail inbox so I don't have to like have like, I don't know, 20,000, uh, inbox, for example. So For this one here, you would just— I mean, we could just generate any image here. Uh, let me— I guess let's just generate some random stuff. Uh, wine bottle, why not? Wine bottle advertisement. So let's hit generate. It should generate an image here, so it's going to take a few seconds here. And I have this function here that's calling from, and I've added it to generate one image. So I mean, that's pretty good. Um, of course random names, but like it's pretty good. Um, this is something that you can just take and do minor edits. So if you have like a brand that you want to— I guess let's see if we can add actually words on there with words. Best of Let's say best of Kenya. Why not? I like using my home country quite a lot, or where I was born. Let's see if it's gonna add those specific words on there. And this is just an image generation model. You give it text, it generates image. So text-to-image model in case. So I mean, it does pretty good, man. So there you go, like best of, best of best Kenya. So Huggy's just messed up there. He kind of did double there. You're supposed to do one. Uh, but you can see the bottle. I think it got right on the bottle. So Best of Kenya. And you can see like there's a sun in the background. I mean, this would look like something in Kenya, for example. This looks like a— just environmentally, right? And like this already gives you the idea of what you need to build. You can build on top of this, do more stuff that you want to do with this, like— but this gives you like the basic template. You can literally just go on like Photoshop or something and just edit out this section, um, to match what you're, what you're trying to build. So if you, if you have a wine business and you just want to build this, you know, there's something that you could do directly there. Uh, if anybody in, like, if y'all that are watching, if y'all want to like give me a prompt, I could definitely try to generate something for you so you can see it here. So feel free to put it in the chat. Let me know, let me know what you want me to generate. And the folks on, uh, Instagram, I'm just playing it for the first time. Um, it's, it's quite different. So yeah, if you have a, you have a specific thing that you want me to generate, please add it to— add it on the chat. Maybe tell me the prompt, I could try to generate that for you. But that's just an example there. Um, let's do another one. A dog. You know, park, let's say in Central Park running, let's say evening sunset. It's just trying to create a scene here. So it should create a dog. I mean, it should generate a dog in Central Park, New York with the evening sunset behind it. Okay, not bad. I mean, that's a giant road, to be honest. I don't think Central Park has a giant road. And also, like, the running paws just doesn't seem natural. 2 front legs, 2 back legs. I mean, it's all right, it could be better. Um, but that's just to show you, you know, what it could do. There's some limitations, of course. Uh, let's see, let's Refresh that. Yeah, let me know if there's anything else you wanna you wanna check it out from here. Cool, cool, cool. Well, let's just go ahead and ask because I'm spending tokens actually when I'm doing this. So. So it's charging me from OpenAI. Let's just ask maybe OpenAI to come up with some, come up with some image prompts. Happy news with images. It should give us like examples of prompts that we could just kind of get and use, and so we can see what images we can get out of it. So it's gone through. So it's— we have one here suggesting cosmic geometric garden, frozen dreamscape, dreamy surreal landscape, uh, let's see, galactic opera house, city nightscape, celestial garden. All right, let's try this garden. Why not? Paste that in here. Damn, that's too long. All right, just put that. All right. Visualize an otherworldly garden floating in the depths of space, bioluminescent plants and shimmering waterfalls, cascades, and orbs set against the backdrop of swirling nebula and star. Clusters. This scene combines elements of fantasy with cosmic wonder. Okay, I mean, pretty good. It's all right. I mean, to be honest, it could be better. It's just not realistic because if you're in space, it's just a vacuum. This water won't be flowing like that. I mean Just physics of it just doesn't make sense. Underwater ruins, galactic opera. Let me just tell it to make more realistic prompts that are concise and not dreamy or futuristic. So I just want like some, some normal images. I want some weird dreamy ones that I'm not even sure how that looks like. So it's come up with some stuff. So rustic kitchen interior. Uh, cool, that makes sense. Let's, let's put that in here. All right, so what do we have here? A well-lit traditional farmhouse kitchen with wooden countertops, vintage utensils, everyday objects arranged neatly. Yeah, that should be something that we, you know, you can already picture in your mind, but let's see what it generates. Okay, a well-lit traditional farmhouse kitchen with wooden countertops, vintage utensils, and everyday objects arranged neatly. So There you go. I think that's pretty good. Should I say pretty neat? So yeah, I mean, that's pretty realistic. If you had to show me this, I don't know how I would pick apart that's not an AI-generated image, especially like if you look at the background there on like that, um, kitchen section. I forget what the name— what the name of that place is called. I, I, I— it's just slipped my mind. But you can see that reflection, right? Oh, the backsplash, I guess. So you can see the image reflection, like that's just minor details that really matter a lot. I guess the weird thing is just like, it's just like 2 knobs for this door, which just doesn't make sense. That's probably what would kind of break this. And also that the window looks a little funny, but that's one example. Let's go look at another one. So park bench portrait, coastal harbor view, mountain. Good. Local farmers market, classic car detail, city street in rain. Let's try this. A busy urban street on a rainy day with pedestrians, cars, and wet pavement reflecting streetlights. Let's, let's do that. Let's generate this one. All right, I think I'm gonna do this as the last one and then gonna move on to some of the other stuff that I was planning to do today. But yeah, let's see what this does since none of you want to add it in the chat so I can generate it for you. But it's fine, no pressure. So it should be a busy urban street on a rainy day with pedestrian cars and wet pavement reflecting streetlights. So yeah, you can see the reflections. It's wet, people are walking around. I mean, that's kind of quite a hell of a lot of people wearing black and walking in the middle of the street. Don't make no sense. So I guess it makes sense a little bit depending on where this city is because I didn't specify where, but it's just weird that a bunch of people working on the road, you know, casually with a bunch of black umbrellas. Just a coincidence that you have all of them doing that. All right, cool. Let's, let's try something like a movie poster. Um, old school. Contrasting colors. Let's try that. Let's see what that gives us. Cool. Well, it did something. Um, some weird spaghetti words in here that don't mean nothing. And yeah, I guess, I guess that's old school, right? Not bad, not bad. Well, if nobody has any prompts that you want me to kind of try it out and generate an image for, that's cool. I'm going to proceed forward and kind of look at some of the stuff that I was planning on doing today. So what I wanted to do a little bit today was play around with building AI agents that can automate my Gmail account. So that's the goal. Um, and I know here, let's see, I'm gonna need to revoke a bunch of these API keys because I just exposed it to all of you to look at. And let's see, yeah, so I already exposed a bunch of this, so I'm gonna need to undo all that. Hey, hey, PB Alexis! Someone is now following. Thank you for the follow, appreciate that. Cool. So my goal is to be doing more of this, like more of this type of like streams going forward, because I don't think I've been doing them in the past, and I started this past week. Uh, I do a bunch of YouTube but not live, live streams, and I think a lot of people could benefit from it regardless. So, um, Let's see, get that piece. So I'm using Compose here. If, uh, if you're not familiar with Compose, Compose allows you to essentially— what it does is it has a bunch of tools that AI agents can use, and you can think of tools and AI agents as, you know, human beings, we are, you know, if you look at a company, for example, and maybe you've heard about AI agents out there, but you're not even sure what it is. So AI agents, uh, in essence is more of like digital entities that can do a unit of work given a task and use specific tools to accomplish that, that specific task. So it's like just human beings. You're at work or you own a business. There's people that work under you. Of course, there's departments within that company. Let's say there's You know, there's marketing, there's engineering, there's sales, all these different departments. And for all those departments, there's individuals working on those departments, right? So you have, for example, if it's engineering, you have software engineers, you have data scientists, data engineers, all of them, name them. And then what happens within those departments is each and every one of those individuals has a job description. They have more like KPI, key performance indicators. And they have tools that they use to get the job done. So things like a laptop, they need a laptop, they need, I don't know, access to the internet at work, for example. And so AI agents are the same thing. If you think of them, they're just, they're digital entities themselves. It's just like the human. They need tools to do the job. They need a task, which you just kind of give it a description of what it needs to do and then what's expected out of it. And then it does it given those elements. So that's exactly what this is about. So just so you get a background view on what AI agents are. So in this case, what I'm trying to do is build agents that can kind of manage my Gmail account. So my Gmail accounts, one of them is terrible because I don't use it as much, but it's just spammed a lot and it has like over 3,000 emails over time that I haven't read. I'm sure some of you watching this probably have like over 20,000 or not. But maybe just me, but that's just a good example. And you can have agents kind of go through all that and figure out which ones are important, which ones are just junk and categorize them and generate responses for some of the ones that are important. So that way my job is to just go to the drafts and look at the ones that it said it's important. Look at what it generated as a response. And I'm like, okay, this looks good. Maybe add a few context and just send it. So I don't want to give it the full right to send it for me. 'Cause I wanna review it before he sends it. But the big thing is I wanted to identify, I have a YouTube channel, so I just wanted to identify like specifically what are the collaboration opportunities maybe that some people have emailed me in the past, but I've just never seen it. And I could just kind of restart those conversations, especially if they're really promising. So the agents themselves can have access to all my, like the contents of the email, right? The body of the email. And you can read through that and figure out, is this an important collaboration opportunity? Did they mention specific details? And like from that determine how to rank which ones are like the most important to the least important. That's the goal. Um, so getting the point where we're getting too lazy, right? We don't wanna, we don't wanna do nothing. So that's where we, that's where I'm heading with this. Uh, but let me see here. So I might need to drop early today, but We've got some stuff happening, but let's see. Let's see how far I can go with this without without having to leave yet. I gotta import crew AI. Gotta install, and I want to install this. Quietly so that way it doesn't print a lot of logs on my screen. And if we go out here, Quick Start, Compose, Compose, Compose, Compose, Basic Concepts, Basic Concepts, Tools. Let me just add some more here. Composio. Okay, I'm back for a second. I think I'm gonna have to leave in a few minutes here. Um, got something else to do, but the goal of it— let's see if it, if it did anything anyways to begin with. So let's close that. So it did something. I just need to have my API key in there. And I've saved all of them here, but I don't have one here for Composeo API. Yeah, forgot to mute my, my stream there. All right, so I think I deleted the API key, so let me go grab it again. Cool. Now what I need to do is get this because I'll need that to call that to get, I guess, to get the API key from, from the space there. And I'm going to add this API key under here. So I'm just going to say compose your API key. Just copy this and pass it in here so that way we know what we are getting from the key over there. And then in here we're just passing in the same now since we got the API key from there. So if we click that, we should see some authorization if we are authorized. So actions cache is outdated, refreshing cache. So yeah, it's refreshing the cache. So cache is just, I guess, return empty on there. Cool. Now let me create a new connection. Let's see what I'm gonna get. All right, and I got something, so it worked. So I've authenticated. And if I click on this, it should take me to my Google account, which I want to authenticate. For this case, let me use this. Sign in. In this, this section, I'm just allowing it to access my Gmail essentially so it can retrieve the emails. Cool. But anyways, once All right, okay, I'm back. So let me try and find a way to extract some emails from Gmail, right? So let me check because that's the main thing here. How do we get the emails? And that's just the email flow. How do we get the emails from there and add it? I have that echo there coming on. So we've already fetched everything that we need there. We've authenticated. Now the next step would be to get— so instantiate connection. And I'm looking through the documentation. Let me just You can see what I'm looking at. I'm looking at the, the code or the documentation from Compose. I'm trying to figure out, um, where I can get this. So how it looks like. All right, I've already done that. So get specific connected accounts. I mean, I've already got the account that I need. The next step would be to get some of the data that I need to get. From— that will have my information. I don't want to expose that. Okay, now just make sure I got everything that I need there. And Composio, what they do is, if you're not familiar with Composio, what they do is just essentially they, they built all the tools. And this is what the company, the entire company is based out of. It's a company that built all the tools that agents would need to access or to use to do tasks. Have an AI agent, for example. And I think I moved something in my capture, so I need to fit the screen again. So what they do is they have— they built like a bunch of tools that you can use to connect your agents, because instead of like writing custom code each time you want to use your agent to connect somewhere, you can just use one of the tools that they already have for you. So, and in this, in this case, you have A bunch, a bunch of tools I can show you. Hold on. So let's see. So they have so many tools. If we go to tools, so use tools, they have so many tools. And I want to go to the section that they have tools. So you can build your own tool, but they have specific tools that you can use. Um, let's see what tools they have. Quickstart with tools. All right, here there's 250 tools that you could use. Um, so for example, they have Gmail, of course, the one that I'm going to be using. And then they have so many others that are like connecting to GitHub if you want to like maybe get some of your repos. And let me see, let me just look up here. Close your— right here, tools. Yeah, if you go to tools, we should see all of them. So here there's GitHub, Jira, SendGrid, PostHog. I mean, that's just a lot, but let's just go like through the categories. They have AI machine learning tool that you could use. They have analytics and data, so you can connect to like CRMs or databases. So you can see Snowflake there, Exa, Tivoli, and so many others. Um, Google BigQuery as well. Then you have collaboration. These are things like Gmail, Microsoft Teams, Zoom, Webex. Who uses Webex anyways? Interesting. But CRM, design, things like Webflow, Figma, Adobe Canva. And these are like things you can give the agents as a tool. So if you build an agent and you want it to do something for you, and maybe you want it to generate, I don't know, an image for birthday or something, you can connect it to something like Canva or Figma and have it create a, I don't know, a design there. Or if you already have a design for like a website on like something like Figma, connect an agent to get that design, maybe the code for it, and then have another agent generate the code for that to build that specific app that you've already generated a design for. Um, so a lot of options there. But anyways, instead of getting derailed, let me move back and try to generate my, uh, my code here. So Uh, let's see, Gmail agent. And let's go back to our code. Looking at this, I probably should have created just a different folder for, for the agent itself. Let's go back. I would need to install CrewAI first of all, so let me try that. So I actually work at CrewAI, so if you're wondering why I'm using CrewAI, CrewAI, it allows you to build AI agents. It's a framework and it allows you to build AI agents. Um, we're, we're more of like a vertical agent builder. So you probably heard about like AI agents for farming, AI agents for finance, AI agents for, I mean, so many use cases. We provide you like with a base that you can build any AI agents on top of. We don't, we're not like very agnostic to like specific, well, we are agnostic in a sense. And then here, what we need to do with CrewAI, we want to import once it's done. From cuai import LLM. Let me start with agent task process LLM. And these are just like the basic bare bones of what I need to start an agent. Um, but let's see what we get. This time. Yeah, I think those are the main ones that I need. Um, compose your toolset. So we have everything that we need from CrewAI. Let's see, we have everything we need from CrewAI. Yeah, if you come here to CrewAI, we should have What we need, so it still uses bank chain. All right, I gotta drop, but it's— I'll continue this maybe later tonight or tomorrow. I don't have much time right now. There's something I gotta go take care of, but this is just kind of like a simple idea of what I wanted to build today. So this is something that I probably will continue to build. All right, I'm gonna go ahead and end the stream. Um, hopefully tomorrow I'll try to find something sometime during the day at work because I mean it's my job anyways to stream and do more of this. If you have any specific topics in mind, like feel free to let me know. You want to learn about AI, happy to, happy to do more of this more frequently. So, but anyway, see you again and thank you for coming on the show. Thank you.
More from Tony

Summarize Videos and Research Companies with CrewAI + Gemini Models [Quickstart Guide]

How to Make Your AI Agents More Reliable with CrewAI Task Guardrails (Step-by-Step Tutorial)








