Build A Local Reliable RAG Agent Using CrewAI And Groq

Plaban Nayak
The AI Forum
Published in
36 min readJun 16, 2024

Introduction

Here we will build reliable RAG agents using CrewAI, Groq-Llama-3 and CrewAI PDFSearchTool. AI agents are emerging as game-changers, quickly becoming partners in problem-solving, creativity, and innovation and that’s where CrewAI comes in.

What is an Agent?

According to CrewAI an agent is an autonomous unit programmed to:

  • Perform tasks
  • Make decisions
  • Communicate with other agents

What is Crew AI ?

from source

CrewAI is an open-source framework designed to empower users to create and manage teams of intelligent agents. These agents, unlike traditional chatbots, can collaborate and share information, tackling complex tasks together.

Imagine a team of experts working together. Each member has specific skills and knowledge, but by communicating and delegating tasks, they can achieve far more than any individual could alone. CrewAI takes this collaborative approach to the world of AI. Here we can define individual agents, each with its own strengths and weaknesses, and CrewAI orchestrates their interactions to achieve a common goal.

CrewAI’s core components:

  • Agents: These are the building blocks of your crew. You define each agent’s role, goals, and backstory. This context helps guide the agent’s decisions and responses.
  • Tools: Agents can be augmented with custom tools that enhance their capabilities. These tools can be anything from information retrieval modules to data analysis scripts.
  • Tasks: You define the tasks your crew needs to accomplish. Each task can be assigned to a specific agent or distributed among the team based on their expertise.
  • Processes: Complex tasks can be broken down into smaller, more manageable processes. CrewAI allows you to define these processes and orchestrate the flow of information between agents.
  • Crew: A crew represents a collaborative group of agents working together to achieve a set of tasks. Each crew defines the strategy for task execution, agent collaboration, and the overall workflow.
From Source

Advantages of using CrewAI

  • Collaborative Intelligence: Agents work together, leveraging each other’s strengths to tackle complex problems.
  • Modular Design: The modular structure makes it easy to scale your crew and add new functionalities.
  • Flexibility: CrewAI integrates with various LLMs and allows for custom tool development, giving you control over your agents’ capabilities.

What is Groq ?

From Source

Groq is a hardware and software platform that delivers exceptional compute speed, quality, and energy efficiency supported by the LPU™ Inference Engine.

An LPU Inference Engine, (Language Processing Unit™), is a hardware and software platform that delivers exceptional compute speed, quality, and energy efficiency. This new type of end-to-end processing unit system provides the fastest inference for computationally intensive applications with sequential components, such as AI language applications like Large Language Models (LLMs).

Advantages

  • The LPU is designed to overcome the two LLM bottlenecks: compute density and memory bandwidth.
  • An LPU has greater compute capacity than a GPU and CPU in regards to LLMs.
  • Reduced amount of time per word calculated, allowing sequences of text to be generated much faster.
  • Eliminates external memory bottlenecks enabling the LPU Inference engine to deliver orders of magnitude better performance on LLMs compared to GPUs.

Usage

Developer access can be obtained completely self-serve through Playground on GroqCloud. There we can obtain our API key and access our documentation as well as our terms and conditions on Playground.
If we are currently using OpenAI API, we just need three things to convert over to Groq:

  1. Groq API key
  2. Endpoint
  3. Model

Different Models available in Groq and corresponding token limits

Here we will build a RAG Agent which will generate response for the question asked by retrieving relevant context if bthe question asked is about ESOPs otherwise the Agent will perform a web search to retrieve the required context and formulate a response that can be presented to the user.

The RAG agent comprises of the following components:

  1. Router Agent: This agent decides whether to perform a RAG or external web search based on the context of the question asked.
  2. Retriever Agent : This Agent retrieves context relevant to the question asked based on the mode suggested by the Router Agent.
  3. Grader Agent: This Agent grades the context retrieved and check for the context relevancy with question asked.
  4. Hallucination Grader Agent : This Agents grades the response from Retriever agent based on Usefulness and Facts
  5. Answer Grader Agent: This Agent Generates the Final Response.
  6. Router Task : Define task and expected output layout for Router Agent
  7. Retriever Task: Define task and expected output layout for Retriever Agent
  8. Grader Task : Define task and expected output layout for Grader Agent
  9. Hallucination Grader Task: Define task and expected output layout for Hallucination Grader Agent
  10. Answer Task : Define task and expected output layout for Answer grader Agent
  11. Web Search Tool : Tool to perform external search
  12. PDFSearchTool : CrewAI RAG tool designed for semantic searches within PDF content.
  13. Llama3–8B as the Large Language Model

Code Implementation

Code implemented in Google Colab using CPU

Install Required Dependencies

