From 07ea23265973abb9e6efdbf2a9cda2670e616456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Tue, 14 Nov 2023 13:30:08 -0300 Subject: [PATCH] Created Creating a Crew and kick it off (markdown) --- Creating-a-Crew-and-kick-it-off.md | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Creating-a-Crew-and-kick-it-off.md diff --git a/Creating-a-Crew-and-kick-it-off.md b/Creating-a-Crew-and-kick-it-off.md new file mode 100644 index 0000000..d010bca --- /dev/null +++ b/Creating-a-Crew-and-kick-it-off.md @@ -0,0 +1,73 @@ +# Get a crew working + +Assembling a Crew in CrewAI is like casting characters for a play. Each agent you create is a cast member with a unique part to play. When your crew is assembled, you'll give the signal, and they'll spring into action, each performing their role in the grand scheme of your project. + +# Step 1: Assemble Your Agents + +Start by creating your agents, each with its own role and backstory. These backstories add depth to the agents, influencing how they approach their tasks and interact with one another. + +```python +from crewai import Agent + +# Create a researcher agent +researcher = Agent( + role='Researcher', + goal='Discover groundbreaking technologies', + backstory='A curious mind fascinated by cutting-edge innovation and the potential to change the world.' +) + +# Create a writer agent +writer = Agent( + role='Writer', + goal='Craft compelling stories about tech discoveries', + backstory='A creative soul who translates complex tech jargon into engaging narratives for the masses.' +) +``` + +# Step 2: Define the Tasks + +Outline the tasks that your agents need to tackle. These tasks are their missions, the specific objectives they need to achieve. + +```python +from crewai import Task + +# Task for the researcher +research_task = Task( + description='Identify the next big trend in AI', + agent=researcher # Assigning the task to the researcher +) + +# Task for the writer +write_task = Task( + description='Write an article on AI advancements', + agent=writer # Assigning the task to the writer +) +``` + +# Step 3: Form the Crew + +Bring your agents together into a crew. This is where you define the process they'll follow to complete their tasks. + +```python +from crewai import Crew, Process + +# Instantiate your crew +tech_crew = Crew( + agents=[researcher, writer], + tasks=[research_task, write_task], + process=Process.sequential # Tasks will be executed one after the other +) +``` + +# Step 4: Kick It Off + +With the crew formed and the stage set, it's time to start the show. Kick off the process and watch as your agents collaborate to achieve their goals. + +```python +# Begin the task execution +tech_crew.kickoff() +``` + +# Conclusion + +Creating a crew and setting it into motion is a straightforward process in CrewAI. With each agent playing their part and a clear set of tasks, your AI ensemble is ready to take on any challenge. Remember, the richness of their backstories and the clarity of their goals will greatly enhance their performance and the outcomes of their collaboration. \ No newline at end of file