OpenLIT은 오픈 소스 도구로, 단 한 줄의 코드만으로 AI 에이전트, LLM, VectorDB, GPU의 성능을 간편하게 모니터링할 수 있습니다.OpenTelemetry-기반의 트레이싱 및 메트릭을 제공하여 비용, 지연 시간, 상호작용, 작업 시퀀스와 같은 주요 파라미터를 추적할 수 있습니다.
이 설정을 통해 하이퍼파라미터를 추적하고 성능 문제를 모니터링하며, 시간이 지남에 따라 에이전트를 개선하고 미세 조정할 방법을 찾을 수 있습니다.
from crewai import Agent, Task, Crew, Processimport openlitopenlit.init(disable_metrics=True)# 에이전트 정의researcher = Agent( role="Researcher", goal="Conduct thorough research and analysis on AI and AI agents", backstory="You're an expert researcher, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently researching for a new client.", allow_delegation=False, llm='command-r')# 작업 정의task = Task( description="Generate a list of 5 interesting ideas for an article, then write one captivating paragraph for each idea that showcases the potential of a full article on this topic. Return the list of ideas with their paragraphs and your notes.", expected_output="5 bullet points, each with a paragraph and accompanying notes.",)# 매니저 에이전트 정의manager = Agent( role="Project Manager", goal="Efficiently manage the crew and ensure high-quality task completion", backstory="You're an experienced project manager, skilled in overseeing complex projects and guiding teams to success. Your role is to coordinate the efforts of the crew members, ensuring that each task is completed on time and to the highest standard.", allow_delegation=True, llm='command-r')# 커스텀 매니저로 crew 인스턴스화crew = Crew( agents=[researcher], tasks=[task], manager_agent=manager, process=Process.hierarchical,)# crew 작업 시작result = crew.kickoff()print(result)
import asynciofrom crewai import Crew, Agent, Taskimport openlitopenlit.init(otlp_endpoint="http://127.0.0.1:4318")# 코드 실행이 활성화된 에이전트 생성coding_agent = Agent( role="Python Data Analyst", goal="Analyze data and provide insights using Python", backstory="You are an experienced data analyst with strong Python skills.", allow_code_execution=True, llm="command-r")# 코드 실행이 필요한 작업 생성data_analysis_task = Task( description="Analyze the given dataset and calculate the average age of participants. Ages: {ages}", agent=coding_agent, expected_output="5 bullet points, each with a paragraph and accompanying notes.",)# crew 생성 후 작업 추가analysis_crew = Crew( agents=[coding_agent], tasks=[data_analysis_task])# crew를 비동기적으로 kickoff 하는 함수async def async_crew_execution(): result = await analysis_crew.kickoff_async(inputs={"ages": [25, 30, 35, 40, 45]}) print("Crew Result:", result)# 비동기 함수 실행asyncio.run(async_crew_execution())
이제 에이전트 관찰 데이터가 수집되어 OpenLIT으로 전송되고 있으므로, 다음 단계는 이 데이터를 시각화하고 분석하여 에이전트의 성능, 행동 및 개선이 필요한 영역에 대한 인사이트를 얻는 것입니다.브라우저에서 127.0.0.1:3000으로 접속하여 바로 시작할 수 있습니다. 기본 자격 증명으로 로그인 가능합니다