0% found this document useful (0 votes)
123 views3 pages

Crewai Research Document

CrewAI allows for the creation of agents that perform specific tasks within a multi-agent system, characterized by their role, goal, backstory, and tools. Users can define agents and tasks using Python, with the Crew class managing the orchestration of multiple agents and tasks for complex workflows. The document provides examples of defining agents, tasks, and crews, along with installation instructions for the CrewAI package.

Uploaded by

ajafarsadiq2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views3 pages

Crewai Research Document

CrewAI allows for the creation of agents that perform specific tasks within a multi-agent system, characterized by their role, goal, backstory, and tools. Users can define agents and tasks using Python, with the Crew class managing the orchestration of multiple agents and tasks for complex workflows. The document provides examples of defining agents, tasks, and crews, along with installation instructions for the CrewAI package.

Uploaded by

ajafarsadiq2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CrewAI

Basic Agent Creation using CrewAI:​

In CrewAI, an agent is a fundamental component designed to perform specific tasks within a


multi-agent system. Each agent is characterized by its role, goal, backstory, and can be equipped
with various tools and configurations to enhance its functionality.

Key Components of a CrewAI Agent:


❖​ Role: Defines the agent’s function or position within the system. For example, an agent
could be assigned the role of a “Data Researcher” or “Reporting Analyst.”
❖​ Goal: Specifies the objective the agent aims to achieve. This provides direction for the
agent’s actions and decisions.
❖​ Backstory: Offers contextual information or a narrative that can influence the agent’s
behavior and interactions.
❖​ Tools: Agents can be equipped with tools to extend their capabilities, such as web search
engines or data analysis utilities.

Getting Started with CrewAI:


Installation: Ensure you have Python installed. Install CrewAI using pip:

pip install crewai


pip install crewai-tools

Example of Defining an Agent in CrewAI:

from crewai import Agent

researcher = Agent(
role="Senior Data Researcher",
goal="Uncover cutting-edge developments in AI",
backstory="A seasoned researcher with a knack for uncovering the latest
developments in AI.",
tools=[SerperDevTool()],
verbose=True
)
In this example, the researcher agent is assigned a specific role, goal, backstory, and equipped
with the SerperDevTool to enhance its research capabilities.

Tasks in Crew AI:


In CrewAI, the Task class defines units of work that agents execute. Each task is characterized
by attributes such as description, expected output, assigned agent, and optional configurations
like tools and execution settings.

Example of Defining a Task in CrewAI:

from crewai import Task

research_task = Task(
description="Conduct comprehensive research on the latest AI
developments.",
expected_output="A summary report highlighting key advancements in
AI.",
agent=researcher_agent,
tools=[search_tool],
async_execution=True
)
In this example, research_task is defined with a clear description, expected output, assigned
agent “researcher_agent”, a tool “search_tool”, and is set to execute asynchronously.

Crew Class in CrewAI:

In CrewAI, the Crew class orchestrates the collaboration of multiple agents and tasks, enabling
the execution of complex workflows. It serves as the central component that manages the
sequence and interaction of tasks performed by various agents.

Example of Defining a Crew:


Tasks are integrated into a crew, which orchestrates their execution by the assigned agents.

from crewai import Crew, Process

my_crew = Crew(
agents=[researcher],
tasks=[research_task],
process=Process.sequential,
verbose=True
)

To initiate the workflow defined by the crew:

# Start the crew's task execution


result = my_crew.kickoff()
print(result)
The kickoff() method triggers the execution of tasks as per the defined process flow.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy