📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Build an AI Newsletter in 3 Minutes with CrewAI Chat (Free Newsletter Crew Included)

aiwithbrandon23:38

Transcription

Hey guys! In today's video, I'm super excited to share with you one of the newest Crew AI features called Conversational Crews. This feature allows you to chat with your crews.

To help you see how powerful this new feature is, we're going to chat with a newsletter crew that's going to write an AI-driven newsletter just like this one in under three minutes using this new feature.

Also, I'm so excited for you guys because I'm going to be giving away my favorite crew that I've ever built. This crew packs in a bunch of lessons learned and all the best practices for content generation from a bunch of different expensive courses I've bought over the years.

So in this video, you're basically going to get an AI content generation specialist completely for free! You can check it out in the link in the description below to go ahead and download it for free.

Also, to help you guys master Conversational Crews, at the end of this video, we're going to dive into some of the important code behind the scenes that actually allows this chat feature to work. This way, you can fully understand exactly how it all works and how it connects together so that you can fully master this new feature.

But enough talking! Let's go ahead and dive in and see Crew AI chat in action.

Oh, by the way, if you're looking to join a community of like-minded AI developers and get support on your own AI projects, you'll definitely want to check out the free school community I created for you guys. So far, we have over 4,000 members just like you, and we also do weekly free coaching calls where you can hop on a call with me and a bunch of other members in the community. We can get you unstuck on your problems, and you can keep making progress.

But enough of that! Let's go ahead and hop back to Conversational Crews.

All right, guys! So before we start chatting with this newsletter crew, I want to give you a quick breakdown of the agents and tasks inside of it so that you understand exactly what's going on. This way, when we do start chatting with it, you'll be like, "Cool! I know exactly what we're doing here."

All right, so a quick brain dump: our whole goal is to give this crew a brain dump of everything we want to do for a newsletter and then let the crew go off, take that brain dump, create an awesome subject line, and create the content for the actual newsletter itself. Then, it will save it to a file for us. That's our whole goal!

Here's exactly how it works. Like I said, we have three agents. The synthesizer is just going to take in our raw ideas. It's going to go off and actually create that subject line for us to define the direction of the newsletter. It's also going to create an outline.

This information is going to get passed over to a newsletter writer agent. The whole purpose of this newsletter writer is to say, "Cool! I know the subject line, and I also know the outline of the entire article." I'm going to use some of my previous training to go off and actually generate an awesome-looking newsletter that follows all the best practices. I'll show you more of this in just a second.

Finally, what we're going to do is at the end, we're just going to do a quick pass through of the article that we just wrote and make sure that it follows all the best practices. Specifically, do we follow the proper word count? We're trying to generate articles that are close to a thousand words for a really nice-looking newsletter.

Quick shout-out to a post I did the other day: the reason we're passing in these tools like the word counter tool is just because by default, these LLMs were maxing out at like 800 words. So we're going to give our agents a tool so they can actually see, "Oh yeah, this is 700 words. That's not a thousand. I need to do another iteration to hit that proper word count."

Pretty cool tool! You'll see this in action in just a second.

For each agent, there's a corresponding task that basically just does the thing. The only other part that's important whenever it comes to actually starting to chat with your crew is the chat LLM feature right here.

So you're just going to go ahead and define the model you want to use when it comes to chatting with your crew. We'll go much deeper into this later on, but just know that you can actually pass in any model here, and that model is going to be the one who facilitates the conversation. It goes, "Okay, cool! You've given me all the information I need. I'll go ahead and kick off the crew."

But we'll dive into this much later on. I just want to plant a few seeds in your head for what's going on.

All right, so let's quickly recap the actual agent and task because I think this newsletter crew is amazing. When it comes to synthesizing our ideas for the synthesizer agent, a few of the cool things that I just want to point out: we're going to go ahead and make sure that we give it an exact process to follow when it comes to generating the subject line and outline.

We just walk it through exactly what to do with a brain dump when it comes to subject lines. We go ahead and give it the best practices for writing the headline itself. We give it examples of an actual execution so it understands, "Oh, here's exactly what I have to do."

I spent so much time on this crew, so please study this one because there are so many gold nuggets in here of following best practices, and you're going to see it in action in just a second.

