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
- Install traceAI Crewai
pip install traceAI-crewai
- 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()
Metadata
Release files for traceAI-crewai 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| traceai_crewai-0.1.8.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| traceai_crewai-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / traceai_crewai-0.1.8.tar.gz
| Download URL | traceai_crewai-0.1.8.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7b59584b9ae3e5155d5e3fb4d3db5e908ab157c84a77af5d0a47a8476290183
|
|
BLAKE2b-256 checksum How to use checksums |
3cca7961f470a5224c53067e405c8afd57f69cd7a3d86ff84e8ae654d85bdd0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / traceai_crewai-0.1.8-py3-none-any.whl
| Download URL | traceai_crewai-0.1.8-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43804375bdd049cdef6722ea939ed8b930afff325b2167fefec3acfe8ed52a18
|
|
BLAKE2b-256 checksum How to use checksums |
491d5bac7409582dd682d2a2cc83a95166237d59edb480684cfd940b30acb1e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|