From the course: Creating Agents with CrewAI
Running the technical writing crew
From the course: Creating Agents with CrewAI
Running the technical writing crew
- [Instructor] So here is where the rubber meets the road. We'll be running our technical writing Crew that we've been building so far in this section. And we'll be observing the output to see if it gets us our expected result. The code that runs this Crew is contained in the main.py file, so let's go and open that up. This file contains a couple of functions defined for different operations that can be performed on the Crew. There is the run method, which is the main function we'll be working on and testing in this video. This function is responsible for, you guessed it, running the entire Crew workflow. Next, we have the train method. This method can be used to train your Crew and provide feedback on outputs, and eventually, make the Crew smarter. We also have the replay method. This method allows you to jump to a specific task in the Crew and replay the workflow from that task as a starting point. And lastly, we have the test method. This method, when executed, will run your Crew for a specified number of iterations, and provide detailed performance metrics. This is useful for improving your Crew's performance over time. While all these functions are great, in this video, we're only going to be concerned with the run method. Inside this method, we see an input variable defined. This is a dictionary for passing any dynamic parameters we have introduced into our tasks or agents. For our technical writing Crew, we only have one dynamic variable, which is a topic that we would like to write an article about. Let us refactor the input's dictionary so that we can define our topic variable. This already has topics, so we'll just use that. And the topic we're going to be writing on is (keyboard clacking) Introduction to GraphQL. One of my very popular articles. Now, you can make this write any article of your choice, but I have a special preference for this particular topic. So we're going to be testing this Crew out to write an article on Introduction to GraphQL. After the input's dictionary, we then see a try card block where our technical writing Crew class runs the Crew method. You know, the one that we defined here. And for the Crew return, we run our kickoff method, passing in our inputs variable. And that's everything we need to implement here in order to run our Crew. So to run our Crew, let us pull up our command line. Now you can run any function defined in this main.py file in your console, and you can do that using the CrewAI CLI tool. You can run train, you can run replay, and you can run test. But for this demo, we are only interested in run, so I'm going to say (keyboard clacking) CrewAI run. This is going to run our entire Crew workflow. Now we're going to be having a lot of details back, so let me bring this up very well, and let us run (keyboard clacking) CrewAI run. So we see the Crew going into action. The agents are doing their thinking. Getting some details back from some web search here. You can see links. And now our article strategist is in play, analyzing and drafting an article, and basically, running commentary for this log now. (chuckling) So now we have our technical writer, onto our technical writer. Our technical writer is writing out our article. And it is going to pass it on to our editor. The article writing seems to be the longest process because this is taking quite some time. Now we are onto our editor and reviewer. Okay, the task is to review the complete article draft here, so we're reviewing now. Once we're done reviewing, then we're going to go to formatting. And now we are formatting. The final draft is being written. Ensuring that it's correctly formatted. The Crew is done. I will get the Crew completion message. Simply awesome. So we are done. Now let us see what we produced, because we told it to produce a markdown file for us, so I'm just going to close out of this, then go to my file window, and we scroll. You can see technicalarticle.md. Let's open that up. There's a markdown preview here. Let me pull this to the side. So we have a preview of our article here, but something seems to be wrong. This is not- Oh, there's this markdown. I don't think we need this. So, yeah, this looks better. Let me scroll and remove it at the end, also. Okay, so if we remove this, yeah, we now have our article. There's a preview of our article, markdown, Understanding GraphQL: Revolutionizing API Interactions. So we have our introduction, which talks about how GraphQL was created by Facebook in 2025. Then, what is GraphQL? The server-side runtime. Key principles of GraphQL, the type system, the single graph concept. Has query hierarchy. Then we start seeing code examples. How awesome is that? Start seeing code examples. Use cases for GraphQL, enhanced data efficiency, integration with multiple data sources, best practices, schema design, optimization of queries. We have more examples here. Then some security considerations, challenges and considerations, and how to transition from REST to GraphQL. And a conclusion, with references. How amazing is that? You saw this demo from beginning. You saw that we put together agents, tasks, and we got a multi-agent system to write a complete article for us. A complete article, well-structured, well-formatted, even including a list of references. How amazing is that?