Finally, when it comes to writing our actual newsletter, this one is packed with a bunch of actionable insights that the agent needs to do when it goes to writing a newsletter.

You know, like, "Hey, you have the intro." Basically, we're following the template of a general newsletter structure, which includes an intro, a deep dive, curated resources, and a conclusion.

So we just say, "Here's exactly the steps you need to execute. Here's an example of this execution in action." It just knows exactly what to do.

If you want to write your own newsletters, I definitely recommend following this crew right here. I'm not going to keep going into it because the final agent just reviews to make sure it did everything properly.

In the task, what you'll notice is it also just has a little bit of the same information, but we dive into a little bit more like a bulleted structure of, "Here are some best practices." So the agent has all the context of the process, and the task just defines exactly what needs to happen.

You can kind of move the information back and forth. At the end of the day, all of the information eventually gets fed into the LLM, so where you put it doesn't matter as much. But I do like the structure, so I would recommend copying it.

All right, so enough talking! Let's go ahead and actually start hopping over to a terminal so we can start chatting with our crew. You can see it in action.

If you have any questions about this group, please drop a question down below. I'd love to help you out in the comments below.

All right, let's go ahead and open up a terminal real fast.

All right, guys! So now it's time for the fun stuff, where we're going to go ahead and start chatting with our newsletter crew to write that AI developer newsletter. You're going to be amazed at how quickly it's able to do it.

So let me walk you through the process. First things first, we're going to go ahead and type in "crew ai chat." This is going to start analyzing the crew to figure out exactly what inputs the crew needs.

Then it's going to understand, "Oh, you're a newsletter crew who outlines subject lines and goes off and creates an AI developer newsletter." It understands exactly what we did. We didn't have to tell any of it. It analyzed our entire crew, figured out what was going on, and knows what to do next. Super cool!

All right, so let me walk you through exactly what we're going to do next. First, we're going to pass it an input. Let me walk you through what this is doing first, and then I'm going to show you how I was able to do it in just a few seconds.

I was like, "Hey, I need your help writing a newsletter for my audience. The main topic I want to talk about is the four types of luck."

Here's the four types. I didn't type these all out; I just went over to Google and said, "Please give me the four types of luck," copy and paste. Cool, that's fast! So that's my topic I want to cover.

Then what's the angle I want to cover? Well, in my case, I want my AI developer audience to know how they can use these four types of luck to open their chances for good opportunities to come their way.

So what I did is I went into each one of these topics and just gave a quick little blurb. Let me just show you real fast.

I was like, "All right, when it comes to blind luck, there's nothing we can do. We just pray that it comes to us." For luck in motion, I just talk about how when you go off and start building an AI personal brand and start posting content online, you're taking action. You're exploring new technologies, so you're taking action, and opportunities come that way.

Luck from awareness is basically the same thing. When you're in the weeds, you understand what's going on in the AI developer field. You're open to understanding exactly what's going on and can take actions. So you can invest, you can join a company, you can build an app, all sorts of things.

Then luck from uniqueness is, "Hey, you put your personal brand out there. People understand exactly who you are and what you're capable of. Because you are known as a specialist at what you do, opportunities come to you because they want you to do work since they understand what you can do and trust you."

So this top part was a copy and paste. Down below took about, you know, probably five minutes of writing, like, "Yep, here's what my thoughts are, and here's a few examples."

So all around, pretty cool! Just a quick thing I do want to call out: this came from Shan Pur's episode on how to be lucky as an entrepreneur. That's where the idea came to me about these four different types of luck. So definitely an awesome channel to check out if you haven't seen that already.

All right, so enough talking! Let me go ahead and show you how we can actually start chatting with our crew.

We're going to go ahead and grab this input. Next, what we're going to do is go ahead and actually start pasting it into our chat. What I'm going to do is, once you're done pasting in your message, all you have to do is hit enter on a new line, and it's like, "Cool! We're going to go ahead and process your input now."

This will take a few seconds because it's actually going to run the entire crew. It's going to go through those three different tasks, and all those agents are going to work on each one of those tasks.

I'm going to pause for a second and come back once it's done, and I'm going to show you how we can actually chat with it to make sure we get the exact perfect newsletter that we're excited to publish.

All right, guys! So it took just a few seconds, but our crew went off and generated the perfect newsletter. As you can see, we can see it here in the terminal. We can review the result of everything it just said, but we can also see that inside of our code, we can go ahead and see that it made a new file for us called "our final newsletter," and we can actually view it here in an easier-to-read format.

Now I want to go ahead and show you just how easy it is to begin chatting with your crew. I went ahead and put together some feedback that I'm going to paste in there so you guys can see it in action.

So we'll come back down here to the bottom and go ahead and paste in our feedback, which basically just says, "Hey, please regenerate the newsletter with the following feedback. Make sure each luck section appears where it says, like, 'luck from uniqueness.' Go ahead and put a number in there. I want to drop this section, and then when it comes to the action steps inside at the very end, just tweak them."

As you can see, I'm going to go ahead and click run, and this will kick off another iteration of the crew. So basically, at this point, you can see we're chatting with the crew, and it's going to take in our feedback and actually regenerate the entire newsletter using this feedback in the next iteration so that we get the perfect result every time.

We're going to do a quick pause as it's kicking off the crew and regenerating everything, and I'll show you the final result in just a second.

All right, guys! So it just finished up the second iteration of our AI developer newsletter, and it is actually perfect! It did exactly what we said to do.

Let me hop back over to a markdown view so you can see exactly what I see. First off, the subject line is absolutely beautiful. It follows everything that we mentioned for best practices inside of our agents' emo file.

Then we added a few pieces of feedback, so I want to show you that it did it perfectly. We said, "Hey, going forward, don't just give me the name of the luck number." This just makes skimming through the newsletter as easy as possible.

So it went ahead and incorporated that feedback, which is awesome! Next, we said, "I want you to drop that curated list." So that used to be right here, and it dropped it like we asked.

Finally, when it comes to actionable steps, we said, "Hey, make sure you talk about these," and that's exactly what it did.

So all around, you can see we now have the ability to not just kick off a crew and, fingers crossed, hopefully get the perfect result and then manually tweak the results. Now you can go ahead and do multiple iterations of the crew to continually get a better and better result until it's absolutely perfect, just like this.

So all around, this is awesome! I hope you guys see the power of this. What you could easily do next is go ahead and literally copy and paste this over to Substack. That's exactly what I did earlier, and I want to show you what that looks like.

So real quick, if you head over to Substack or whatever newsletter site you use, you can go ahead and paste it over here. This is a previous iteration of the exact same input, so you can see I went ahead and posted it.

You can go ahead and view the post, and it just looks awesome! You can see this looks like a really nice-looking newsletter. It's easy to read, it's skimmable, it has action points, and it has bullet points so you can easily take away, "Oh, here's exactly what I need to do."

It has that nice call to action at the bottom, which is exactly what we would want in a professional-looking newsletter.

As you can see, all we did is take literally less than three minutes. We pasted in an input; half of the input was AI-generated. Then from there, we just said, "Hey, that looks good. Tweak this," and then it gave us the perfect result in no time.

I hope you guys are seeing the power of this new Conversational Crew feature, and I cannot wait for you to go off and use it on your own! You'll have to let me know how you're going to be using this in your own workflows.

But enough of seeing this in action! What I want to do next is actually go ahead and dive in and show you how this Conversational Crew feature works behind the scenes so you can understand exactly what's going on and how it's going to impact your crews when you're working with this new feature.

So let's go ahead and hop over to Crew AI and do a quick deep dive.

All right, guys! So here's the quick Crew AI deep dive so you can understand exactly how this feature is working programmatically. This way, you have a better context and understanding of how everything is working together and connecting as you're using the new Crew chat feature.

What I want to do is cover the old way, and then we'll dive into the new way so you can understand what has changed.

So let's go old way first. This is what happens right now when you kick off a regular crew. The current process is you're able to pass in inputs such as, "Hey, here's my newsletter brainstorm."

That input could be accessed anywhere in your agents or your task. What's going to happen is task one is going to work, the result from task one is going to get passed in as context to the next one, and then task two is going to go off and do some work, get passed into the next, and so on until it's done generating your newsletter.

But as you can see, this process, the only lever you can move is the input. You're pretty much stuck outside of that.

Now let me show you what has changed inside of the new Conversational Crew method and actually what's going on.

