OpenLIT 통합

OpenLIT 통합 (OpenLIT Integration)

OpenLIT은 한 줄의 코드로 AI 에이전트, LLM, VectorDB, GPU의 성능을 모니터링하기 쉽게 만들어 주는 오픈소스 툴이에요. 비용, 지연 시간, 상호작용, 태스크 시퀀스 같은 중요한 파라미터를 추적하기 위한 OpenTelemetry 네이티브 트레이싱과 메트릭을 제공해요.

출처: 문서

본문

OpenLIT은 한 줄의 코드로 AI 에이전트, LLM, VectorDB, GPU의 성능을 모니터링하기 쉽게 만들어 주는 오픈소스 툴이에요. 비용, 지연 시간, 상호작용, 태스크 시퀀스 같은 중요한 파라미터를 추적하기 위한 OpenTelemetry 네이티브 트레이싱과 메트릭을 제공해요. 이 설정으로 하이퍼파라미터를 추적하고 성능 문제를 모니터링하며, 시간이 지나면서 에이전트를 개선·세부 조정할 방법을 찾을 수 있어요.

Features (기능)

  • Analytics Dashboard — 메트릭, 비용, 사용자 상호작용을 추적하는 상세 대시보드로 에이전트의 상태와 성능을 모니터링.
  • OpenTelemetry-native Observability SDK — 트레이스와 메트릭을 Grafana, DataDog 같은 기존 옵저버빌리티 툴로 보내는 벤더 중립적 SDK.
  • Cost Tracking for Custom and Fine-Tuned Models — 정밀한 예산 책정을 위해 커스텀 가격 파일로 특정 모델의 비용 추정을 조정.
  • Exceptions Monitoring Dashboard — 모니터링 대시보드로 일반적인 예외와 에러를 추적해 문제를 빠르게 발견·해결.
  • Compliance and Security — 욕설(profanity)과 PII 누출 같은 잠재적 위협 감지.
  • Prompt Injection Detection — 잠재적 코드 주입과 시크릿 누출 식별.
  • API Keys and Secrets Management — LLM API 키와 시크릿을 중앙에서 안전하게 처리해 불안전한 관행 방지.
  • Prompt Management — PromptHub로 에이전트 프롬프트를 관리·버전화해 에이전트 간 일관되고 쉬운 접근 제공.
  • Model Playground — 배포 전에 CrewAI 에이전트를 위한 다양한 모델을 테스트·비교.

Setup Instructions (설정 방법)

  1. OpenLIT 배포

    1-1. OpenLIT 저장소 Git Clone

    git clone [email protected]:openlit/openlit.git
    

    1-2. Docker Compose 시작 — OpenLIT Repo의 루트 디렉터리에서 다음 명령을 실행하세요:

    docker compose up -d
    
  2. OpenLIT SDK 설치

    pip install openlit
    
  3. 애플리케이션에서 OpenLIT 초기화 — 애플리케이션 코드에 다음 두 줄을 추가하세요: (함수 인자 사용 또는 환경 변수 사용)

    import openlit
    openlit.init(otlp_endpoint="http://127.0.0.1:4318")
    

    CrewAI 에이전트 모니터링 예시:

    from crewai import Agent, Task, Crew, Process
    import openlit
    
    openlit.init(disable_metrics=True)
    # Define your agents
    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'
    )
    
    
    # Define your task
    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.",
    )
    
    # Define the manager agent
    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'
    )
    
    # Instantiate your crew with a custom manager
    crew = Crew(
        agents=[researcher],
        tasks=[task],
        manager_agent=manager,
        process=Process.hierarchical,
    )
    
    # Start the crew's work
    result = crew.kickoff()
    
    print(result)
    

    애플리케이션 코드에 다음 두 줄을 추가하세요:

    import openlit
    
    openlit.init()
    

    OTEL export 엔드포인트를 구성하려면 다음 명령을 실행하세요:

    export OTEL_EXPORTER_OTLP_ENDPOINT = "http://127.0.0.1:4318"
    

    CrewAI 비동기 에이전트 모니터링 예시:

    import asyncio
    from crewai import Crew, Agent, Task
    import openlit
    
    openlit.init(otlp_endpoint="http://127.0.0.1:4318")
    
    # Create an agent with code execution enabled
    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"
    )
    
    # Create a task that requires code execution
    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.",
    )
    
    # Create a crew and add the task
    analysis_crew = Crew(
      agents=[coding_agent],
      tasks=[data_analysis_task]
    )
    
    # Async function to kickoff the crew asynchronously
    async def async_crew_execution():
        result = await analysis_crew.kickoff_async(inputs={"ages": [25, 30, 35, 40, 45]})
        print("Crew Result:", result)
    
    # Run the async function
    asyncio.run(async_crew_execution())
    

    더 고급 구성과 사용 사례는 OpenLIT Python SDK 저장소를 참조하세요.

  4. 시각화와 분석 — 에이전트 옵저버빌리티 데이터가 OpenLIT로 수집·전송되고 있으니, 이제 이 데이터를 시각화·분석해 에이전트의 성능과 동작에 대한 통찰을 얻고 개선 영역을 파악하세요. 브라우저에서 OpenLIT(127.0.0.1:3000)으로 이동해 탐색을 시작하면 돼요. 기본 자격 증명으로 로그인할 수 있어요 — Email: [email protected], Password: openlituser.

더 알아보기 (Learn more)