!pip install -qU crewai
!pip install crewai_tools
!pip install -qU langchain-groq
!pip install sentence-transformers

Generate and setup the GROQ_API_KEY

from google.colab import userdata
import os
os.environ['GROQ_API_KEY'] = userdata.get('GROQ_API_KEY')

Download input data for RAG(ESOP info)

!wget "https://www.icsi.edu/media/webmodules/CSJ/January/17.pdf"

Setup the LLM

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
openai_api_base="https://api.groq.com/openai/v1",
openai_api_key=os.environ['GROQ_API_KEY'],
model_name="llama3-8b-8192",
temperature=0,
max_tokens=1000,
)

Create Tools

Define the PDFSerachTool using custom model and embeddings

The PDFSearchTool is a RAG tool designed for semantic searches within PDF content. It allows for inputting a search query and a PDF document, leveraging advanced search techniques to find relevant content efficiently. This capability makes it especially useful for extracting specific information from large PDF files quickly.

from crewai_tools import PDFSearchTool

rag_tool = PDFSearchTool(pdf='/content/17.pdf',
config=dict(
llm=dict(
provider="groq", # or google, openai, anthropic, llama2, ...
config=dict(
model="llama3-8b-8192",
# temperature=0.5,
# top_p=1,
# stream=true,
),
),
embedder=dict(
provider="huggingface", # or openai, ollama, ...
config=dict(
model="BAAI/bge-small-en-v1.5",
#task_type="retrieval_document",
# title="Embeddings",
),
),
)
)

Test the Tool Created

rag_tool.run("How does exercise price determine for ESOP?")

##########################Response#########################
Relevant Content:
options or shares. The employees are only able to obtain these shares once the ESOP vesting term has completed. Exercise period: It means the time period which starts after the completion of vesting period within which an employee can exercise his/her right to apply for shares against the vested options in pursuance of the scheme of ESOP approved by the shareholders in general meeting by way of Special Resolution. Exercise price: Means the price payable by an employee for exercising the options granted in pursuance of the scheme of ESOP. ARTICLE JANUARY 2024 | 107 CHARTERED SECRETARY

ESOP? A. Companies are free to decide the exercise price, which may be issued at a discount or premium but the exercise price determined by the Company shall not be less than the par value of the shares. Q. Does it mandatory for the Company to issue and allot only fresh shares under ESOP scheme? A. No, it is not mandatory for the company to issue and allot only fresh shares under ESOP scheme, but it may choose either option: 1. If Company is willing to issue fresh shares, it should adopt direct route to issue and allot shares under the scheme of ESOP. 2. If the Company is willing to channelize its existing share only, in such case Company should adopt Trust route to issue and allot shares under the scheme of ESOP. Q. How are ESOP taxed in India? A. ESOPs have dual tax effects: 1. When an employee exercises their rights and purchases company’s stock. 2. When the employee sells the stock after exercising the option. TAX TREATMENT AT THE TIME OF BUYING THE SHARES Employees can exercise

FAQs Q. What is an ESOP? A. Thus, we can say that ‘ESOP’ stands for ‘Employee Stock Option Plan’ which is a kind of employee benefit plan that gives employees the right to purchase shares of their employer company at a pre-determined price after a certain time period. Q. Does the ESOP supplement the salary of an employee? A. From the point view of monetary benefits, we can say that ESOPs are often used to supplement the salaries of employees. Instead of paying high salary, employees may be offered ESOPs, which may generate more wealth for employees if the Company is growing and generating good amount of earnings which is over and above break-even point. Q. Is ESOP risky and having any possibility of monetary loss? A. It may be risky, if an employee accepts ESOPs instead of a higher salary, and the organization where they are employed is not growing as per the market standards or in comparison to its competitors, ESOP may result in monetary loss. Q. How does exercise price determine for

Create Web Search Tool

import os
from langchain_community.tools.tavily_search import TavilySearchResults
os.environ['TAVILY_API_KEY'] = userdata.get('TAVILY_API_KEY')
web_search_tool = TavilySearchResults(k=3)

Test the Web Search Tool

web_search_tool.run("How does exercise price determine for ESOP?")

