S4L8Xz0rV_k β
Let's learn how to use OpenAI Agent Builder
Transcript β
[00:00] Today, we're going to build an OpenAI agent that has a real use case. So, no, don't worry. We're not just going to get the weather or a travel itinerary. I'm going to show you a real use case using OpenAI agents. And today's video is sponsored by Zavier because they hit me up and they're like, Corbin, we need to show the internet how to actually leverage this for something we can use day-to-day. And I'm like, you know what? I got you. Let me show you this powerful workflow. And the workflow we're going to use today is going to be able to provide any YouTube link found on the internet. We're going to be able to ask questions for it. We're going to build a custom widget for it. Watch this preview. I'm going to take this video right here that shows how to use OpenAI
[00:31] agents in 60 minutes. I'll simply put in the prompt, what are the three main points about this video, put the link, enter, and the best part is this bot is free form. We could ask anything, key points, give me X tweets, give me a blog, what is the best part of this video. Give me the top 10 quotes, anything, y'all. So, first, our YouTube bot is going to analyze it. And boom, we got the three main points from that video. The content introduces OpenAI agent builders. We walk through a practical workflow. And the content highlights the limitations and next steps in regards to errors you could experience with the agent builder. And
[01:02] then look at this. We created a custom widget that takes the data of the YouTube thumbnail, the data of the YouTube title, and the duration of that video and put it all in a nice little chat output. Let's find out how to do this. So to start, we're going to come over to our agent builder. We're going to hit create. This is where we're going to build our little YouTube bot. And this is going to transform into a bigger series found on this channel. So make sure to go to my playlist here. I'm going to show you how to take this code and actually push it using chatkit to a real website or software. For now, let's actually build out the workflow. So, first things first is our first little agent block here is going to be the data
[01:34] grabber or we can just call it YouTube helper. So, because our main use case, at least for this workflow, is to essentially grab what the user wants to learn about the video and the video itself. That's all we're going to care about with this first agent. We'll go ahead and use this prompt. I'm going to expand like this. The prompt is this. You are a payload formatter. If you're asking yourself, Corbin, what the heck does payload formatter mean? Payload is a developer term for essentially just data being sent between different softwares. To put it simply, if I save a variable called X equals bananas and
[02:07] cheese and it's a string that could be in a payload. This will make more sense as we get going here. User will provide the YouTube URL and set it as a JSON schema for URL. This will make sense as we'll set it together here. And then the user will ask a question about the video and set that for the prompt. You might be asking yourself, Corbin, why did you identify setting, right? This is how we're going to set up variables so it's dynamic. So anytime we start a new session with our chatbot, it will set it for the new YouTube URL or the new user message that we're calling prompt. Let's save. What's fundamentally important for
[02:38] you to understand now is we're going to use the JSON as the output. Here's the situation. There's a ton of models. If you're just starting out in the OpenAI agent workflow builder, Steco DBT5, it's a nice little one-sizefititall. What's really important for you to understand though is this reasoning effort. The use case of the agent behind me is its sole purpose is just to extract data from our message. Hey, check out this YouTube video. Here's the link. Here is what I want to know. What is the best thing about this video? It's just grabbing
[03:09] that data and formatting it. Therefore, for the reasoning effort, we can use low. Why do we use low? It's faster. It's going to just put in and out. We don't need the bot to like look at the YouTube link and be like, "It's a cool YouTube link." No, we don't care. Just grab the YouTube link and set it. So, we're going to say low here. We're going to add a schema. Typically, with schema, we can go with either advanced, which is quite literally the code, or simple. We can stay with simple. So, first thing is that we need to name our payload, our little present that we're going to give to the other agents. I'm going to name
[03:39] this payload just like YouTube or let's say user data. And the user data we care about is going to be the relevant URL that they're providing us. We're going to set this as a string. All a string is is quite literally just text, right? Just characters of text. That's all a string is. Why do you call it a string, Corbin? Because you know what? I call it a string. Okay. The next one we're going to add here is going to be prompt. And then this is going to be a string as well. Now, obviously, whatever your specific use case is or whatever data you want to extract in this kind of function, maybe you want to set a number. Maybe what's important to you is
[04:10] that from the conversation you're having with the user, the user is like, "Hey, my company size is 20 employees." And then you want to use that later in your workflow. Therefore, in that context, you would set this to employees, but you want to set the type to number. Now, the reason type even exists here and why it's being shown is because in real code, it has implications. And obviously, we're dealing with a developer heavy drag and drop builder. It has implications when you send a payload, which you'll see pretty soon here in like a third party app, how you're identifying that payload. If, for example, I were to set this to number,
[04:42] but in reality, when you receive and handle the data, it's not a number. This could cause errors and breaks in your workflow. Put simply, this for the type, use a chat GBT chat, use a claw chat, use a Gemini chat. Identify that you're using the correct type so you don't run into dumb errors where everything is perfect. is all perfect. But then the only issue you had was just that little thing of just instead of string, you put number. That has real implications. All I care about though is URL and prompt. Later in this video, we're going to go over why I named it prompt and why I named it URL. That actually there's a
[05:13] reason behind that. We're going to say update. So perfect. We have our YouTube helper. We have the user data behind my head. We can go ahead and test this. So I'm going to hit preview here and we'll put in that same little prompt we had earlier. So I'm going to go ahead and just put in best part about this video. And what we care about right now is that it's going to put that YouTube URL in the URL parameter. It's going to put that best part of this video in the prompt parameter. And as you see here, it does. Boom. If you want to double check that, you go to evaluate here. You go to the most recent run and post response. Scroll down here. And perfect.
[05:44] It has formatted the data correctly to URL URL prompt prompt. This is important for you to understand because essentially what's happening here is that it's taking our like I'm just texting you dictation like when as a user when I'm just messaging chat GBT this is taking that kind of information and making it legible for the AI to read in a structured way. That's why we do stuff like this. It's why there's a little curly bracket here. If I'm sending you a text and I send you a text with a curly bracket, you might be like Corbin not an AI. My bad. No curly bracket. So now that we prove this little data extractor works and you can
[06:15] apply this kind of logic elsewhere, I'm going to show you something very fundamentally important for you to understand on how to pass data in very complex workflows that get very large. Because one thing you'll notice that can get very frustrating is if I'm creating a workflow here and I take this data and I pass it to this agent, you'll notice that when I create other agents in the workflow, I'm not able to pass the data found here simply. Let me show you how to do that. We're going to delete this agent. You see this little thing called set state? Oh yeah, this is important. We're going to grab it. I'm going to connect it. And what we're going to do here is this. Actually, before we do
[06:45] that, because of the fact that we're going to be using a thirdparty integration here of bumpups, which is what's going to allow us to extract information from the YouTube video, we need to understand what we need to send to this thirdparty integration of bumpups to even get data from that YouTube link, which we will then parlay with Zapier MCP. So, it's a very simple plug-and-play integration. So, we're going to come back to our YouTube helper real quick. I'm going to go to the user data. And the reason I chose URL and prompt for the naming is going to make a lot more sense. Now coming over to Bumpup's API, the specific request we're
[07:16] making here is called chat. And what chat allows us to do is it allows us to provide any YouTube link found on YouTube and simply prompt it, ask specific questions for it. Now, there's other features here that we could leverage within Zapier MCP that might be interesting to add to this bot, such as generating timestamps for the video, but for this video specifically, we're just going to worry about the chat. Now, what I want you to notice and why it's important for you to see it in this use case is this applies to really any type of logic that you'll integrate within Zapier. Whether it's Gmail, whether it
[07:47] is Slack, every single one of these softwares has their own relevant API documentation. So, for example, if we're sending a payload in Slack, same situation. These are the relevant data points that we care about, channel and text. Now, coming over to Bumpup's API, you can kind of get an idea of what data is required in order for it to execute. Now, in reality, for a chat endpoint for bumpups to execute, it only really requires the YouTube URL, but we can set these other things called variables or parameters in the call. The steps and processes I'm about to show you applies
[08:17] to any software, any API, and fundamentally, it's going to allow you to do any third party integration. So, this might be a little confusing at first, but it's going to literally be crystal clear by the end of this video. So, notice this. We have the URL, we have the prompt bumps API. Oh, it's calling it the URL and prompt here. What other things can we pass or pieces of data that we can send? The model, the language, and output format. So, let's go ahead and add those. So, I'm going to go to model, add property, model. And what you'll notice is, okay, Corin, but how do I know if this is a string, number, bull? Go back to the
[08:47] documentation. And what documentation does is it will actually tell you. So, yes, this says string here, but I realize it says enum there. So, therefore, I'm going to select enum here. And what you'll notice is that it's going to show up like a little pill. So, do bump-.0. There we go. And you might be saying, Corbin, how you know it's bump 1.0? No, it's because it identifies here and you also notice it in the payload here. Nice. We can add another property here. The other property we can add is language. And the reason I'm showing you all this is because even though it says clearly in documentation that this is not required for it to work, you may
[09:19] want to have the little nuance of this stuff when you do your third party integrations. For example, language. If you want the output not to be in English, maybe you want it in Spanish, then you can set it here. But for now, we'll do English. And for the last property here, we have output format, whether it's text or markdown. So we can just simply go here, output format, paste it, and simply put enum enum. And I'm going to put text. I'll hit update. And now what we did here is we created a nice little format, user data here that's going to be able to be sent here. If you're following along up to this
[09:50] point and you're like, I kind of get it, Corbin. This is kind of cool, but this is starting to get a little confusing. What I suggest you to do is literally just follow this video to a tea. do every single thing I'm doing with me and then the dots will connect so much easier. We're going to set the state here. This is going to allow us to use the data that we grabbed in YouTube helper and pass it throughout this workflow. This is a fundamental skill in OpenAI agent builders that you can use for any context. So, we're going to do assign a value here. So, the first value we're going to assign and if this little boxes show up, just put like in it'll show up then is going to be the URL. So, we're going to do URL and then we're
[10:21] going to do two variables. So, we're going to set this. We're going to make it equal something. We're say add variable and then I'm just going to call this YouTube URL. Save. Then we're going to add another one and we're going to do I again. And then we're going to put prompt. And then for the add variable, we shall do prompt. What are you noticing here? Essentially, we are just mapping the data found in YouTube helper and we're mapping it here. The reason we're mapping it is so we can use it through the workflow. Next, we're going to do model. And with the model, we're going to say add variable again. And we're just going to call it model. We can call this the same thing. And I encourage you to call it the same thing
[10:52] so that you don't get confused later on in the workflow where it's like the data for language and then you set the variable name to like cheese, you're going to get confused. So just I would suggest just calling it the same thing, language. Not again. And then something I've noticed that's been happening at least in the early days of the agent builder. So this might not happen by the time you watch this video is sometimes it would do like input output text but then not do the correct next. And then we're going to add variable here called output format. Perfect. So let me speak in very simple terms here of what we just accomplished together. Essentially what we just accomplished together is
[11:23] we've created an AI agents which sole focus is to handle extraction of data and structuring of data. Very fundamental skill. The next thing we just learned how to do is how to set these as variables and this data as variables so we can use it throughout our entire workflow. This workflow today is on the simpler side but in more complex workflows this is a huge unlock. Let's do our next agent here. This agent is going to be the YouTube bot. So I'm going to call it YTbot. So the first thing we're going to do with YTBot is we're going to add tools and we're do MCP server. Server we're going to use is going to be Zap year. We're going to go
[11:53] ahead and get our API key. I've already created one, but we're going to create one together right now. So I'm going to say new MCP server. Make sure you choose the client of OpenAI API. We're going to name this YTbot. Once we do that, we're going to add some tools here. So the first tool I want to add is going to come from YouTube. This is going to allow us to get the relevant metadata. When I say metadata, essentially it's going to be like the thumbnail link, the title of the video, duration, everything of this nature. I'm going to use the action of find video. Alternatively, if you like, let me just do everything. You say add all YouTube tools. I'm going to say find video for now. Nice. Add
[12:24] another tool. Next tool here is going to be bumpups. And bumpups is going to allow us to, you know, do a bunch of cool things such as creative descriptions, hashtags. We're going to use send chat today, but there's other functions we could do. We'll do send chat. Perfect. This is the limitations of this specific MCP protocol. Or in other words, this is what we can specifically do in this workflow. If we wanted to have the ability to do more, Zapier has over 8,000 apps. We can add a ton of other functions and capabilities within this agent builder. And to connect either of these different accounts, whether it's YouTube or
[12:54] Bumpups, you'll simply go to the site, create an account, log in. For Bumbo specifically, you'll simply come up to your profile, you go to settings, go to API, and then create API key. When your API key is created, you can copy it like this and you'll be good to go. All relevant documentation for Bumbos API is down here as well. That step process is typically standard for any software to find their API key. From here, we're going to hit connect. So, from here, we're going to come down here, copy secret. If at any point you're like, Corbin, I think my secret leaked, just hit this, rotate the secret, reset it. We're going to go over here. We're going to enter it in connect. This is going to
[13:25] prompt us with all the relevant abilities this MCP server currently has. And as you already saw, we have the ability to find YouTube videos and ascend a chat to bumpups. We love it. ad. So now we've functionally given our AI agent a super power. It is an extremely powerful agent. Now it can do anything with over 8,000 apps, but we just gave it access to YouTube and bump ups. So now that it has access to that, we're going to want to put our reasoning effort for now to high. This is a great suggestion for anyone that's building an AI agent workflow, especially when you want to make an agent do a more complex task. Always set the reasoning effort to
[13:55] high so that when it runs into errors when trying to call the MCP protocol or the file search, it will try to self-correct itself. If you set that reasoning to low and you try to use Zap your MCP or you try to use file searcher more of these complex things within the agent workflow, it's just going to run into a wall. Just basically make the agent smarter, give it more IQ with any action. Let's identify the specific name found in the MCP protocol. We're going to say here is the expected data for the bumpup send chat payload. How did you get that Corbin? Click your little MCP here and you'll see it right there. Simply copy this, be good to go. Now
[14:27] comes the payload. Now what is the payload, Corbin? That is what we set here. grabbed here and we're ready to go now. So, let's go ahead and set that together. I'm going to hit expand. So, here we go. What we need is a URL, model, prompt, language, output format. Remember, we got this information from here and specifically what we were sending here identify here and here. So, to do that, it's quite simple. We're going to add context and we're going to get it from the state here that we set in the set state. So YouTube URL I can go and copy this here and instead of me having to go back and forth add context
[14:58] I can simply just use this code right state not YouTube URL but maybe model the next one we can put here as well state.prompt prompt the language state.language. So you're understanding something here. Why are you able to do that, Corbin? I'll explain pretty soon here. We're going to do output format as well. So you might be asking yourself, Corbin, why is it state dot and then the variable? Well, let me explain that real quick. Essentially, that's what we're identifying this in the workflow. So it's going to be state dot and then remember we are setting up this variable here. So to call that variable here, I'm
[15:30] saying here a lot, my bad. Here, here, here. State.youtuberl state.odel. We're good to go. This is going to be dynamic data that when a user starts a chat, it'll be able to fill it in here. So then the last major part of this prompt is going to be telling it to use the MCP tool. Use the MCP tool and receive its response and put it in chat. Nice. Save. MCP tool is Zapier. We love Zapier. Zapier. So let's go ahead and add our last bot here. That's going to be a custom widget UI. So you're going to learn two major things here. Now, you're going to learn how to integrate YouTube API, but you're also going to learn how
[16:00] to set up a custom widget to reflect data coming in and how to specifically prompt the widget creator to make a good widget because if you go a little crazy with the widget creator, it's just going to give you a bunch of errors and we don't like errors. Airs are no good. We're going to rename this to YT UI. Let's go ahead and do tools again. We're going to do NCP server. Come back down to Zapier here. Enter in that same key we got earlier, copy secret. Paste it here. Connect. And the sole purpose of this one is simply just going to be YouTube find video. So I can leave that on add first step done. So with that
[16:32] first step done here is the first line. Remember we are identifying the specific action YouTube find tool that we found here. But then we're asking for very specific variables that we're going to receive from this which is URL max res duration and title. Your next question might be Corbin how the heck did you know that? You have two options. Your first option is to go to the relevant application that you're requesting data from. So in this context is YouTube and YouTube's data API and then simply find the event you're looking for right. So search list this is find video and this is where the parameters are identified
[17:02] or essentially how software talks to each other and it's like hey YouTube what's the duration they'll identify as video duration in the payload. So therefore in reality coming back here if I want to be very very specific I could do video duration. Therefore when we find the video using the zap year action and the data is received the AI knows how to read the data which leads to the second option. If you don't want to go through API docs, you're like, I don't like that, Corbin. Don't worry. Just go to any AI model. Simply put in like YouTube API, what is the API data point for the duration of a video or what is the API data point for the thumbnail of
[17:34] the video? This is how you speak to the model so you get the best results, which is how I know that when dealing with YouTube API, it actually gives you all the different URL types for the thumbnail resolution. So, max res is like the max resolution, but there's one called like normal, and it's like the quality is horrible. So, I wanted to go with like the best quality using URL max res. These little nuances of max res video duration. This applies to other softwares that you'll integrate with Zapier as well. Just kind of dive into the books. We're then going to say then place in widget. Essentially, the data that we find here, place it in our
[18:05] widget, which we shall create together. So, to do that, we're going to do text check widget add widget. Great. When creating this widget, we want to be as specific as possible. Therefore, we want to identify what data points we want to reflect in the widget. We need a YouTube widget that will showcase video thumbnail, URL, max res, video duration, and title. Hit enter. Now, one thing I realized when using this widget builder is you really want to get that first prompt right. If you don't and you get a ton of errors in the code, there's ways to solve for it. But honestly, the workflow should be, I attempted a widget, Corbin, it came out, there was
[18:35] errors, it was horrible. Just retry again. Just give it a better prompt. Maybe give some UI context and just keep going at it. So, this widget isn't perfect. Obviously, we have a little bit of cutting off here, but you kind of get the idea of what we're trying to achieve here. I'm simply going to come over to download. And with it downloaded, it will go to wherever you leave your downloads. For me, it's just desktop. Also, as a side note, you might be like, Corbin, this looks disgusting. Like, why is this such a low resolution? That's cuz no image really exists here. But don't worry, it'll fill it in based off the chat. So, going back over to our little widget here, I'm going to say upload. Find the file. It should be a dot widget. And there we go. X. And
[19:06] we'll go ahead and place the last two lines of the prompt. We essentially need to tell the prompt what YouTube or video are we even talking about. So, we're going to say here is a YouTube video add context YouTube URL. Perfect. Save. With all this done, this workflow should work. Let preview. So, I'm going to simply put in that same video we saw earlier. I'm going to ask what is the best quote from this video. Put in the link. Enter. And effectively, we're going to be extracting data first. That's what's happening in the workflow. Extracting the user's prompt. Extracting the user's URL. Then, we're going to set that data so we can reference it in the YTbot and YT UI. First initiation of the YT bot. We are quite literally analyzing
[19:36] the video of artificial intelligence using bumpups API to give us the best quote. And because we set our agent to approve it first, we're going to hit approve. We can obviously turn that off within the agent, which I'll show after this workflow. So, boom. First step's done. This is a developer heavy, but don't worry. I'm going to make it sound very easy, almost like you're going to McDonald's and ordering your favorite Happy Meal. That's hilarious. I said that in the video. It was within the first 20 seconds. Don't believe me? Check out the video. So, next comes our YTUI. This is going to be the widget we created. And we should see a thumbnail, its relevant title, and duration. And there we go. We got the thumbnail, the
[20:06] title, duration. The widget needs some work obviously, but you get the idea. Now, if you just want this to run, so you don't have to hit approve. Click your bot, click your tools, zap year, go to approval, click this, and say never require approval for any tool, and hit update. Nice. So, there is a setup for a really cool workflow. Now, here is the best part, y'all. Make sure to stay tuned on this channel as I plan on taking this one step further. And then, let's take that one step further than that. I'm going to make all that code for free, completely open source. Check me out on GitHub description down below. The code's free. Just take just take all my code. Just steal it. Without further ado, as you already know with these
[20:37] style of videos, I'll see you in the next. Zapier just made OpenAI agents even more powerful by giving us the ability to access over 8,000 apps on the