Skip to main content

OpenTelemetry instrumentation for Crewai

Project description

Crewai OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the Crewai framework. It enables tracing and monitoring of applications built with Crewai.

Installation

  1. Install traceAI Crewai
pip install traceAI-crewai
  1. Install Crewai and Crewai_tools
pip install crewai crewai_tools

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI

import os

os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="crewai_app"
)

Configure Crewai Instrumentation

Instrument the Crewai client to enable telemetry collection. This step ensures that all interactions with the Crewai SDK are tracked and monitored.

from traceai_crewai import CrewAIInstrumentor

CrewAIInstrumentor().instrument(tracer_provider=trace_provider)

Create Crewai Components

Set up your Crewai client with built-in observability.

from crewai import LLM, Agent, Crew, Process, Task
from crewai_tools import SerperDevTool

def story_example():
    llm = LLM(
        model="gpt-4",
        temperature=0.8,
        max_tokens=150,
        top_p=0.9,
        frequency_penalty=0.1,
        presence_penalty=0.1,
        stop=["END"],
        seed=42,
    )

    writer = Agent(
        role="Writer",
        goal="Write creative stories",
        backstory="You are a creative writer with a passion for storytelling",
        allow_delegation=False,
        llm=llm,
    )

    writing_task = Task(
        description="Write a short story about a magical forest",
        agent=writer,
        expected_output="A short story about a magical forest",
    )

    crew = Crew(agents=[writer], tasks=[writing_task])

    # Execute the crew
    result = crew.kickoff()
    print(result)

if __name__ == "__main__":
    story_example()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceai_crewai-0.1.8.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceai_crewai-0.1.8-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file traceai_crewai-0.1.8.tar.gz.

File metadata

  • Download URL: traceai_crewai-0.1.8.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_crewai-0.1.8.tar.gz
Algorithm Hash digest
SHA256 e7b59584b9ae3e5155d5e3fb4d3db5e908ab157c84a77af5d0a47a8476290183
MD5 b816f9b31cf779975f7dee79336c8440
BLAKE2b-256 3cca7961f470a5224c53067e405c8afd57f69cd7a3d86ff84e8ae654d85bdd0d

See more details on using hashes here.

File details

Details for the file traceai_crewai-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: traceai_crewai-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_crewai-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 43804375bdd049cdef6722ea939ed8b930afff325b2167fefec3acfe8ed52a18
MD5 175a9bd411ceca4f9e755fd8058b7bbf
BLAKE2b-256 491d5bac7409582dd682d2a2cc83a95166237d59edb480684cfd940b30acb1e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page