Livestream: YouTube to LinkedIn Post Agent

In this livestream, Tony Kipkemboi, Developer Relations lead at CrewAI, walks through building an end‑to‑end autonomous agent pipeline that takes a YouTube video URL, uses Google Gemini’s multimodal capabilities to analyze and summarize the video, then generates a LinkedIn post and publishes it automatically via Arcade’s LinkedIn tool. He demonstrates the full development workflow: setting up environment variables, creating a custom Gemini video‑analysis tool, wiring it into CrewAI agents, defining two agents (Video Summarizer and LinkedIn Publisher) with roles, goals, backstories, and tools, constructing tasks with context passing and output specifications, assembling them into a sequential Crew, and executing the crew with user‑provided URL and posting goal. He also discusses practical considerations such as model selection (Gemini Flash vs GPT‑4o), context window limits, prompt engineering, fine‑tuning or embedding personal writing style for better post quality, handling authentication flows, and the importance of human‑in‑the‑loop to guard against prompt injection. The demo culminates in a live LinkedIn post generated from a recent TEDxBoston talk by Dharmesh Shah, showcasing the system’s capabilities and highlighting future extensions like local LLMs (Ollama) and custom LLM wrappers.
Chapters
Okay, I am live, I believe, at this point. And if you're joining for the first time, or you've landed into my site for the first time, or looking at my profile for the first time, my name is Tony and I lead developer relations at CrewAI. This is running on my personal channels, but it's something that I also like doing. It's related to work, but also something fun on the side to help people learn about agents and what's new really in the space as well and some of the stuff you can build with it. So what I'm going to be building today, and this is a really chill session if you like to think of it that way, and no pressure on this session. So if you have any questions, feel free to text me or put in the chat somewhere. I'll be able to see it. I'm using riverside.fm. It's a software that allows you to basically stream on so many different platforms. So right now I'm experimenting with it for the first time. And I think I'm streaming, I'm live on LinkedIn, YouTube, X, Facebook, and Twitch. Pending confirmation later on how they performed in terms of just the bandwidth and how everything, if it was smooth or whatever. That will be after the fact of me after having recorded it. This, but yeah, thank you all again for joining. This is a really just fun session. So if you have any questions, feel free to put in the chat. I'll try to address most of them after or during the chat as well. So I have my chat section here live. So I don't know which ones it streams live. If not, you know, I'll be able to see it after. Anyway, so this is supposed to be a really chill, laid-back event. So I'm going to start by sharing my screen and tell you exactly what I'm going to be working on, at least for this session. So let me go ahead and share my screen. Boom, there you go. So I'm using Cursor. If you're if you're looking and you're wondering, I'm using Cursor. And what are you seeing on the screen right now is just a bunch of like an example environment variable where I just gotta store all my API keys for this project. And going back to talking about what this project is about, so I decided that. That maybe I should livestream some portion of doing something here that I usually do manually in a sense, but I figured there probably is a better way to do this. But at the same time, it's not revolutionary. It's very kind of glued together example that I'm working on here. It's definitely gonna lead to something. And I'm sure there's platforms that are already implementing this. But the goal of this livestream is really to show how you can take a YouTube link for a specific video. So sometimes maybe you watch a tutorial or you watch a talk at the conference or something of the sort. And maybe you want to write a LinkedIn post about that, the content of that talk or podcast or whatever, right? But usually you would have to, I mean, in the past before even AI and all this stuff, you probably would have had to download the transcript using the YouTube API. And then once you have the transcript, you go read through it and then summarize it and then write up I need to LinkedIn post about it, right? Well, there might be a better way now with AI because with Gemini models, you can actually give it a YouTube link. It's going to look at the video. It's going to because it's multimodal. It can read the transcript and also look at the video and see what's being presented on the screen and provide a summary of exactly what's happening. For example, a good example is you could take maybe from a few years ago when AI was not being mentioned a lot, but then things like Google I/O, for example, when the CEO is up there presenting about whatever the new features they have. I think there was an interesting time when people were wondering how many times will they mention AI. So Gemini can do that. You can just give it the YouTube link and tell it, hey, look at this video, find all the instances where AI is mentioned and also return the context around the mention of that what AI within the entire video with the timestamps as well. And it's going to go through the entire video, bring back or give you a list of all the timestamps and when AI was mentioned and what the context surrounding that was. So that's very interesting that you can do that already with the Gemini API. So I thought, okay, I can give it a YouTube link. It can summarize it, give me a detailed analysis of what actually happened in the video. Then I can have another agent that takes that entire summary. And from that summary, it tries to generate the insights and figure out exactly what's important in this piece of summary from this video and generate a LinkedIn post that then would usually in the past, I would just copy that, paste it to my LinkedIn and boom, it's live. But what about if we just glue the entire thing together, just passing the YouTube video, link, summarize it, generate a LinkedIn post, and then actually post it on LinkedIn, right? Like immediately. And the last piece of being able to post directly to LinkedIn is where is the fun part as well. So there's a company called, startup called Arcade.dev. If you've never heard of them, they're building a lot of really interesting stuff with agent tools and also authentication, even with MCP. So if you're kind of trying to learn about MCP and Especially on the security aspects of authentication, I highly suggest you checking out their blogs and their content on YouTube. I think they're doing a pretty good job in tackling how to authenticate to MCP servers correctly or what the right way looks like and actually building that piece as well. So today we won't be using the MCP server they're working on, which is going to be the just you know straight all authentication piece directly to to be able to use that. So let's go ahead and get started. So and this .env example. I'm just showing you the example. My real ones are actually in this .env. I'm not going to open that because I don't want you all copying my secret keys and then spending most of my money in there. So let's go here and kind of do demo.py. And this is what my file will have, what we'll start building here in a second. So the first section that we want to start with, first of all, is of course just importing all the imports that we'll need. So of course we're going to need os for most of the keys. So I'm just going to do import os. And for the framework that helps orchestration, I'm just going to use CrewAI in this case. And I work at CrewAI, so makes sense as well to orchestrate. So this will be a one-script type of thing. So it won't be anything too crazy. And then let's just do from typing import Any. And this is something that we'll use in a second here as well. These are just standard. And then so when we get to the most important ones here, so from CrewAI, I want to import all this, which is just it's suggesting a lot of stuff that I don't need. So here, Crew AI import agent task crew. I also want to import process, which is how do I want my agents to run? Do you want them sequential hierarchical? It's going to be sequential. Just you know, bursting bubble early. And then we're going to need to create a tool. So from Crew AI, and the tool itself is the. Is the Gemini API, wrapping the Gemini API as a tool that then you just give it the video URL and a prompt of what you want the Gemini model to do with the video. And then it generates whatever transcript or you want it to generate to find all the AI mentions. It does that. So we want to create that as a tool that then our agents can use that as a tool to pass in the prompt and pass in the video that we give it to generate the video, to generate the summary and all the detailed information that then they can pass it to another agent to do the final generation of the post and then posting it straight to LinkedIn. So that's the gist of this. And with CrewAI, you can create custom tools. And this is what we're doing here. So from here, I just want to import tool. And there's a better way. There's a different, not a better way, but there's different ways of building CrewAI tools. This is the more, I'm just going to be using a decorator, add tool decorator to kind of build this tool in this case. So from also CrewAI Arcade, and this is where Arcade comes in, they have an integration with CrewAI. What we want to do here is import their ArcadeToolManager. I can't spell ArcadeTool here today. So ArcadeToolManager. And then finally from google.genai, Import. We want to import types and clients, and this is really to access the Gemini model and be able to do stuff with it. So import types and then the clients. Cool. So we're done with the imports. Now the next piece here that we want to start with is let's start with first of all bringing in all the API keys that I already saved. Saved in my environment here. So let's just say get API keys. Yeah, there you go. So it's already doing it. Do I want to get all of them that way? It's kind of doing a little bit of too much stuff here that I wanted to do. So thank you, cursor, but I don't want to do it that way. So I'm just going to mention all of them at once. So Gemini API key, and then I want Arcade. Okay, API key and then OpenAI. It's trying to help me out, but I want it to do whatever it's doing. It's trying to do a little too much. So I'm just going to skip. So it's already imported all the API keys that we're going to need in this case. Now the next stage is building the Gemini tool around video analyzer. We're going to go with Gemini video analyzer tool that we can be able then to use. in this case to analyze our video. So we start off first with @tool because we've imported the tool up here from create tools. Now the next step, once we've done that, we want to create a function that then analyzes the video. And what I'm going to call it is analyze video. You want to name your variables or your functions an easy way to understand that it's just easy and direct. So video URL, it's suggesting stuff here. Not bad. But in this case, let me just call URI. And this will be a string that we pass in, which is the link. And then let's do prompt, which is also going to be a string of what you want to be done with With the string that you brought in. So here it's suggesting stuff as well. Sure, but let's delete all this up to this point. So analyze video and return summary of the content. I like that piece. So now, first of all, the first thing from the tool is I just want to check that if there's no Gemini API key, just kind of don't even bother doing anything. Yeah. So if And again, it's doing a bit of too much here. We don't want to do that. So first here, what it's just doing is just checking if the Gemini API key is set. If it's not, it just returns an error. Hey, and instead of that, I just want to put it as not ValueError, but more of a runtime error that I want to return here. Runtime error. And these are just table stakes of what you can have. Now it's suggesting initializing the Gemini client, which is the correct step to do. So now bring in the client and client and passing the API key that we've already brought in from Gemini. And the next step is just creating the response. So I'm just going to call it response and client generate content. No, that's not correct. So Client, and we want to call models.generate_content. That is correct. And model here, it's doing the correct thing. Gemini 2.0 Flash, that's what we're going to use. But in front of it, you need to have models. So we're going to be using Gemini 2.0 Flash. And the reason for that as well, it has a bigger context window. So it helps a lot with longer videos. I haven't fully experimented with all of them to figure out, because if you pass in, I would assume like a 3-hour video, it might just break because it just can't consume the entire thing. It's a token thing. So if the tokens exceed that, then it just kind of breaks. There's a token limit for each of the models. So you want to figure out, you want to make sure that you have the right length. Of course, you can implement like chunking on top of that, but that's a bit advanced if you're trying to do some sort of that as well. So with content, it kind of got something right here, but it got that wrong. So contents, I wanna bring the types. And then we create this piece and these parts, which you pass in a list. And then the first type parts that you wanna pass in, is the prompt that we want to pass in with the video. So the prompt will be something that we'll be able to handle later. So the agent will be able to pass this based on our input. And this will be the prompt for the video. So what do you want the model to do with the video essentially? This is what it's saying right here. So for this section, the next types part here is the file Reader, and I think this has got this one wrong. So this is the file data, and we're just going to pass in types dot file data, file URI, and then the video URI. So which we've already instantiated up here. So now we are pretty much done with that. So the next step here would be, let's check and see. So yeah, we're done with the tool. So this is the entire tool that will handle the passing of the YouTube video. So as you see, we'll pass the YouTube video there and the prompt and it will process it and return the final response as text, basically the summary of the video or whatever you want. The prompt here is going to vary. You might just say, I want all the AI mentioned. I want a summary of the entire video. It's going to depend on what you actually instruct the agent to do. And the agent will kind of restructure your question or generate a prompt that will just pass in directly there with the link that you've already given it. And it passes in there. Once it generates the final text response, then that then gets passed to the agent. And the agent kind of handles that piece for itself. Now, the next portion is now handling the— Arcade piece. And Arcade has already provided code for this, so I don't need to reinvent any of this piece. And I'm just gonna copy that and save us time going about trying to fix this ourselves. So from here, we just create another function and I'm just gonna walk you through what it does. I'm gonna need a user ID. I don't have a user ID. So here I can add the user ID up here. For now, I'm going to do it as this, but I think what I want to do is add it to my environment variables. So user ID, user ID, and for user ID also, I'm just going to pause or I'm going to take off screen share so I can add that ID, which is my email in this case. So I don't want you to see that. So I'm going to stop sharing. And then I'm going to go to my environment variables and add another user ID variable and add my email there. Let's see. Cool. Now that is done. I can reshare my page. So you can see exactly what's going on. Cool. So I've added that in there. And now if we come down here, the user ID should already be instantiated up here. So we are good. I don't need to add it anywhere else. So that's already inherited from up there. So what this does with this custom auth flow, so they do provide a way for you to just kind of, I mean, to authenticate to LinkedIn. Typically, if you, If you like, I guess just to kind of summarize this, I know I'm doing it at a very high level, just kind of saying what it does. But if you want to dig into more, their documentations are also really great. And I'll share that here after we've kind of gone through this piece as well. But what it does here, it just creates a custom authentication flow for— that's why you're inheriting from the OK Tool Manager. And essentially it's saying here, you want to log into your LinkedIn, you want to post something on LinkedIn. We have a tool that helps you just post text to LinkedIn. So to do that, you need to log into your account. So they handle the authentication on the hood for you. All you need to do is when you add all this code in here and run it, when the agent starts running, and you'll see when we start running the agent, once it's ready to post to LinkedIn, it will give me a link and tell me, can you go authenticate to your LinkedIn account? And basically when I click on that link, it sends me to LinkedIn and says, enter your password and email. Or your email and password and then authorize. And if it's authorized, then it can just now post on my behalf. It just uses YouTube API under the hood that they have access to and already built that piece out for us. And so that's what it does handling there. And then this tool executor basically just kind of grabs back what it's already kind of finished from the authentication flow as well. So that is the big chunk of Arcade. And I think this is where the magic happens is really the Arcade piece once Everything is done. I think it's the biggest magic of most moments are summarizing the video and then posting to LinkedIn. So that is pretty cool by itself. So we're done with that piece. The next piece now is the Crew AI portion. So let me actually add a comment here. So this is the arcade piece. Arcade LinkedIn. LinkedIn tool. And if you want to check them out, go to arcade.dev. Boom, there you go. And this portion right here is Gemini tool. And to check them out, go to Gemini and get your API key from there. So you should get your API keys from all these providers that I've mentioned here. And finally, let's get to the Crew AI portion. So this is the Crew AI agents. And if you want to check us out, you can go to crewai.com. Now let's create the agents. Now the biggest part here we want to start first is the LLM. So we want to figure out the LLM for our agents. And each agent within Crew AI can actually have its own LLM. So you can add a given LLM to a crew based on— and I think there's a strategy also for picking an LLM and we've added that also to our— oh, thank you, Arcade. I see you in the chat. Thank you for the shout out. Yes, with CrewAI, you can assign an LLM to each agent. So usually what I like prescribing a lot is for each agent, think of it as a human working in your organization. Everybody within your team has different capabilities, right? So you don't want to assign somebody that's really good at software engineering to do something like marketing or sales. They might not be the best at it. So same thing with agents. If you have an agent that does video summary, for example, this case, we have an agent that does video summary. If you don't use Gemini to do that, if you just use something like OpenAI, it's just not going to work. So same thing with the agents. You look at the task that you want the agent to do and figure out which Which LLM is best suited for that specific job? If you're just writing a like an essay or something like that, maybe you want to use something like Cloud Opus, right? If you wanted to code, then you might want to use Cloud Sonnet Four or Gemini 2.5 Pro or something like that, right? So the better the model is suited for the job, you want to put that basically the brain because the LLM here is the brain of the agent. You want to give it the right brain to do the right job. Otherwise, you just get You just get work done, but it won't be quality work in a sense. And there's also kind of order of effects here as well, things like cost as well. So sometimes you might want to use a model that is low in cost. For example, if you just want to summarize some specific aspect of it, you don't need a powerful model to do that. You could just use any open source model and it might just do great. Of course, you have to consider things like context window and things like that when you're passing in a specific given amount of chunk of text to a model that maybe has a very small context window. But yeah, to come here, what we want to set up is just setting up the LLM. So that's the first step. So I'm just going to put here, set up LLM. And the LLM we're going to set up here is, all right, so you want to try to run ahead here and do stuff. So the model here, I just want to use GPT-4o, not mini. 4o mini is cheap, which is great. And it does a lot of heavy lifting already. But in this case, I just want GPT-4o. Just it's a little better in this case. But I found yeah, I found four to be sometimes it writes it's very quirky. I write some stuff sometimes that I'm okay cool. It's very cheesy in a sense, which it's maybe that's what I want for LinkedIn, right? If it's writing a LinkedIn post. And now let's go ahead and set up the agents. And it's already kind of run ahead and done some stuff for me. But in this case, I just want to paste some of it because there's a lot of typing. To do here. So what I'm going to—you have to name these agents also pretty well. So the first agent here, I just want to call it video agent because this is the one that's going to take the video, and I'm just going to copy a piece of this that I already have preset somewhere here. Cool. Now I'm just going to walk you through what this means. So if you look through this, the video agent—the first—you have to give it a role because it needs to have a role. What does it do? So in this case, it's a video summarizer. And the goal of this video summarizer agent is to summarize a video given a YouTube URL. And the backstory of this agent is your helpful assistant that summarizes YouTube videos. So pretty plain and vanilla. We can amp it up a little bit by saying it has 20 years of experience in video summarization and all that to make it more— I don't know how much it helps, but I've found it to be pretty effective sometimes. Kind of matches itself. It says, if I have 20 years of experience, I'm expected to do work that reflects 20 years of experience, right? So it's a matter of prompting here as well. So try different versions of it to get a better answer. I would encourage you. But a cool thing here we're seeing is the tools. Under the tools, we've passed it the analyze video tool. So if you come up here, what we have, we have analyze video tool up here that we created using Gemini and we decorated it with tool. Decorated with it. So if you look at that, that's the one that we're going to be using here for this video agent to use. And we've set reasoning to true, max reasoning attempts to verbose true. LLM is the LLM that we're going to use here as well to do this job right here. The LLM here in this case is the one that's just coordinating things that are happening with this agent, generating the first prompt. For example, even the reasoning piece is going to help with reasoning and finding the attempts and actually finally running the agent itself. And one thing I just realized when I was perusing over here, I realized I didn't set the name of the agent here, of the tool. So it's simple as just saying Gemini Video Analyzer. There you go. So that's just a random thing that we want to add in there for the tool. Now we've created the first agent and I'm going to just add the rest of them here, which is only 2 agents in this case because it's a very simple thing. I just have one agent that summarizes it. Or just creates the transcripts. And then the other agent, basically the job of it is to post to LinkedIn. So, all right, never mind. I did that wrong. There you go. Cool. So this second agent is LinkedIn Publisher. And the goal is publish content on LinkedIn. And then the backstory of it is your helpful assistant that summarizes and publishes content on LinkedIn, to LinkedIn, to LinkedIn or on LinkedIn. English is not my first language. So forgive me if I'm Butchering this. The LLM will understand and fix it for me anyways. So the tool that we're giving is the LinkedIn tool. And we're giving it that one tool that it has, which is just post on LinkedIn. And this is where we got it from here, from Arcade. And we're using that here. So reasoning as well too, max reasoning attempts. These are optional parameters. You can skip them if you want to. But I'm just adding there for the sake of it right at this point. Now let's go ahead and create the tasks. Because these agents, they're agents, right? They're bodies. Think of them as human bodies. Okay, so Simon, maybe at the end a small mention for changes, suggestions to use local models would be nicer. Awesome. Yeah, definitely. We'll do that at the end. So with tasks, and before we get to tasks, I just want to kind of preface if you're looking at this for the first time and you're wondering, okay, cool, all this is cool, but exactly I don't understand fully what the agent and all this stuff is about. So I usually like to use an analogy of a company. Maybe a marketing team in your company. Within marketing, you have different people that work in marketing. You have sales, you have product manager, or even engineering, right? You have software engineer, data scientist, data analyst, all these people within a department. They all work together to build a product in engineering, for example, right? You have product manager that orchestrates some of the stuff. But if you think of it that way, as an organization or as a department, within that department, all these different people with different roles, which the role comes in place here with agent. All these people with different roles have different tasks that they have to do. So humans in those departments are the agents. So those are the bodies. Think of them as the body. The body itself is the agent. And now the role of that body is usually when you apply for a role, you know, you're given a role within the company. You also have a goal, which is more like your job description. Why, you know, why are you here? What are you supposed to do? And then you have a backstory, which is your experience. Maybe you've worked at 10 companies before, you've worked at some other industry. So that's your experience that makes you better at this new role that you've been hired for. So for this case, this LinkedIn agent is a LinkedIn publisher, that's their job. And their goal is to really just publish content on LinkedIn. And their backstory is they're, they're a powerful, helpful assistant. But in case, you know, they post content on LinkedIn, we could have like, you know, spruced that up and say something like they've been posting content all for 20 years, they've worked at big multinational companies that are really good at engaging customers or something of the sort, depending on your goal for this agent, right? And then the tool here, I like to think of it, if you work at that organization, maybe as a software engineer, for example, like I mentioned in that engineering context, tools are the things you use to get your job done. So if you're an engineer, you probably have access to specific databases within your company. You have access to a laptop, you have access to so many Wi-Fi, so many, I mean, all these constitute tools that help you get your job done at the end of the day. So same way you would think about agents, if you wanted to do something, post on LinkedIn, they need to have a tool to do that. And that's why we have Arcade in there to help us with that. So this agent gets the summary, generates a summary of that post that it needs to post, and then finally uses the Arcade tool to actually post on LinkedIn. So hopefully that paints a picture of what agents in this case is about and what the task is about. So now we've finished building the body of the agent, the human in the company and the tools that they need to have. Now let's go back to the job description, which is the tasks. What are they supposed to do? And this is where we get into detail a bit more into what are the main roles. So I'm just going to paste this in here. So if you look here, we have the first task for the first agent, which the first agent we have here is the video agent. And if you look at their task here is they need to summarize a YouTube video given a YouTube URL. And we're passing this variable in here, URL, and the goal. That will then be interpolated when we go ahead and run the agent later. When we go down, we actually— an input box is going to pop up on our terminal saying, can you please enter URL that you have the YouTube video and also enter your goal for actually what do you want to be done with this video, right? Do you want it to be summarized? Do you want to get some specific aspects of the video? Whatever you want to do with the video. So that's why we're interpolating as that, which is very awesome. When the agent kind of ingests this, it ingests with the interpolated context with it. So it's able to just understand the full context of what you're trying to do here. And it's very important to do that. And then the agent that will do this task is the video agent. So we're saying, hey, this is the task to be done and you are going to do this task as a software engineer or as a video task editor in this case. And the expected output is a very detailed summary of the entire video. This is kind of KPIs. If you're a human working at a company, what is expected of you at the end of the quarter? You set the goals, you accomplish them at the end of the quarter, and you'll be graded against them. So with agents, that could be evals, right? That's the grading piece. And then you have markdown as true. So that means what I'm enforcing is saying, whenever you finish a task, I want your output to be in markdown. And then I wanted to save the final output of the summary into an output folder, which it will create automatically and save video_summary.md, which is markdown. The contents will be saved in there. And then for the LinkedIn task, for the LinkedIn agent, for the LinkedIn task, you were saying publish content to LinkedIn. And then the agent, of course, is the LinkedIn agent. Expected output is using the detailed summary of the video, generate a high-value LinkedIn post that covers the video's main points and optimizes for providing value to the audience based on the user's goal, and use the Arcade tool to post to LinkedIn. So Pretty explicit there. And important, I just told it important. Don't do generated posts. I didn't even define what a generated post is. This is just bare bones to just show you what's possible. You can actually go deeper and try to really optimize your prompts to be better. And this is where the important comes in. You can even give it one-shot examples of a good post that you want to post, for example. And I think that would probably do a bit better. And then optimize for user's goal. Which is the goal. And then don't use hashtags. In this case, I just don't want to use hashtags. And before you even ask, for this tool, it won't post images at the moment. I'm sure there's a way around that if you want to do it. But I think for now, this will just post text directly to LinkedIn. At the end of the post, include a short or a note that says this post was generated by a CrewAI agent. Yes. So I can actually add an emoji here. And where's the robot one? There you go. Yeah. So here I'm just saying at the end, just add this post was generated by a Korea agent. Just when somebody is reading it. And this is for test purposes. I'll probably delete that post eventually. But for when we do the demo, but I'm actually just leave that up. Yeah, why not? So that's it. And then the context. Right now everybody's talking about context within AI agents, right? Context is everything. And I agree. Without our memories as humans, we would also not be great at what we do. You probably would have forgotten everything that I've just mentioned since we started. So memory is very important, and context is also very important. And I would like even to extend that and say most of the disagreements we have as humans usually are because of context. We don't have the full context of what was done before that made us angry or something of the sort, right? So if you can relate, you know, it's what it is. But context here, we're saying for this task, we wanted to get the context from the video task. So the video task here is the one that generates the summary. So we want this agent to use the context from this first task that was done to actually do its job as well. So if we had other tasks down here, we can just keep adding it because it's a list. We just keep adding context for each of them all the way down to the last one. So you also have to keep in mind that if you're doing this for other maybe agents and tasks that you have down here, You want to be mindful of the LLM's context window because then it might just overrun it. We have a way to mitigate that by compressing or doing a summary. We just take basically the entire context and do a summary of that context to squish it down a bit more and then pass in more optimized. It does that automatically, but it could just take a while and it might miss some important context as well. The best recommendation for me is just use a model with a bigger context window there to help out a bit, which Gemini models are pretty good at as well. Now to the last piece here. So we've created our agents, we've created our tasks. How do we put them together to work actually to get stuff done? So we need to put them in a crew and this is where we do it. So we have a crew class here where we have agents, task, process, and verbose. So starting with agents, agents, you just create a list and pass in the list of all your agents that you've built. So in our case, we have video agent and a LinkedIn agent. That's all we have. If we had more, Would have added them in there. Same thing with tasks. We just get all the tasks, throw them into that list, and then we go to process. How do we want to run these agents? We want to run them sequentially, hierarchically. We just want to run them sequentially because video processing has to be finished first, generating summary before the LinkedIn agent does create a post and actually post it on LinkedIn. It's a sequential process. If it was something like a research type of thing, then we might just run them hierarchically where one agent kind of delegates down to specific agents to do specific. specific things and then finally aggregates the output and returns final output. So for now we want our sequential. So that's good. And then verbose true just means, hey, whatever you're doing, just output it in the terminal so I can see exactly what you're running and what you're doing. So that's all it is. And we've also set that also for the agents as well as verbose. So we want to know what the agents are doing when they run. Now the big piece is done. The last piece here that we need to do is just actually run the agent. And how do we run this agent? So if you come down here, we just need to add the kickoff. And this is from crew as well. So run the crew. And this is a simple way to do it here as well is just run the crew. You do result equals to crew.kickoff. And then within the kickoff, there's an input parameter that basically takes in a dictionary. And in this case, the dictionary of inputs that we give in the agent, in this case URL, remember? Variables we interpolated on the agent up here, the URL and the goal. So here's where we do it. So URL, it will just ask the user on the terminal, hey, enter YouTube URL. And then finally the goal, enter desired goal, LinkedIn, you know, for the LinkedIn post, or what do you want the video— what do you want to be extracted from the video in this case. So that's all it is. Now let's go ahead and run this agent. But before we run it, of course, we have to create a virtual environment and all that good stuff. I use uv, so you can just do uvenv. It'll create a virtual environment and we need to activate it. So if you're on a Mac, source .venv/bin, and then activate, and you're live. Now we need to install the dependencies that we've created here. So if you see up here, we have a couple dependencies that we need to install. So we need to add UV, and let's go ahead and do that here, which is pretty straightforward as well. I'm just going to give you this in a second. My screen is freezing. Let's see if it's going to unlock that. Okay, there you go. Cool. So UV pip install, and UV is pretty fast at installing packages. So if you're using— if you're still just using regular old pip, I really encourage you to move over to UE. So we install CrewAI and then CrewAI Tools because we'll need the tools. And then let's do CrewAI Arcade because we'll need that. And then we need Google OpenAI— not OpenAI, Google GenAI. All right, I think I got all of them. Now that will install in a few seconds. And this should resolve once we do that. All right, cool. Now we should be ready. So it should take a minute or a second there really. Boom, and they resolved. There's no more of those squiggly lines under them. So we're good to go. So the next step for me is really to find a YouTube video and run it. So Before we do that, let me just go find a YouTube video and I'm going to share with you what YouTube video I actually pick. So if you have any as well, just suggest on the timeline. Happy to post that. If you want to put it in the chat, send me a video that you want me to post about on YouTube, on my own LinkedIn channel. Happy to do that. I'll give you all like maybe 30 seconds. If not, I'll just get one myself. Cool. Yeah, and feel free to chat and ask me any questions in the chat. We'll be handling those in a few minutes once we're done running this experiment. All right, I see nobody's volunteering, so let me find a video. I think one cool one that was done recently was, I don't know if y'all follow Dharmesh, the CTO of HubSpot. He did a TEDx talk not so long ago. I think a few days ago. Actually, let me share that screen here so you can see which one I'm picking. So here it is. I think he did a TEDx talk in Boston, TEDx Boston, I believe, like 6 days ago or something of the sort, or even a few days more than that. And I remember him mentioning leading up prior to that, that You know, what tips and tricks do people when they're preparing for TEDx? And it was interesting. So I just want to— I haven't watched his video, but I want to see what he talked about. So I'll stop sharing that now. And since I've copied the URL, now let's go back to our project and actually paste that in. Let's see. All right, share project. All right, cool. Now let's go ahead and run our crew first. So Python, Python 3, and we want to do demo.py. Let's run that. It should take a minute. All right, enter the URL. I'm going to paste the URL. That's the one I copied from the YouTube video. And the desired LinkedIn post description. I don't know what he talked about, but the video says how to compete with AI and win. So maybe share the main insights. The Dharmesh Shah shared in his recent TEDxBoston talk and include Auction items that he mentioned. That he mentioned really? Yeah, that he mentioned. Why not? Now let's run that. It started, it's kicked off. The agent execution has started. You should see the first agent here running already. It's going to take that URL and our description. And that agent is going to give that to the Gemini tool that we built. And you can see here it's reasoning and it created a reasoning first here of what it needs to do since we added reasoning as true. So reasoning plan, understand the task. Task is to summarize specific YouTube video focusing on the insights shared by Dharmesh Shah in his TEDxBoston talk. I'm expected to extract key points, particularly any action item he mentioned and compile a detailed summary. Summary. So that is what I'm talking about. Like the agent will take your intent and reason about it, make it even better than what I would've written and pass that to the tool, which the tool is just, and this is gonna take a minute to run 'cause it's still running 'cause it has to ingest that video into Gemini and generate the transcript and more of like the understanding visually of what he was presenting on stage instead of me watching the entire video. And then also factoring in what I just mentioned about what it needs to extract in terms of specific things you want to talk about. And then once it's done that, it should save that into an output folder here. And then once it's done that, it should also take that final output, which is just finished, which is great, and it's generated a video summary. So the video summary is complete. Now the cool part begins where It sends it to the LinkedIn agent. The LinkedIn agent now, its job is to look at that entire summary that is generated, the video summary, and generate a LinkedIn post out of that. And it should ask me to authenticate to my LinkedIn, which it's going to share a link here that I should be able to copy, paste into a browser, which should be in a moment here. If this is how the workflow should go, and if you want to use Arcade again, go to arcade.dev. I'm going to share the the screen later so you can see where to go. And here it is. Let's see. Okay, it actually went ahead and posted because I think earlier I had already authenticated. Ah, interesting. So it already posted to LinkedIn, and let's see if it did already. So it says final output: the LinkedIn post summarize that mesh shot has been successfully published. You can view the post here. If I hadn't authenticated, and actually let me just verify that that exists first of all, before I start yapping about it's already live and maybe it's not even live. So I'm going to open that. And actually I'm just going to share my screen so you can see. I'm not over here. Let's see. All right. There you go. It's live. So here's the post. So it says in his recent, so let's just read it in real time, right? In his recent TEDx Boston talk, Dharmesh Shah presented fascinating insights at the intersection of humanity and AI. So key insights, collaboration with AI. Shah sparked a debate on whether to compete with or collaborate with AI, with many seeing AI as a powerful tool. Adoration for AI augmenting human. I don't want to read the whole thing, but if you go to my LinkedIn, you probably will be able to find it. And the way you find my LinkedIn is just looking up my name, Tony Kipkemboi. And I should be the only one on there. If there's another one, you probably will see my profile there. You'll know who I am. But if you go to my posts, you should see as this is the recent post. And of course, at the bottom, it added what I had mentioned to it. This post was generated by a career agent. So it worked. And it didn't take that much code to do it. And is it— it's debatable. Is it the right way to do things? I think this is where things are going. People are not spending a lot of time trying to understand things, especially if the agents are already doing a better job at it. So you can already see you can automate a piece of your content daily value with this, which is very important. The other piece that I would say maybe that needs fine-tuning a bit is the post-creation piece. So here, just the key insights, and then it went to action items, which is great. Leverage AI, prepare for hybrid teams, be proactive, elevate tasks. Which is great. And of course the potential, let's see how it closed, of AI to not compete but enhance human endeavors, urging us all to embrace its empowering capabilities. So that was great. It's not in my voice, not in my style, which these are things you can already add into it. If you follow me, you probably know I like writing on lowercase letters all over the place. Don't ask me the reason why. I like it because For work stuff, I actually have to use the proper grammar and not proper grammar really, more like better writing or regular writing standards, right? Using capital letters in between. But for my own socials, my own my own stuff, I like writing in lowercase because it feels a bit more relaxed in a sense. It's just like the way I like to think about it is you woke up in the morning, you went to work. Now you just left work at five, you know, with your button-up t-shirt or shirt. Now you get home. The what what when when do you feel the relief is when you pull off that tie if you wear a tie for your for your job or you take off them shoes just relax on the couch and just relax. This is what I feel like when I write in lowercase. So that's my reasoning behind that. I didn't have to explain that, but you know, I just went there and explained it anyway. But coming back to the agents, I think it did a pretty decent job if you ask me. There's also, of course, ways to fine-tune this better, right? Like, you can actually give it samples of my writing or your writing or how you write your LinkedIn post. And you can actually— and this is something that I'll probably experiment with later on— is get a sample of my good LinkedIn posts that I've posted in the past and I've done really well and I've structured it in a nice way. And what I would do is just get those and maybe add them to knowledge. You have a knowledge folder in CrewAI. Basically what happens at the hood when you add a When you add a file, it could be a .txt file or .md file or all the examples of my LinkedIn posts. And what I can do with that is just it under the hood, it embeds it into ChromaDB. And so when the agent is creating the post, I just tell it, access this knowledge, which is all my embedded posts before that have done well and try to mimic that similar style that I used to create this post. And it should kind of mirror that and create a LinkedIn post that kind of looks more like my authentic voice, my authentic piece. To even go further, you can maybe fine-tune a small language model on your LinkedIn post or your style or something. So that's a bit extreme, right? But you can do that. And that, add that as the agent that actually does the generating the LinkedIn post and it would do better that way as well. So that's one strategy as well. One thing that I want to put on your mind, and I think this is something that's bubbling up recently as well. You've probably seen some of these posts on arXiv. If you're not familiar with arXiv, arXiv is where people post papers, arXiv.org. And I'm actually going to share this tab instead. So if you come to arXiv, people share a bunch of papers here. So usually if you come here and do AI agents, and search, you'll see all the papers that have been posted here recently. Most of them are not really peer-reviewed as much. It's just you write a paper, you post it interesting with some interesting results for the community to see. And one thing that has been coming up recently as well has been that people have been adding more of prompt injection in their papers. So ignore all, just as an example. I don't think that's the right keyword that I'm looking for. I think somebody posted a better one than me. Yeah, there's a prompt injection that is being added apparently to all the papers recently. And people are doing that so that it can mislead your agent or your LLM that's kind of scouring and reading all their papers. So it goes through the paper and as the agent is reading through the paper, it kind of misguides them based on that one fact, that prompt injection they've added in there. So that could be an issue if you have your agent maybe going and doing some stuff under the hood that it's not supposed to be doing, for example. Well, what did I just say there? I don't think that makes sense what I just said. But what I'm trying to say is if you have an agent that then reads a paper or even if a prompt maybe is injected in a video, because that's potentially going to happen. Somebody can just say a prompt injection script within the video. Will that just kind of hijack your agent now and mess everything up and post false content? There's a potential that that could happen. And so I think there's still a human in the loop aspect here that's very important that you have to go through over what your agent writes about, what the content it consumes is about. At least have an idea of like this content, it doesn't potentially has any prompt injection. There's already tools out there that can help with pre-filtering content before it gets passed to the agent or to the LLM in this case. But I think it's limited when you start exploring some of these use cases that we're doing right now. But going back to the question that somebody had asked, I think it was Sai, maybe at the end, a small mention for changes, suggestions to use local LLMs would be nice. Yes. With using local LLMs, it's pretty easy within CrewAI. So in this laptop, I don't have Ollama installed, but if you have something like Ollama installed, right? If you have Ollama installed, it's easy to just add it in here. So in this case, I would maybe just say it's like LLM and you can add so many LLMs here. I could just say LLM. And then for the model, you just add model. But for the— and let me just come here and do this. Makes it much easier if I do it this way. Bear with me a second while I find it. Yeah, let me just reshare this screen instead, which goes back to our docs on how to implement this. I like showing more than really telling as much. So if I had Ollama on my laptop, I would have done that. But if you come to our docs, we do have actually a section And I'll paste this in the chat as well if you want to explore this. Local models using Ollama. All right. I've added it to the chat if you want to experiment with that. So what this, if you, if we had this already, like Ollama already, and it kind of gives you an instruction there, you might be using VLLM or any other local inference provider or sense. So if you have here Ollama, and we're just going to use Ollama here in this example. Once you've already installed Ollama, you can just go ahead and pass this to your agent. You just create another LLM variable within your code like we did earlier with OpenAI. And then for the model piece, you just pass in Ollama in front of it. And then the model that you've pulled from Ollama to your local environment that you can then use. And I believe also with Ollama, if you have an model that maybe you fine-tuned yourself on your own data, on your own whatever specific thing, you can actually add that to Ollama. And then from there you can use that as an inference straight up here. Also, that aside, within Korea also, you also have a way to kind of create your own model wrapper. So for example, you fine-tune the model, it doesn't match with LightLM. We use LightLM under the hood. And we do have here, custom LLM implementation. So we do support custom LLM implementations. So if you've already fine-tuned your own local model, for example, and you want to actually use that within your agents, you can fine-tune your own model. And you just need to wrap that model that you fine-tuned, basically the weights you've downloaded, wrap it under the light LLM variable and be able to add it. And you can add a bunch of specific things. So here you can just kind of custom LLM, your model, name of your model, and then your API key if you have an API key, and then endpoint if you have an endpoint. And then you're just going to add it in there. And then you have these constructor sections here that you can add as well, and error handling, all this stop words. So many things you can kind of go and configure under the hood, which is pretty cool. But for local models, just regular local models, yeah, Ollama does the trick. And you just need to add base URL there and Ollama, which model, pass it to the agent. Just be mindful that some of the open source models are not really great at function calling. So if you want the agent to actually call a specific tool or a specific function or a specific tool to use it to do something. Sometimes it just fails several times before it actually gets it right, just because they were not trained very well to use tools. And that's just the gist of it. So that is the end of this livestream, at least the technical piece. Opening up for questions. And I'm going to send that LinkedIn post that I just created there as well. So go ahead and use it as much as you can. So, and again, I want to shout out to Arcade. Arcade are doing a great job on this. And I'm gonna actually show you their website so you can get started today. And I'm gonna reshare the page with Arcade. So this is Arcade. And you could see here from this, They have support different frameworks there, CrewAI included, and models, of course, that you have already built into your agent. And it exposes all these tools that you can use within your agent. So maybe we could have built an agent that posts on LinkedIn and also posts on something like Reddit, Instagram, or not Instagram. Instagram is not there. Maybe it is. I don't know. I don't think it's there, at least on this graphic. But there's also WhatsApp, ClickUp. LinkedIn MCP as well. And I think with MCP, it opens up a lot of doors really for so many things. Because if you look at MCP, there's so many MCP servers out there that have already been built. And it's just interesting to see how that's going to change. It's already changing a lot of things. So if you're using maybe on Claude Code, for example, you can also use it on something like CrewAI where we actually allow you to use an agent Use an MCP as a tool within your agent as well. So that's pretty cool. Your agent can actually have access to all the tools. And even with Arcade, when all this is exported under MCP, you can actually just use all the tools they have under the hood as exposed to your agent. It's like a basket of tools that agent is like, I want to do this and this and this. And at least this is what you want me to do. And there's this basket of tools. They just kind of scour and they're like, this is the best one to use. Pick it up, use it, get the job done. So that's just a sneak peek. If you want to log into their account, you create an account here. And mine is loading there in a sec. And you would be able to kind of play around with so many things. And they have even sample apps. So build an AI agent for Gmail. And you can watch the engineers there show you how to do that as well. And this code as well that you can just follow along as well. But yeah, but that's all it is. And for CrewAI, of course, just go to docs.crewai.com, which I already shared if you want to learn how to build an agent. And we have some videos as well that we've been creating. So if you go to installation, if you just want to get started, there's an installation video. You can just watch the video or just go through the docs. If you get stuck, of course, you have my LinkedIn, you have my contacts. Just reach out to me anytime. Happy to help. Always happy to help. And we also have office hours every week. So jump on those office hours. We actually just finished one a few hours ago. So if you want to jump on there, come on, bring your questions. We try to help you out as much as we can. Other than that, I think this wraps up the entire video. I'll share the code because I know probably somebody is going to ask about that. And feel free to reuse it or play around with it as much as you can. Otherwise, see you on the next time. Bye.
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)








