In this video, you're going to learn how to build crews that run faster and cheaper using Groq! We are going to cover the fundamentals and learn how to add Groq to our existing projects. From there, we are going to build a Cold Outreach Crew that's optimized for using Groq.
Timestamps: 00:00 Introduction 00:56 What is Groq? 01:37 Create Groq API Keys 02:18 Install Groq 02:36 Add Groq To Crew 04:06 Cold Outreach Crew Overview (Groq) 04:50 Setup Dependencies 06:29 Create Agents 11:38 Create Tasks 21:48 Setup & Kickoff Crew 24:04 View Groq Results - Under 2 seconds 25:58 Run Medium Test + Rate Limiting 28:51 Run Large Test 29:24 Final Groq Tips & Tricks 31:21 Outro
Hey guys, in today's video, I'm going to teach you everything you need to know about using
Grok with Crew AI so that you can build crews that are faster and cheaper.
And that means we're going to be covering what is Grok and how you can start using it
in your crews.
And once we've covered the basics, we're going to build a cold outreach crew that's optimized
just for Grok.
This crew is going to take in a CSV list of customers we want to reach out to and a little
bit of information about them.
And it's going to take in a template email that we want to send them.
And our crew is going to merge them together to build hyper-personalized emails that we
can send to all of our future customers that we want to work with.
I'm super excited for you guys to build this crew because I was completely blown away with
it and it's probably one of my favorites so far.
And don't worry if that seemed like a lot, I'm going to be walking you guys through everything
step-by-step and I'm going to be giving away all the source code for this crew completely
for free.
More information on that down in the description below.
But enough of that, let's go ahead and dive into Grok.
So what is Grok?
Well, it's an AI startup company that developed a new chip called a language processing unit,
also known as an LPU, which is specifically designed to run large language models faster
and cheaper.
For example, one of these LPUs running Mixtral can process 500 tokens per second, which is
25 times faster than Chachabit and 10 times faster than Google's Gemini 1.5.
At these speeds, you're getting results almost instantaneously.
And the best part about Grok is that it's completely free for us developers to start
using right now.
Let me go ahead and actually show you how you can start using it today.
So the first thing you need to do is head over to Grok Cloud and you're going to need
to sign up if you don't already have an account.
But once you've signed in, it's going to take you to the Grok Cloud Playground.
And this is where you can start playing around with Grok and experimenting with their different
models.
But in our case, we want to create a new API key.
So we're going to head to the API key tab.
And once we're in here, we're going to click create API key and we're going to make a new
API key.
And we're just going to call this tutorial and we're going to create the API key and
copy it.
And once we've done that, what we're going to do next is use this API key to start connecting
Grok to our crew AI.
And we're going to be able to do this in two simple steps.
Let me show you.
So the first thing we need to do is install Grok.
Now, depending on how you're managing your project dependencies, you'll either need to
do pip install LangChain Grok or if you're using Poetry, you'll need to do Poetry add
LangChain Grok.
And once you've installed everything, let's actually head over to the code editor so you
can start seeing how we can start using this new tool.
So now we're in step two where we're going to update our crews to use Grok instead of
OpenAI.
And this is a super simple change.
As you can see in this agents file that I've already set up, we have specified that we
want to use OpenAI as our default LLM.
And you can see down here in our agents file, we are setting the default LLM to be the LLM
that we set up in the top constructor.
So to change this up, all we have to do is delete this.
And instead, we're going to say I want to use chat Grok instead.
And then what we're going to do is start using it and updating the dependencies.
And we're just going to update that to say from LangChain Grok import chat Grok.
And all we have to do in here is we have to set up our API key first.
And this is going to be the API key that we created just a few seconds ago when we were
walking through setting up everything in Grok cloud.
And the next thing we have to do is set up which model that we want to use.
And in our case, we just want to use Mixtral because that's the one that works the fastest.
So we're just going to set that.
And that's literally all you have to do to start using Grok inside of your crews.
Like I said, it's super simple to set up, but I still want to walk you guys through
the process of creating that cold outreach crew that I was talking about initially that
only uses Grok AI.
And the reason I want to do this is because the example I'm going to show you guys shows
you how to optimize crews to work better with Grok and how to avoid getting a rate limited
by Grok.
So let's go ahead and start building out our new crew and that will send out cold outreach
emails.
I'm super excited to show you guys this.
Let's go ahead and dive in.
All right, guys.
So welcome to the cold outreach crew that we're going to be building here together today.
And as you can see, I went ahead and stubbed out and created some of the files that we're
going to be using in this crew.
And the reason I did that is because this is a Grok specific tutorial.
So we're going to be speeding through most of the normal crew AI setup and focus specifically
on the features that are unique to Grok and optimizing our Grok runs.
So, and another point I want to make, if this is your first time hearing about crew, or
if you want to learn more about crew AI, I have a ton of other videos on my channel,
such as basic tutorials that help you get started.
And I also have a lot more advanced tutorials where I teach you how to do things such as
implementing and connecting crew AI to a full stack application.
So you're definitely going to check out those videos right after this one.
But enough of that, let's go ahead and start setting up this crew using Grok.
So the first thing we're going to do is install all the dependencies for our crew.
And currently we're storing all of those in our pyproject.tumble file.
So you can see right now we're using the latest version of crew AI, and we are also installing
a lane chain Grok so that we can start using Grok chat.
And in order to install this, we just have to type in poetry install dash dash no root.
And this will go ahead and install all of our dependencies.
And this will take just a few seconds.
But once that's done, we can go ahead and open up the newly installed Python environment
that we just created.
And we can do that by typing in poetry shell.
So we'll type in poetry shell.
And this will go ahead and activate our new Python environment.
So you can see now I'm using our cold outreach crew AI, and that's the exact name we had
up here.
And what I can do to make sure that when I'm working with our Python files, that it's properly
actually referencing these dependencies is I'll copy this right here.
And then whenever I head over to a Python file, if I click down here to update our interpreter
path, I can click this, and then I'll enter our interpreter path.
And then this way it'll properly link to make sure that we are installing and using the
proper dependencies that were installed.
Okay, enough of that.
Let's actually go ahead and start walking through this main.py file.
So you can see what we're going to do inside of this project.
So this main.py file is going to house all of the core logic for running our crew.
And this is where we're going to first create our agents.
Then we're going to create our task, set up the crew and kick it off so we can start actually
saving the personalized emails that we generate with our crew.
Okay, so what we're gonna do first is let's go ahead and hop over to our agents.py file.
And this is where we're going to create two different agents.
The first one is going to personalize our emails.
And the next one is going to be a ghostwriter who's going to make sure that those personalized
emails actually sound like us.
So let's go ahead and start creating these agents super fast.
So the first thing I want to do is set up grok.
And all we have to do is inside the constructor is say I want the default LLM to be grok.
Then what we're gonna do is quickly import the missing dependencies.
So once we've done that, and they've appeared up top, what we're going to do next is make
sure that we have set up our API key.
And the reason why this is important is because in order to use grok, you have to specify
which API key you're using.
And in my case, I'm setting this and grabbing it from our environment variables file.
So if you head over to the environment variables file, what you'll notice is I went ahead and
pasted in my API key that I set up whenever I was going through the setup in the beginning
of the video.
What you'll want to do is update this API key with whatever API key you generated during
your process.
But once we've done that, what we can do next is head down to setting up our personalized
email agent.
Now, what I'm going to do is just walk you through this agent at a high level, and then
we'll dive deeper into the parts of this that are specific to working with grok.
And real quick, we'll just fix our missing dependencies.
So from crew AI import agent.
All right, that looks great.
So here's what's happening at a high level basically for this agent.
First off, we're saying, hey, I want you to personalize basically email templates using
recipients information.
So whenever I give you an email template, such as their name, information, everything
else, I want you to incorporate their details into an email while maintaining the core message
of that email template.
So this is basically just going to you updating the introduction body and closing of the
email to make it more engaging for that recipient.
And what is the template email you might be asking?
Well, that comes back from our initial main.py file where we basically just said like, hey,
here's an announcement.
It's funny because this is like a real announcement.
But hey, I have a school community where you guys could actually join.
And I have coaching calls every Tuesday.
It's completely free to join.
And if you know if you're liking this AI related content and you want to check out other
videos on my channel, definitely do that and make sure you hit the like and subscribe
button. I hope you enjoyed that subtle plug.
But that's an example draft email that you could personalize.
And what are we going to personalize that email with?
Well, if you actually head over to our data folder, I have an example list of clients.
I have different sizes just so you can test them all out.
I have a small, medium and large.
The large contains 20 people and the small only contains one.
But as you can see inside this small client list, we contain the person's name, last name,
and then we also contain a little bio about the person.
So, you know, they're a software engineer for 10 years and back in development.
And then if we had a previous conversation with that person, talk about it.
So in this case, we just had dummy data saying that, oh, we have an upcoming project and we need to talk about timelines or requirements.
So that's the full story of what's happening and what needs to be done inside this personalized email agent.
And now let's dive into the part that's specific to working with Grok.
So the important part that I've noticed with Grok is that the tool is super, super fast, but it is not as smart as Chachabit.
And any time I've allowed these agents to run multiple times, what I've noticed is they basically get confused and try to do fancy tasks and really just make up tasks.
And in my case, all they need to do is take the email template, tweak it to the person that we're sending the cold outreach email to, and then just move on to the next step, which is going to be passing that information over to the Ghostwriter.
So by setting the max iterations to two, we make sure that the agent focuses on the core part and doesn't get fancy and come up with its own tasking.
So this was a huge trick that I had to spend hours trying to figure out how to get these basically Grok agents to work more efficient and reliable.
And this was a huge trick.
So definitely make sure you set this max iteration to something small, not one, but anywhere from two to four to make sure you get reliable results.
All right, cool.
So let's move on to the next agent, which is going to be setting up our Ghostwriter agent.
And this one's going to be super simple.
What we're doing inside of this one is we're just saying, Hey, I'm going to give you a draft email and it is your job to make sure that you style the email tone and voice to be more like this.
So this is just, you know, some just simple, simple styling, just so it doesn't sound like a robot.
And basically, once again, this also sets the max iteration to two.
And the reason why we do this is because once again, we don't want our Grok LLMs to go off and start doing their own stuff.
We want them to just quickly spit out a draft email that we can send to our outreach clients.
Okay, so that's what's happening in the agents.
And now that we've set that up, let's actually hop back over to our main.py file so that we can start incorporating them.
Now, this is going to be super straightforward.
All we're doing here is we're saying, I want to create two agents.
One of them is going to come from the agents file that we just set up.
And what we're going to do is, like I said, go ahead and pull out those agents that we just created.
And now that we've created these agents, we're going to go ahead and move over to the task section.
And I think this is actually the most important part of the whole process.
So let's quickly go ahead and save this and open up our task.py file.
And this is where we're actually going to be giving those agents we just created.
This is where we're going to be giving them the task that they need to execute.
So let's go ahead and start working on the personalized email task.
And real quick, before we code these up, I think it might be super helpful if we take a quick step back and look at the overarching process that we're trying to complete.
Just to provide a little bit more context as we're typing up our code.
So let's do a quick recap of our ultimate goal.
We are trying to take in a list of users in a CSV file and we want to write them some emails and make it sound like us and eventually save the output to a text file that's in our output folder.
So here's what's actually happening in each one of these steps.
The first one is we're going to iterate through each one of the people in our CSV file, pull out all their information, and we're going to put that information into a personalized email task.
This personalized email task is then going to merge their information with a template email we've created to generate a personalized email.
So here's an example.
If we were writing an email to John and the template email was talking about a new school community we created, here's what the personalized email would look like.
It would go, Hey John, I just created a new school community that I thought you would love to be a part of.
The reason why is because this community is for AI developers just like yourself.
So I thought this would be a huge asset and I thought you would really like to meet some of the people inside this community.
So that would just be the like rough draft personalized email.
Then this email would get passed in as context over to this ghostwriting email.
And we'll talk about this more in the code, but it'll get passed over to this task.
And what the whole purpose of this ghostwriter is going to do is make sure that personalized email now actually sounds like us.
Because if you've worked with chat, GBT, Lama 2, Mixtro, any of them, if you just tell them to write an email, they usually sound way too formal and not like you and I talking.
So this ghostwriter is going to make sure the email actually sounds like us.
And once this task has basically made sure the email sounds like us, it's going to say the result to an output file that we can then, like I said, copy and paste from and actually send out an email.
So that's a quick recap of what we're trying to do and how we're going to do it step by step.
So now let's hop back over here and start coding up our first task, which is going to be personalizing the emails.
So to help speed this process up, I'm actually just going to go ahead and paste in the results, but I'm going to walk you through this line by line.
So the first thing we want to do is update our imports just to get rid of that.
Okay, fantastic.
So let's walk through this line by line real quick.
So what we're trying to do in this task is we say, hey, we want you to personalize an email template for recipients using their information.
Then what we do is we give the grok a quick overview of who we're trying to talk to.
And the way we were able to do this is by passing in a recipient.
Now we'll talk about creating recipients back when we're here in the main.py file.
You know, this is going to come by pulling out and iterating through the CSV and creating recipients.
But just know we pass all the information in right here.
Then we say you have some important information that you need to consider when you're personalizing an email.
Just basically use a sentence or two from the bio and make sure you naturally incorporate it into the email without going into a bunch of detail.
Whenever I didn't tell this, the emails would be completely off topic because it would focus more on the information from the last conversation or the bio.
So that was super important.
The next thing is basically we say, hey, keep the email roughly the same length as the template email, because if not, sometimes it would double the length, which was really confusing.
It will get way off topic.
So that's how I got the personalized part to work.
And then the other few tricks that I had to do to get to work, I had to put the email template in triple quotes.
And, you know, we're saying, hey, this is the template that I want you to, you know, personalize.
And the way I got this to work nicely in this task was by putting it in triple quotes.
Whenever I did this, the results were a lot more consistent.
So those are just a few tips that I thought would be helpful as you go off and create your own task.
Now, let's get back to what's actually happening.
After this, we're just going to say, hey, the expected output is the personalized email draft that you create by, you know, going through this.
Then what we also do, and this is specific to Grok, we want a sync execution to be true.
Now, here's why.
Back in our example over here, if we have a CSV list of, you know, Bob and John, well, there's nothing preventing us from working on creating the personalized emails for Bob and John at the same time.
So to make sure things can happen in parallel, and we're not just trying to do these one at a time, we set asynchronous execution to be true.
So that'll speed up our crew, but it is important.
We might hit some rate limits.
So we're going to come back to this later on and I'll show you whenever we're done with this building it, I'll show you these rate limits in practice and how we can deal with them.
Okay, cool.
Well, now that we have this personalized email task done, what I want to do next is let's just hop down here to the ghost writing part of this, just so you can see how we're going to make sure that our emails don't sound like a robot wrote them.
And this one is super straightforward from a description point of view.
We're basically just saying like, hey, I'm going to give you a draft email.
It's your job to make sure you update the writing style to match this and make sure you don't use any emojis.
So that's the description.
Now let's actually talk about how this task is going to work.
Well, the way we pass in a draft email from our personalized email step is by passing it in here in the parameters.
So as you can see, we're passing in a draft email and this draft email is going to get passed in as context.
And if you haven't used context before, basically it's the way that you can have other tasks pass their output to this current task.
This is super helpful when you want things to work in series.
So in our case, whenever we wanted to do, you know, go from personalized email to ghost writing email, that's exactly how you could do it.
You basically would just go, you know, finish the personalized email, pass the draft to the context of this ghost writer.
So that's how we're going to basically set that up.
Now, here are the other important parts of this task.
First off, we're going to say we want the output file to be into the output folder.
So up here in the output folder.
And we just basically want to do the person's first name underscore last name dot TXT.
And this is just another nice new feature of crew AI where you can just go ahead and define the output file and it will know whenever this task is done executing to go ahead and spit out everything to the output file.
And in case you're curious how I keep going to all these different, you know, basically sub properties of a task is I'm just clicking command and then clicking on the property.
It'll take me to the definition with inside a crew.
Super, super helpful.
Definitely recommend checking it out.
Okay, well, now that we've walked through what's going to be happening in this task.
Let's hop back over here to our main.py file where we're going to start creating our task, setting them up to basically be generated from all of the entries inside of our CSV file and then connecting everything up.
So let's go ahead and start creating our task.
So the first thing we want to do is go ahead and create a new personalized email task object.
So we're going to do by that is just say personalized.
Let's actually hop back over here and grab the new class we made over here.
So we're going to do is make a new object.
Fantastic.
Let's import our missing dependencies.
And great.
Now that we've imported our new personalized email task, we can go ahead and start creating tasks.
And this is going to be a little bit different than everything you've done in the past, just because we are going to dynamically create our task depending on the number of clients we want to outreach.
And this makes sense.
If we have one person in the list, we basically want to create one task that's going to go personalized email and one to ghostwrite.
And we want those to be connected.
If we have 10 in here, you know, in this case, we want all of these tasks.
We want nine or 10 different classes and tasks to run at the same time.
So here's how we're going to do this first.
We're going to, like I said, because we have a dynamic number of tasks that we need for personalizing emails and ghostwriting, we're going to have an array because we need to somewhere to store all of them.
And the next thing that's going to happen is we need to access that CSV file that we created earlier.
And this is going to allow us to import all the clients that we want to outreach.
Now, this is going to be a little bit different if you haven't worked with CSV files before, but I'm going to walk you through this line by line.
So it all makes code.
So you're confident to go do this on your own.
So what we're saying is we're basically going to open up our CSV file.
So in our case, data folder, then we're going to open up our client, small CSV.
So this one right here, we're going to open it up in read mode.
And we're going to say, I want the, this is basically called the delimiter window.
I want to know that I'm in, like, need to go to the next line.
And in our case, whenever it's an empty string, that's what we need to know to go to the next line.
But enough of that CSV stuff out of the way.
What we're going to do is say, I'm going to open this up as a file.
You can call this whatever, this is a variable.
And what we're going to do is we're going to use the CSV library.
So let's go and import it.
And we're going to call basically dict reader to read through this file.
And what this is going to allow us to do is we now have access to the information inside of that CSV file.
So what we can do is we can start to iterate through this CSV file.
So what we can do is we can like a normal for loop.
So we can say for row in CSV reader, CSV reader.
And then this is where we can go ahead and start basically creating all the information we need to kick off our different tasks.
So if you remember our first task, which was going to be the personalized email, took in an agent, a recipient and an email template.
So let's go ahead and set that up.
So first, we're going to create our recipient.
And what we're going to do is create that recipient object by accessing all the information in that row.
So you can see I'm accessing first name, last name, email.
And the reason I need to put those and to call out those specific column names is because back over here, it's exactly what I have at the top of the CSV file.
Fantastic.
So now that we have our recipient, what we can do is go ahead and create our personalized email task and pass in everything that it needs to go ahead and start personalizing our email.
So what I did is I said, all right, on the task object, I want to call the personalized email function, which will, in our case, return a new task.
And this task is going to go off and personalize our emails for us.
OK, cool.
Well, now that we're creating this task, well, whenever it's done running, what we want to do is put the output of this task into our ghostwriter task.
Because if you remember down here and our ghostwrite email, we said we want the context to be the draft email that comes from this first task.
So what we're going to do is back up here is we're going to once again, create another task and we're going to put the output of this task inside of here is our draft email.
So this is like, hey, once you get the output here, save it and pass it into this ghostwriting email.
So our draft email pops up down here in our context and you'll see once it's running, this will make a lot of sense.
OK, so now we got that out of the way.
What we need to do is one final step is we need to start adding these new tasks to our list up top because we're now at the final part where we're going to start setting up our crew and we need to actually pass in that information.
So let's go ahead and move this back over.
So we're just going to set up our crew real fast.
And this is going to be super simple.
And let me call out a few things as I'm making it, just so you guys can see which parts of this, excuse me, see which parts of this are going to be specific to using Grok.
So the first one is we need to pass in our agents.
This is completely normal.
You'll do this all the time.
But when it comes to creating your task, well, like I said, this is going to be a little bit different than everything you've normally done.
What we're basically going to do is normally you would just pass in a task and the crew itself would figure out like, oh, yeah, I'll run this task six or seven times.
But in our case, we're saying, hey, I've already created all the tasks for you.
I just need you to execute them.
So that's what's happening here.
And then what we're doing is this little star right here.
Imagine if this was an array, it's basically just spreading out the array so that it'll fit into another array.
So I hope, I hope that makes sense.
And then the final thing that we're going to do, and this is very specific to using Grok, is we need to define the max RPM.
And we're going to play around with this because we're going to break our crew in a second.
So you can see why this is important working with Grok.
But basically just know that using Grok, you have a rate limit of 30 calls per minute, which is like normally that's fine.
But with crew, it's going to be running so fast that you actually can easily hit that limit.
So we need to be very careful.
So we'll break it and then we'll get it working together here in just a little bit.
All right, let's fix import real fast.
So we just need to come back up top and say from crew import crew AI.
Great. That's looking good.
And now that we have our crew, what we'll do is we're just going to go ahead and kick it off.
So this is working.
Let's just fix a few final imports.
That's looking good.
And finally, we're about to go to the final part.
Once we run our crew, we're just going to start putting everything in a nice output for us.
Okay, cool.
So what I'm going to do now is we're going to go ahead and open up our terminal, clear everything out.
Oh, we opened up the wrong one.
We're going to clear everything out.
And then we're going to go ahead and start running it.
So you guys can see what kind of results we're going to get once we're using grok.
So all we need to do is just type in Python main.py, and this will go ahead and run our crew for us.
And this should take just a few seconds to actually kick it off.
So yeah, this is crazy.
As you can see, we just generated a custom email in under two seconds.
So let me go ahead and open this up so you can see it.
So just like, Hey there, John, just swinging to remind you about our school community.
So you can say like, this is very customized to what we're doing.
You know, we have live coaching calls every Tuesday at 6 PM.
Eastern time.
Community is free.
You know, so it's really just kind of pitching it in plug that it's growing.
We're at 500 members.
And then, you know, basically I think it also probably sneak in a few things up here as well.
Um, yeah.
Hey, this is a great spot for you to share your expertise and everything, especially now that you're a
backend developer with 10 years of experience.
So yeah, that is wild.
It ran so fast.
It did exactly what we wanted to do.
I am pumped about using grok and all my future projects.
So the other part that's pretty cool is I went ahead and did some cost calculations for you guys.
So as you can see down here that it took about, you know, almost 1,700 tokens for prompts and then
about basically 2,200 when it comes to like total tokens.
So here's how you can calculate how much that's actually going to cost you if you were to do this
with chat, you be team.
So all we need to do is remember the fact that it's 2,200 tokens and it made two API calls.
So what we do is head over here and say input tokens.
Apple got a little bit, get a little bit more specific, but it was two API calls and then it was
1,700 and 500.
So let's input that.
And just so you guys can see how much this normally would have cost with using chat, GBT, because this is
kind of mind blowing.
So if we were using open AI chat, GBT for turbo, this would have cost about 3 cents, sorry, about 6 cents
total, which is crazy because we're using mixed role and grok.
So this was actually completely free to us, which is just like I said, I, I hope you guys understand how
awesome this is and how excited I am to use it about this technology.
So now that we have this set up, I'm going to actually go ahead and start running it.
So let's clear all this.
Let's go ahead and start running it on the medium one, just so you guys can see how fast this one is as
well.
So we'll clear out our outputs one more time and let's start running this again with our medium crew.
So all we need to do is hop back in our main.py file and then inside of here, we just need to update
which CSV file we're calling.
So in our case, we're going to call medium.
And the reason I'm doing this is just because I want to do a mixture of showing you how fast it is and
because I want us to start hitting a rate limit just so I could show you guys the quick fix.
So you're not stuck on your own when you're doing it.
So let's run our python.main file one more time, clear that out, run it real fast, and let's see what it
does.
So as you can see, we kicked off all of our crews in parallel.
It's spinning them off.
It's actually running them off.
And you can see our outputs are generating in real time, which is insane.
Once again, we are working super, super fast.
However, we might hit a rate limit on this.
You never know.
If not, we're going to bump it up to the large data set.
We'll definitely hit our rate limit.
Yeah, it's slowing down.
I think we're hitting our rate limit right now, but let's just give it a few more seconds to find out what
happens.
All right, guys.
So this one definitely took a lot longer to run because we got rate limited because as you can see, we were
spinning out a bunch of different content for all of our different emails that we're trying to sit out.
So once again, this just got basically hung up trying to run and plan everything in our crews.
So we probably did about 10 seconds of work, got rate limited, did 10 more seconds of work, got rate
limited, and then finally did the rest of the crew.
So that's just one of the unfortunate parts about Grok is the fact that it's so fast.
However, you're going to only allowed 30 requests per minute.
So you basically just, you know, like I said, you get, you get rate limited.
So that's all, that's the only downside.
But these emails are awesome.
Once again, like I said, we have, you know, it's the exact ghostwriting template we wanted.
You know, this is the exact way I would write, you know, just, Hey, excited to be there.
Here's the plug, you know, and basically just, yeah, we keep going.
So all of these, all of these are looking, looking awesome.
So I'm super excited with it.
But now let me just, now that we have this set up, let's run it through one more time through the cost
calculator, and then we're going to run the large data set, just because I want you guys to be
prepared to go and do this on your own and see how much money you're saving using Grok versus using
ChatGPT.
So in this one, we're just going to say all in all, we'll say 1500 prompt tokens and about 4000
completion tokens and 18.
So if we come back over here, we said 15, 1500 over here.
Then we said, sorry, 15,000.
It's a big difference over there.
And then we said 4k over here for output tokens.
And then we said we did 18 API calls.
So here's how much this would have cost using GPT for turbo.
All in all, this would have cost about almost five bucks.
And this seems a little high.
It really most likely won't be that much.
It's just for whatever reason, this is, this is a little excessive, but working with these crews does get
expensive. So I definitely plan on myself using Grok a lot more when I'm building out my
implementations and experimenting with different crews.
Okay, well, now that we have that finally set up, what I'm gonna do is one more time.
I'm just going to go ahead and run the large dataset just so you can see how this works.
So once more, we're going to head back over here.
We're going to update this to large.
Save it. Let's print it off one more time.
Let it run. Let's just get clear it.
Clear it. Now we'll run it and I'll report back to you guys as soon as it's done.
All right, guys. So we just finished wrapping up.
It took a little over two minutes to go through and actually generate all 19 or 20 of these
different cold outreach emails, which is crazy because if you and I were to write these, this would
take way longer than two minutes.
So this is absolutely insane.
I hope you guys see the value of using Grok.
And now that you've actually seen it, I just want to do one more quick tip and trick on actually how to
use this tool.
The main recaps that I think are important for you to know is this max iteration.
Anytime I set this to a high number, these agents would get confused and go off and do their own
thing. So make sure you keep this as low as possible.
This took me hours to figure out.
So definitely keep that very low and you'll have a lot of success.
Now, if you're also getting a lot of issues with potential rate limiting, we didn't today, but
sometimes you'll actually get a lot of red errors saying, hey, you've been rate limited.
If you're getting a lot of those errors, I would probably drop the async execution on your task and
that'll make sure your life goes a lot smoother.
And then also, like I said, we did something fancy today with our dynamic task generation.
This is just a nice way to take away some of the planning and logic from our crew and just say, hey,
man, do this, do this, you're done.
And then just keep doing that for every person we want to do a cold outreach to.
And the final one is we want to make sure we stay under that limit of 30 requests per minute set by
Grok. So that's why I go ahead and do 29 just to make sure we're safe just in case something goes
weird. But yeah, that's those are the biggest tips for setting up and customizing your crew that I
hope you guys this will save you hours of work because it definitely cost me a bunch of time trying
to figure this out. A few other learnings I want you guys to know about whenever you are using
Grok, I would not use it whenever you're doing the like hierarchical process for crew.
Every time I did that, it had some troubles planning.
And whenever I had trouble planning, it ended up trying to call task and agents that didn't
existed. And I kind of had a lot of issues with it.
So that's why I was a bigger fan of using dynamic task and take the workload off of Grok.
But here's what I plan on doing going forward.
I plan on creating all of my crews initially using Grok because it's faster to test with and it's
completely for free. So we'll save some money.
So I hope you guys, once you're going off as well and doing this on your own, I hope you guys start
using Grok in your own projects.
But that's a wrap for this video, guys.
I hope you enjoyed learning how Grok and Crew AI can work together.
And just as a recap, all the source code for this video is completely for free.
Just click that link down description below.
I also created a free school community for you guys so you can talk with like minded AI
developers and get support if you ran into any issues while working on the code in this
video. But outside of that, I have a ton of other Crew AI content on this channel.
So you'll definitely want to check that out after this video.
And I hope you guys have a great rest of your day.
I can't wait to see you all in the next video.
See ya.