#######################Response##########################
[{'url': 'https://www.vega-equity.com/blog/how-to-calculate-exercise-price-in-esops',
'content': "Now coming back to the exercise price in ESOPs, it is the price at which the shareholder can purchase the share options. Often termed the Strike price, the exercise price becomes active once the vesting period is completed. This price is set at the stock's fair market value at the time the stock options are granted."},
{'url': 'https://www.trica.co/equity/blog/how-to-calculate-exercise-price-in-esops/',
'content': "To begin with, the exercise price in ESOP is used to determine the amount required to exercise the options and the tax ramifications of doing so. In return for the shares, the employee must pay the strike price multiplied by the number of vested options the employee desires to exercise. The difference between the stock's current Fair Market ..."},
{'url': 'https://nodeflair.com/blog/employee-stock-ownership-plan-esop-101',
'content': 'It applies regardless of where you exercise the ESOP or where the shares vest. Without Selling Restrictions. For example, if your exercise price is $1 per share, the company underwent an IPO at $10 per share, and you exercise your options today: Taxable profit: The difference between the market price ($10) and the exercise price ($1) is $9 per ...'},
{'url': 'https://www.arrowfishconsulting.com/esop-valuation/',
'content': "Experts use this method to calculate the difference between the market price per share and the exercise price of the option. This is the 'imputed gain' that an employee receives by selling their option. For example. An employee has an option to buy 100 shares of the company at $10 per share, and the current market price of the share is $15."},
{'url': 'https://www.fairvalueacademy.org/employee-share-options-esops/',
'content': "The exercise multiple factors in early exercise behavior (i.e. assuming the grantees would exercise the Options when XYZ's stock price equals a certain multiple of the Option's exercise price). For example, an Exercise Multiple of 2x assumes that the Grantees would exercise the Options when XYZ's Share Price is 2x its Exercise Price ..."}]

Create Custom Tool to facilitate the Router Agent

from crewai_tools  import tool
@tool
def router_tool(question):
"""Router Function"""
if 'ESOP' in question:
return 'vectorstore'
else:
return 'web_search'

Define our agents

Agent Parameters used :

  • Role : Defines the agent’s function within the crew. It determines the kind of tasks the agent is best suited for.
  • Goal : The individual objective that the agent aims to achieve. It guides the agent’s decision-making process.
  • Backstory :Provides context to the agent’s role and goal, enriching the interaction and collaboration dynamics.
  • LLM (optional): Represents the language model that will run the agent. It dynamically fetches the model name from the OPENAI_MODEL_NAME environment variable, defaulting to "gpt-4" if not specified.
  • Verbose (optional): Setting this to True configures the internal logger to provide detailed execution logs, aiding in debugging and monitoring. Default is False.
  • Allow Delegation (optional): Agents can delegate tasks or questions to one another, ensuring that each task is handled by the most suitable agent. Default is True.
  1. Router Agent
Router_Agent = Agent(
role='Router',
goal='Route user question to a vectorstore or web search',
backstory=(
"You are an expert at routing a user question to a vectorstore or web search."
"Use the vectorstore for questions on concepta related to Retrieval-Augmented Generation."
"You do not need to be stringent with the keywords in the question related to these topics. Otherwise, use web-search."
),
verbose=True,
allow_delegation=False,
llm=llm,
)

2. Retriever Agent

Retriever_Agent = Agent(
role="Retriever",
goal="Use the information retrieved from the vectorstore to answer the question",
backstory=(
"You are an assistant for question-answering tasks."
"Use the information present in the retrieved context to answer the question."
"You have to provide a clear concise answer."
),
verbose=True,
allow_delegation=False,
llm=llm,
)

3. Grader Agent

Grader_agent =  Agent(
role='Answer Grader',
goal='Filter out erroneous retrievals',
backstory=(
"You are a grader assessing relevance of a retrieved document to a user question."
"If the document contains keywords related to the user question, grade it as relevant."
"It does not need to be a stringent test.You have to make sure that the answer is relevant to the question."
),
verbose=True,
allow_delegation=False,
llm=llm,
)

4. Hallucination Grader Agent

hallucination_grader = Agent(
role="Hallucination Grader",
goal="Filter out hallucination",
backstory=(
"You are a hallucination grader assessing whether an answer is grounded in / supported by a set of facts."
"Make sure you meticulously review the answer and check if the response provided is in alignmnet with the question asked"
),
verbose=True,
allow_delegation=False,
llm=llm,
)

5. Answer Grader Agent

answer_grader = Agent(
role="Answer Grader",
goal="Filter out hallucination from the answer.",
backstory=(
"You are a grader assessing whether an answer is useful to resolve a question."
"Make sure you meticulously review the answer and check if it makes sense for the question asked"
"If the answer is relevant generate a clear and concise response."
"If the answer gnerated is not relevant then perform a websearch using 'web_search_tool'"
),
verbose=True,
allow_delegation=False,
llm=llm,
)

Define Tasks for the agents

Task Parameters

  • Description: A clear, concise statement of what the task entails.
  • Agent: The agent responsible for the task, assigned either directly or by the crew’s process.
  • Expected Output: A detailed description of what the task’s completion looks like.
  • Tools (optional): The functions or capabilities the agent can utilize to perform the task
  • Context (optional): Specifies tasks whose outputs are used as context for this task.
  1. Router Task