It's important to note, as you saw earlier, we defined a chat LLM. The best way to think of this chat LLM is that it is a layer that sits on top of your crew.

Basically, this chat LLM is going to wrap all around your crew, and it's going to treat your crew as a tool. What I mean by that is, as you're typing in a message to this chat LLM, at every point, it's going to be asking, "Can I call the Crew tool?"

Its whole goal is to call that tool, and it's just trying to get just enough information to call the crew inside of it. If you've worked with OpenAI tool calls, it's exactly what's going on there. It just so happens that our tool is an entire crew, which is a pretty cool concept.

So what's happening in the new approach is, once it has enough information, it's going to kick off your crew by passing in the normal inputs that you'd see right here.

It's going to pass in the normal inputs, so it's going to take your raw conversation, which is, "Hey, I'd like to make an AI newsletter about the four types of luck, and I want to talk about this." It's going to pass all that in as the normal input to your crew, just like we would have done in the old way.

So it does the mapping for you, mapping your raw text to an input, all for you, which is pretty cool.

But then here's the cool kicker that I think you guys will like, and this is how the actual feedback iteration part works.

What we're doing in this new approach is all of your messages that you're typing with the crew, like, "Hey, please do this," and "Hey, please add in this feedback," and the result of the first iteration of the crew, all of these messages are going to get passed in as context to your task.

What this is going to allow the crew to do is go, "Okay, I can see in the previous execution of this crew, here is the result, and here's your feedback. I can see that you wanted the subject line to be different, and you wanted it to be in this new format."

Well, since task one is all about generating better subject lines, it's going to go, "Oh, I now understand what you don't like, and I understand what you do like in this specific case."

So I'm going to take in all that feedback and generate a better subject line and potentially an outline. Then when it gets to the write a newsletter task, it's going to go, "Oh, I see in your previous iteration when I generated the deep dive section and talked about the four types of luck, you didn't like my numbering schema."

So I'm now going to update the way I number everything inside the newsletter. I'm also going to take out the curated section, and I'm going to improve my action items.

As you can see, that's how this crew understands what changes it needs to make. It really comes down to adding inside our task just a previous message history so it understands what went wrong, what action we've taken, and what improvements we need to make going forward.

Then this cycle just happens over and over again. So as you type in more messages, basically, this is just going to get copied over and over again so that the crew can see, "Oh, I see we've done three iterations at this point. You don't like any of them because I'm doing this wrong. I now know what to do in the next one."

So hopefully, you kind of see exactly what is happening. Now that you have a high-level visualization of what's going on, I just want to quickly show you a few of the code snippets that I think you might find interesting that actually make all of this possible.

Let's go ahead and hop over to Cursor to see all this in action.

All right, guys! So welcome to the Crew AI behind-the-scenes look at how this feature actually works. This is totally not necessary; you don't need to know how it works. But as a fellow AI nerd like me, it's sometimes cool to understand exactly how new features like this get built and actually work.

So let me walk you through exactly what's going on so you can see, "Oh, that is pretty cool how we build this Crew chat feature."

Before we dive into the code, I just want to recap what our ultimate goal was so this makes sense.

At the end of the day, we have a crew. Our whole goal is to kick off that crew. Specifically, as I mentioned earlier, we're treating the Crew AI kickoff as a tool call.

What we're ultimately trying to do is have a conversation, like a normal ChatGPT-style conversation, where we're just asking questions and talking. Then whenever we have enough information, we want to go, "Cool, AI! I want you to go off and kick off this tool."

It just so happens this tool is an entire crew. So that's what we're trying to do.

Now, there's a little bit more that has to happen behind the scenes, such as, "Okay, well, we have a crew, but what the heck does this crew do? What's the purpose of it? What inputs does it need?"

All of that information we actually have to extract, and we have to do some fanciness to get all this working so that at the end of the day, all we have to do is, you know, just basically, we want Crew AI to do all the work so that it's very easy for the LLM to understand exactly what's going on.

So here's exactly how it works under the hood.

First things first, what do we want to do? Well, in our case, we want to go off and grab all the inputs of the crew. How do we find the inputs, and what are the inputs?

If you go back and look at your task and agent file, you will probably have added in inputs just like this. An input is anything that's a parameter or variable that you pass into your task or agents' emo file.

So anything you see in curly brackets is an input. So we go, "Okay, cool! I now understand what the inputs for this crew are."

Now what I need to do is also understand what those inputs do. I need to understand, "Okay, I know the name is brain dump, but what is the brain dump?"

At the end of the day, when you're creating tool calls, you need to know the variable name, you need to know the variable description, and you need to know what you need to pass into it.

So we actually have to check out my "C Noob vs Pro" video for a deeper understanding of how tools work. But we're basically converting Crew AI into a tool, so we have to follow those same lessons learned in that video.

So we go, "Okay, cool! I now have the inputs, and what we're also going to do is analyze the entire crew itself."

In the next step, we're going to go, "Okay, you are a newsletter crew. I understand your purpose. I understand your whole goal is to go off and generate a newsletter."

So I understand the tool, I understand its purpose, and now what we're going to do is work backwards to build a schema.

This schema is basically just going to be a long object that says, "Okay, random LLM, here's everything you need to know about generating and using and kicking off this crew. It generates a newsletter, it takes in this brain dump input, it's a string. Here's everything you need to know in order to properly kick off this tool."

Then we go, "Okay, cool! We have context for the entire crew now, and now it's time to start actually chatting with this crew."

This is where we're going to start working with what I'm calling the build system messages. This is where we kind of map in, "Okay, here's all the required fields needed to run this crew."

Now let's just do some prompt engineering to accomplish a few things. First, set context: "You are a helpful AI assistant for Crew AI. Your whole goal is to assist users with a specific crew."

You can talk in a general fashion; you can answer random questions, but your whole goal is to always steer people towards kicking off this crew.

Then we're going to go ahead and just, you know, here's all the required fields you need to run the crew. Then we just do some other general prompt engineering to help it ask questions that are appropriate to the conversation to steer you to using the crew.

We just give it some general additional context, like, "Here's the name of the crew, and here's the description of the crew."

So all around, pretty cool! You can actually see this in action because, like I said, we were just trying to— that was the prompt, that was the initial system message.

Then you can see, "Okay, cool! Now we're going to go ahead and generate the assistant message from that."

It's going to take in everything we just said here. It's like, "Hey, you know, here's how you should start a conversation. Hey, I'm here to help you with accomplishing this."

You can see it's actually using the prompt we set up earlier, and now it's working in a way that's specific to the crew that we've built together. It's all just working magically, which is the cool part!

Love that we tried to make everything magical at Crew AI.

All right, outside of that, is there anything else I wanted to mention? Yeah, outside of this, the only other thing that's pretty important is, yeah, this is that introductory message from the assistant. That's how this got generated.

From that point going forward, all we're doing is having messages, which are messages between us and the AI, and then we have our available functions, which in our case is the crew.

We want to call the crew, and then we just enter a chat loop. The whole point of this chat loop is to go over and over again to where we ask the user a question, work towards kicking off the crew, then we can actually go ahead and kick off the crew.

Sometimes we add that message back to our conversation and just keep the loop going over and over again.

I definitely recommend checking out this file, Crew AI chat, if you want to dig a little bit deeper. But I just thought you guys might find it pretty cool to see, "Oh, how do you take a crew and start chatting with it?"

So I thought this might be a cool deep dive for you fellow developer AI nerds out there.

But yeah, that's a wrap for everything inside this video! If you have any questions on anything I've just talked about, please go ahead and drop a comment down below, and I'd be happy to help out.

Or I'd love to see you over in the free school community to get some additional help over there too.

And that's all for this video, guys! I hope you love seeing this new Conversational Crew feature in action.

Just as a quick reminder, you can download all the source code in this video completely for free. Just check the link down in the description below, and you definitely don't want to miss out on this crew because it's my all-time favorite.

Second, if you want to join a group of like-minded AI developers completely for free and get help on your own projects, you'll definitely want to check out the AI Developer Accelerator School Community I created for you guys completely for free.

But that's all for this video, guys! I cannot wait for you to see a bunch of other AI content that I have on this channel, everything from CI, LangChain, and a bunch more. Just check out whichever video is popping up on the screen now.

Thanks, and I cannot wait to see you in the next video! Bye!