LiuZiyi's picture
initial commit
6fa5083
raw
history blame
2.12 kB
import os
from crewai import Agent, Task, Crew, Process
from crewai_tools import SerperDevTool
from langchain_openai import ChatOpenAI
from dotenv import load_dotenv
load_dotenv()
search_tool = SerperDevTool()
# Define agents with roles and goals
researcher = Agent(
role = "Senior Research Assistant",
goal = "Look up the latest Advancements in AI Agents",
backstory = """
You work at a leading tech think tank.
Your expertise lies in searching Google for AI Agent frameworks.
You have a knack for dissecting complex data and presenting actionable insights.
""",
verbose = True,
allow_delegation = False,
tools=[search_tool],
llm=ChatOpenAI(model_name="gpt-3.5-turbo-0125", temperature=0.2)
)
writer = Agent(
role = "Professional Short-Article Writer",
goal = "Summarise the latest advancement in AI agents in a concise artcle",
backstory = """
You are a renowned Content Strategist, known for your insightful and engaging articles.
You transform complex concepts into compelling narratives.
""",
verbose = True,
allow_delegation = True,
llm=ChatOpenAI(model_name="gpt-3.5-turbo-0125", temperature=0.7)
)
# Create tasks for the agents
research = Task(
description="""
Conduct a comprehensive analysis of the latest advancements in AI Agents in April of 2024.
Identify key trends, breakthrough technologies, and potential industry impacts.
""",
expected_output="Full analysis in bullet points",
agent=researcher
)
write = Task(
description="""
Using the insights provided, write a short article that highlights the most significat AI Agent advancements.
Your post should be informative yet accessible, catering to a tech-savvy audience.
Make it sound cool, avoid complex words so it doesn't sound like AI.
""",
expected_output="Full blog post of at least 3 paragraphs",
agent=writer
)
# Instantiate your crew with a sequential process
crew = Crew(
agents=[researcher,writer],
tasks=[research,write],
verbose=1
)
result = crew.kickoff()
print("####")
print(result)