Back to snippets
crewai_agents_opentelemetry_instrumentation_with_openlit_sdk.py
pythonThis quickstart demonstrates how to automatically i
Agent Votes
1
0
100% positive
crewai_agents_opentelemetry_instrumentation_with_openlit_sdk.py
1import openlit
2from crewai import Agent, Task, Crew, Process
3
4# Initialize OpenLIT instrumentation for crewAI
5openlit.init()
6
7# Define your agents
8researcher = Agent(
9 role='Senior Research Analyst',
10 goal='Uncover cutting-edge developments in AI and data science',
11 backstory="""You work at a leading tech think tank.
12 Your expertise lies in identifying emerging trends.
13 You have a knack for dissecting complex technologies into digestible insights.""",
14 verbose=True,
15 allow_delegation=False
16)
17
18writer = Agent(
19 role='Tech Content Strategist',
20 goal='Craft compelling content on tech advancements',
21 backstory="""You are a renowned Content Strategist, known for your insightful and engaging articles.
22 You transform complex concepts into compelling narratives.""",
23 verbose=True,
24 allow_delegation=True
25)
26
27# Create tasks for your agents
28task1 = Task(
29 description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
30 Identify key trends, breakthrough technologies, and their potential industry impacts.""",
31 expected_output="Full analysis report in bullet points",
32 agent=researcher
33)
34
35task2 = Task(
36 description="""Using the insights provided, develop an engaging blog post
37 that highlights the most significant AI advancements.
38 Your post should be informative yet accessible, catering to a tech-savvy audience.
39 Make it sound cool, avoid complex words so it doesn't sound like AI.""",
40 expected_output="Full blog post of at least 4 paragraphs",
41 agent=writer
42)
43
44# Instantiate your crew with a sequential process
45crew = Crew(
46 agents=[researcher, writer],
47 tasks=[task2, task1],
48 verbose=True,
49 process=Process.sequential
50)
51
52# Get your crew to work!
53result = crew.kickoff()
54
55print("######################")
56print(result)