router_task = Task(
description=("Analyse the keywords in the question {question}"
"Based on the keywords decide whether it is eligible for a vectorstore search or a web search."
"Return a single word 'vectorstore' if it is eligible for vectorstore search."
"Return a single word 'websearch' if it is eligible for web search."
"Do not provide any other premable or explaination."
),
expected_output=("Give a binary choice 'websearch' or 'vectorstore' based on the question"
"Do not provide any other premable or explaination."),
agent=Router_Agent,
tools=[router_tool],
)

2. Retriever Task

retriever_task = Task(
description=("Based on the response from the router task extract information for the question {question} with the help of the respective tool."
"Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'."
"Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'."
),
expected_output=("You should analyse the output of the 'router_task'"
"If the response is 'websearch' then use the web_search_tool to retrieve information from the web."
"If the response is 'vectorstore' then use the rag_tool to retrieve information from the vectorstore."
"Return a claer and consise text as response."),
agent=Retriever_Agent,
context=[router_task],
#tools=[retriever_tool],
)

3. Grader Task

grader_task = Task(
description=("Based on the response from the retriever task for the quetion {question} evaluate whether the retrieved content is relevant to the question."
),
expected_output=("Binary score 'yes' or 'no' score to indicate whether the document is relevant to the question"
"You must answer 'yes' if the response from the 'retriever_task' is in alignment with the question asked."
"You must answer 'no' if the response from the 'retriever_task' is not in alignment with the question asked."
"Do not provide any preamble or explanations except for 'yes' or 'no'."),
agent=Grader_agent,
context=[retriever_task],
)

4. Hallucination Grader Task

hallucination_task = Task(
description=("Based on the response from the grader task for the quetion {question} evaluate whether the answer is grounded in / supported by a set of facts."),
expected_output=("Binary score 'yes' or 'no' score to indicate whether the answer is sync with the question asked"
"Respond 'yes' if the answer is in useful and contains fact about the question asked."
"Respond 'no' if the answer is not useful and does not contains fact about the question asked."
"Do not provide any preamble or explanations except for 'yes' or 'no'."),
agent=hallucination_grader,
context=[grader_task],
)

5. Answer grader Task

answer_task = Task( 
description=("Based on the response from the hallucination task for the quetion {question} evaluate whether the answer is useful to resolve the question."
"If the answer is 'yes' return a clear and concise answer."
"If the answer is 'no' then perform a 'websearch' and return the response"),
expected_output=("Return a clear and concise response if the response from 'hallucination_task' is 'yes'."
"Perform a web search using 'web_search_tool' and return ta clear and concise response only if the response from 'hallucination_task' is 'no'."
"Otherwise respond as 'Sorry! unable to find a valid response'."),
context=[hallucination_task],
agent=answer_grader,
#tools=[answer_grader_tool],
)

Setup the Crew

In CrewAI, processes orchestrate the execution of tasks by agents, akin to project management in human teams. These processes ensure tasks are distributed and executed efficiently, in alignment with a predefined strategy.

Process Implementations

  • Sequential: Executes tasks sequentially, ensuring tasks are completed in an orderly progression.
  • Hierarchical: Organizes tasks in a managerial hierarchy, where tasks are delegated and executed based on a structured chain of command. A manager language model (manager_llm) must be specified in the crew to enable the hierarchical process, facilitating the creation and management of tasks by the manager.
  • Consensual Process (Planned): Aiming for collaborative decision-making among agents on task execution, this process type introduces a democratic approach to task management within CrewAI. It is planned for future development and is not currently implemented in the codebase.

By default the process is implemented as a Sequential process if no process is mentioned.

rag_crew = Crew(
agents=[Router_Agent, Retriever_Agent, Grader_agent, hallucination_grader, answer_grader],
tasks=[router_task, retriever_task, grader_task, hallucination_task, answer_task],
verbose=True,

)

Define the input

inputs ={"question":"Does the ESOP supplement the salary of an employee?"}

Kickoff the Crew

result = rag_crew.kickoff(inputs=inputs)


############################Response###################################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question Does the ESOP supplement the salary of an employee?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

vectorstore

Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question Does the ESOP supplement the salary of an employee? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer using the vectorstore.

Final Answer: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.

> Finished chain.
[DEBUG]: == [Retriever] Task output: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the retriever task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the retrieved content is relevant to the question.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

Final Answer: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.


[DEBUG]: == Working Agent: Hallucination Grader
[INFO]: == Starting Task: Based on the response from the grader task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the answer is grounded in / supported by a set of facts.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a thorough evaluation of the answer.

Action: I will meticulously review the answer and assess whether it is grounded in or supported by a set of facts.

Final Answer: No

The answer states that the retrieved document does not explicitly state whether the ESOP supplements the salary of an employee. Although it provides information on how ESOP works and its benefits, it does not directly answer the question. Therefore, the answer is scored as "No" since it does not provide a clear and direct answer to the question.

> Finished chain.
[DEBUG]: == [Hallucination Grader] Task output: No

The answer states that the retrieved document does not explicitly state whether the ESOP supplements the salary of an employee. Although it provides information on how ESOP works and its benefits, it does not directly answer the question. Therefore, the answer is scored as "No" since it does not provide a clear and direct answer to the question.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the hallucination task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the answer is useful to resolve the question.If the answer is 'yes'; return a clear and concise answer.If the answer is 'no' then perform a 'websearch' and return the response


> Entering new CrewAgentExecutor chain...
Thought: I will re-evaluate the answer and determine if it is useful to resolve the question.

Action: Since the answer is "No", I will perform a web search using the 'web_search_tool' to find a more relevant answer.

Final Answer:

The Employee Stock Ownership Plan (ESOP) is a type of retirement plan that allows employees to own shares of the company they work for. While an ESOP is not a direct supplement to an employee's salary, it can provide a sense of ownership and motivation for employees. In some cases, an ESOP can also provide a retirement benefit to employees. However, it is not a direct supplement to an employee's salary.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: The Employee Stock Ownership Plan (ESOP) is a type of retirement plan that allows employees to own shares of the company they work for. While an ESOP is not a direct supplement to an employee's salary, it can provide a sense of ownership and motivation for employees. In some cases, an ESOP can also provide a retirement benefit to employees. However, it is not a direct supplement to an employee's salary.
print(result)

###############################Response###########################
The Employee Stock Ownership Plan (ESOP) is a type of retirement plan that allows employees to own shares of the company they work for.
While an ESOP is not a direct supplement to an employee's salary, it can provide a sense of ownership and motivation for employees.
In some cases, an ESOP can also provide a retirement benefit to employees. However, it is not a direct supplement to an employee's salary.

Let us test agent by agent functioning and completion

  1. Test The Router Agent
rag_crew = Crew(
agents=[Router_Agent],
tasks=[router_task],
verbose=True,

)
inputs ={"question":"Does the ESOP supplement the salary of an employee?"}
result = rag_crew.kickoff(inputs=inputs)

#################Response########################################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question Does the ESOP supplement the salary of an employee?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

vectorstore

Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore

2. Test the Retriever Agent

rag_crew = Crew(
agents=[Router_Agent,Retriever_Agent],
tasks=[router_task,retriever_task],
verbose=True,

)
inputs ={"question":"Does the ESOP supplement the salary of an employee?"}
result = rag_crew.kickoff(inputs=inputs)

#########################Response#######################################
DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question Does the ESOP supplement the salary of an employee?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

vectorstore

Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question Does the ESOP supplement the salary of an employee? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer using the vectorstore.

Final Answer: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.

> Finished chain.
[DEBUG]: == [Retriever] Task output: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.

3. Test the Grader Agent

rag_crew = Crew(
agents=[Router_Agent,Retriever_Agent,Grader_agent],
tasks=[router_task,retriever_task,grader_task],
verbose=True,

)
inputs ={"question":"Does the ESOP supplement the salary of an employee?"}
result = rag_crew.kickoff(inputs=inputs)

#####################Response#################################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question Does the ESOP supplement the salary of an employee?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

vectorstore

Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question Does the ESOP supplement the salary of an employee? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer using the vectorstore.

Final Answer: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.

> Finished chain.
[DEBUG]: == [Retriever] Task output: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the retriever task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the retrieved content is relevant to the question.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

Final Answer: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.

4. Test the Hallucination Grader Agent

rag_crew = Crew(
agents=[Router_Agent,Retriever_Agent,Grader_agent,hallucination_grader],
tasks=[router_task,retriever_task,grader_task,hallucination_task],
verbose=True,

)
inputs ={"question":"Does the ESOP supplement the salary of an employee?"}
result = rag_crew.kickoff(inputs=inputs)

################################Response################################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question Does the ESOP supplement the salary of an employee?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

vectorstore

Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question Does the ESOP supplement the salary of an employee? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer using the vectorstore.

Final Answer: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.

> Finished chain.
[DEBUG]: == [Retriever] Task output: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the retriever task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the retrieved content is relevant to the question.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

Final Answer: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.


[DEBUG]: == Working Agent: Hallucination Grader
[INFO]: == Starting Task: Based on the response from the grader task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the answer is grounded in / supported by a set of facts.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a thorough evaluation of the answer.

Action: I will meticulously review the answer and assess whether it is grounded in or supported by a set of facts.

Final Answer: No

The answer states that the retrieved document does not explicitly state whether the ESOP supplements the salary of an employee. Although it provides information on how ESOP works and its benefits, it does not directly answer the question. Therefore, the answer is scored as "No" since it does not provide a clear and direct answer to the question.

> Finished chain.
[DEBUG]: == [Hallucination Grader] Task output: No

The answer states that the retrieved document does not explicitly state whether the ESOP supplements the salary of an employee. Although it provides information on how ESOP works and its benefits, it does not directly answer the question. Therefore, the answer is scored as "No" since it does not provide a clear and direct answer to the question.

5. Test the Answer Grader Agent

rag_crew = Crew(
agents=[Router_Agent,Retriever_Agent,Grader_agent,hallucination_grader,answer_grader],
tasks=[router_task,retriever_task,grader_task,hallucination_task,answer_task],
verbose=True,

)
inputs ={"question":"Does the ESOP supplement the salary of an employee?"}
result = rag_crew.kickoff(inputs=inputs)

#############################Response#################################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question Does the ESOP supplement the salary of an employee?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

vectorstore

Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Thought:
Action: router_tool
Action Input: {"question": "Does the ESOP supplement the salary of an employee?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question Does the ESOP supplement the salary of an employee? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer using the vectorstore.

Final Answer: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.

> Finished chain.
[DEBUG]: == [Retriever] Task output: Yes, an Employee Stock Ownership Plan (ESOP) can supplement the salary of an employee. An ESOP is a type of retirement plan that allows employees to own company stock, and it can provide a supplemental income stream to an employee's salary.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the retriever task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the retrieved content is relevant to the question.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

Final Answer: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: No

Note: The retrieved document does not explicitly state whether the ESOP (Employee Stock Ownership Plan) supplements the salary of an employee. However, it does provide information on how ESOP works and its benefits. Therefore, I score it as "No" since it does not directly answer the question.


[DEBUG]: == Working Agent: Hallucination Grader
[INFO]: == Starting Task: Based on the response from the grader task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the answer is grounded in / supported by a set of facts.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a thorough evaluation of the answer.

Action: I will meticulously review the answer and assess whether it is grounded in or supported by a set of facts.

Final Answer: No

The answer states that the retrieved document does not explicitly state whether the ESOP supplements the salary of an employee. Although it provides information on how ESOP works and its benefits, it does not directly answer the question. Therefore, the answer is scored as "No" since it does not provide a clear and direct answer to the question.

> Finished chain.
[DEBUG]: == [Hallucination Grader] Task output: No

The answer states that the retrieved document does not explicitly state whether the ESOP supplements the salary of an employee. Although it provides information on how ESOP works and its benefits, it does not directly answer the question. Therefore, the answer is scored as "No" since it does not provide a clear and direct answer to the question.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the hallucination task for the quetion Does the ESOP supplement the salary of an employee? evaluate whether the answer is useful to resolve the question.If the answer is 'yes'; return a clear and concise answer.If the answer is 'no' then perform a 'websearch' and return the response


> Entering new CrewAgentExecutor chain...
Thought: I will re-evaluate the answer and determine if it is useful to resolve the question.

Action: Since the answer is "No", I will perform a web search using the 'web_search_tool' to find a more relevant answer.

Final Answer:

The Employee Stock Ownership Plan (ESOP) is a type of retirement plan that allows employees to own shares of the company they work for. While an ESOP is not a direct supplement to an employee's salary, it can provide a sense of ownership and motivation for employees. In some cases, an ESOP can also provide a retirement benefit to employees. However, it is not a direct supplement to an employee's salary.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: The Employee Stock Ownership Plan (ESOP) is a type of retirement plan that allows employees to own shares of the company they work for. While an ESOP is not a direct supplement to an employee's salary, it can provide a sense of ownership and motivation for employees. In some cases, an ESOP can also provide a retirement benefit to employees. However, it is not a direct supplement to an employee's salary.

Test the Agent with topic not related to ESOP

rag_crew = Crew(
agents=[Router_Agent, Retriever_Agent, Grader_agent, hallucination_grader, answer_grader],
tasks=[router_task, retriever_task, grader_task, hallucination_task, answer_task],
verbose=True,

)
#
inputs = {"question":"What is Data Distributed Parallelism?"}
result = rag_crew.kickoff(inputs=inputs)

###################################Response#########################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question What is Data Distributed Parallelism?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought: The question is "What is Data Distributed Parallelism?"
Action: router_tool
Action Input: {"question": "What is Data Distributed Parallelism?"}

web_search

Thought: The question is about a technical concept, and it's not directly related to Retrieval-Augmented Generation.
Action: router_tool
Action Input: {"question": "What is Data Distributed Parallelism?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Thought: The question is not related to Retrieval-Augmented Generation, so I'll try a different approach.
Action: router_tool
Action Input: {"question": "What is Data Distributed Parallelism?"}

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



Final Answer: websearch

> Finished chain.
[DEBUG]: == [Router] Task output: websearch


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question What is Data Distributed Parallelism? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer.

Final Answer: Data Distributed Parallelism is a programming technique used to improve the performance and scalability of data processing tasks. It involves breaking down a large dataset into smaller chunks, processing each chunk in parallel across multiple processing units or nodes, and then combining the results. This approach can significantly reduce the processing time and increase the throughput of data-intensive applications.

> Finished chain.
[DEBUG]: == [Retriever] Task output: Data Distributed Parallelism is a programming technique used to improve the performance and scalability of data processing tasks. It involves breaking down a large dataset into smaller chunks, processing each chunk in parallel across multiple processing units or nodes, and then combining the results. This approach can significantly reduce the processing time and increase the throughput of data-intensive applications.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the retriever task for the quetion What is Data Distributed Parallelism? evaluate whether the retrieved content is relevant to the question.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

After reviewing the retrieved document, I believe it is relevant to the question "What is Data Distributed Parallelism?" because the document contains keywords such as "data", "distributed", and "parallelism" which are directly related to the question. The document appears to provide an explanation of the concept, making it a relevant retrieval for the user's query.

Final Answer:
Yes

The final answer is a binary score of "yes" indicating that the retrieved document is relevant to the question.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: Yes

The final answer is a binary score of "yes" indicating that the retrieved document is relevant to the question.


[DEBUG]: == Working Agent: Hallucination Grader
[INFO]: == Starting Task: Based on the response from the grader task for the quetion What is Data Distributed Parallelism? evaluate whether the answer is grounded in / supported by a set of facts.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a thorough evaluation of the answer to determine if it is grounded in / supported by a set of facts.

Action: I will meticulously review the answer and assess whether it is supported by a set of facts.

Final Answer: Yes

> Finished chain.
[DEBUG]: == [Hallucination Grader] Task output: Yes


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the hallucination task for the quetion What is Data Distributed Parallelism? evaluate whether the answer is useful to resolve the question.If the answer is 'yes'; return a clear and concise answer.If the answer is 'no' then perform a 'websearch' and return the response


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

The answer from the hallucination task is "Yes", which means it's relevant to the question "What is Data Distributed Parallelism?". Therefore, I will provide a clear and concise answer based on the given response.

Final Answer:
Data Distributed Parallelism is a technique used to improve the performance and scalability of data processing tasks by dividing the data into smaller chunks and processing them in parallel across multiple nodes or processors. This approach allows for faster processing times and increased throughput, making it particularly useful for large-scale data processing tasks.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: Data Distributed Parallelism is a technique used to improve the performance and scalability of data processing tasks by dividing the data into smaller chunks and processing them in parallel across multiple nodes or processors. This approach allows for faster processing times and increased throughput, making it particularly useful for large-scale data processing tasks.

Testing the Agent on a new question related to ESOP

rag_crew = Crew(
agents=[Router_Agent, Retriever_Agent, Grader_agent, hallucination_grader, answer_grader],
tasks=[router_task, retriever_task, grader_task, hallucination_task, answer_task],
verbose=True,

)
#
inputs = {"question":"How does exercise price determine for ESOP?"}
result = rag_crew.kickoff(inputs=inputs)

###############################Response################################
[DEBUG]: == Working Agent: Router
[INFO]: == Starting Task: Analyse the keywords in the question How does exercise price determine for ESOP?Based on the keywords decide whether it is eligible for a vectorstore search or a web search.Return a single word 'vectorstore' if it is eligible for vectorstore search.Return a single word 'websearch' if it is eligible for web search.Do not provide any other premable or explaination.


> Entering new CrewAgentExecutor chain...
Thought: The question is about how exercise price determines ESOP, which seems to be related to finance and employee stock options.
Action: router_tool
Action Input: {"question": "How does exercise price determine for ESOP?"}

vectorstore

Final Answer: vectorstore

> Finished chain.
[DEBUG]: == [Router] Task output: vectorstore


[DEBUG]: == Working Agent: Retriever
[INFO]: == Starting Task: Based on the response from the router task extract information for the question How does exercise price determine for ESOP? with the help of the respective tool.Use the web_serach_tool to retrieve information from the web in case the router task output is 'websearch'.Use the rag_tool to retrieve information from the vectorstore in case the router task output is 'vectorstore'.


> Entering new CrewAgentExecutor chain...
Thought: I now understand the task requirements and will provide a clear and concise answer using the vectorstore.

Final Answer: The exercise price in an Employee Stock Ownership Plan (ESOP) is determined by the fair market value of the company's stock at the time of the exercise. The exercise price is typically set by the company and is usually equal to the fair market value of the stock. The exercise price is the price at which the employee can purchase the company's stock.

> Finished chain.
[DEBUG]: == [Retriever] Task output: The exercise price in an Employee Stock Ownership Plan (ESOP) is determined by the fair market value of the company's stock at the time of the exercise. The exercise price is typically set by the company and is usually equal to the fair market value of the stock. The exercise price is the price at which the employee can purchase the company's stock.


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the retriever task for the quetion How does exercise price determine for ESOP? evaluate whether the retrieved content is relevant to the question.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

Final Answer: yes

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: yes


[DEBUG]: == Working Agent: Hallucination Grader
[INFO]: == Starting Task: Based on the response from the grader task for the quetion How does exercise price determine for ESOP? evaluate whether the answer is grounded in / supported by a set of facts.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

Final Answer: No

> Finished chain.
[DEBUG]: == [Hallucination Grader] Task output: No


[DEBUG]: == Working Agent: Answer Grader
[INFO]: == Starting Task: Based on the response from the hallucination task for the quetion How does exercise price determine for ESOP? evaluate whether the answer is useful to resolve the question.If the answer is 'yes'; return a clear and concise answer.If the answer is 'no' then perform a 'websearch' and return the response


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer

As I review the response from the hallucination task, I notice that the answer is not directly addressing the question "How does exercise price determine for ESOP?" The response seems to be unrelated to the question, and I'm not confident that it provides a useful answer to resolve the question.

Since the answer is not relevant, I will perform a web search using the 'web_search_tool' to find a more accurate and relevant response.

Please wait while I conduct the web search...

Final Answer:
The exercise price in an Employee Stock Ownership Plan (ESOP) is typically determined by the fair market value of the company's stock at the time of the valuation. The exercise price is usually set at the lower of the fair market value or the par value of the stock. The ESOP administrator or the company's board of directors typically determines the exercise price. The exercise price is used to calculate the number of shares that an employee can purchase through the ESOP.

> Finished chain.
[DEBUG]: == [Answer Grader] Task output: The exercise price in an Employee Stock Ownership Plan (ESOP) is typically determined by the fair market value of the company's stock at the time of the valuation. The exercise price is usually set at the lower of the fair market value or the par value of the stock. The ESOP administrator or the company's board of directors typically determines the exercise price. The exercise price is used to calculate the number of shares that an employee can purchase through the ESOP.
print(result)

################################Response#############################
The exercise price in an Employee Stock Ownership Plan (ESOP) is typically determined by the fair market value of the company's stock at the time of the valuation. The exercise price is usually set at the lower of the fair market value or the par value of the stock. The ESOP administrator or the company's board of directors typically determines the exercise price. The exercise price is used to calculate the number of shares that an employee can purchase through the ESOP.

How it works

Behind the scenes, each CrewAI Agent is essentially a LangChain Agent, but enhanced with a ReActSingleInputOutputParser. This parser is specially modified to better support role-playing, incorporates a binding stop word for contextual focus, and integrates a memory mechanism (using LangChain’s ConversationSummaryMemory) for continuity in tasks.

In the current iteration, Agents function autonomously, engaging in self-dialogue to determine the use of tools.

Tasks are assigned to Agents from their creation on the current version, and offer the ability to override the available tools that Agent will have at its disposal when performing work, this makes it easier to steer the same Agent in performing slightly different tasks while not overwhelming it with too many tools.

The Crew serves as a framework that encapsulates both Agents and Tasks, facilitating their sequential execution of work.

Conclusion

CrewAI represents a significant advancement in AI agent development by offering a lightweight framework that emphasizes collaboration and role-playing, prioritizing versatility and efficiency. It serves as a valuable tool for both engineers and creatives, enabling the seamless integration of AI agents into cohesive, high-performing teams.

Whether it’s transforming an initial idea into a fully-developed landing page or conducting intricate idea analysis, CrewAI excels at managing a wide range of tasks through its structured processes.

The real-world applications of CrewAI — ranging from enhancing social media presence to creating interactive landing pages — demonstrate its practicality and adaptability. Looking ahead, CrewAI is poised for further evolution, introducing more sophisticated processes and continuously redefining the landscape of AI teamwork. With its user-friendly integration and customization options, CrewAI is not merely a concept but a tangible, powerful tool for harnessing the capabilities of AI agents.

References

connect with me

Note: The code implementation and documentation has been made by referring online resources and in no capacity is proprietary.

--

--