Pipecat
cetra reads the conversation and turn spans that Pipecat’s built-in tracing writes, and the spans of its LLM service, with the messages of each model call.
Install
Section titled “Install”Install Pipecat with its OpenAI extra. The fixture was captured with Pipecat 1.16.0.
pip install "pipecat-ai[openai]==1.16.0"Set up
Section titled “Set up”Pipecat’s setup_tracing reads the OTLP endpoint and protocol from the environment. Set the exporter variables, then start your application.
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8080export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <SK_CETRA_KEY>"Replace <SK_CETRA_KEY> with your sk-cetra-… API key. See Send OpenTelemetry.
import os
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporterfrom pipecat.pipeline.pipeline import Pipelinefrom pipecat.pipeline.task import PipelineTaskfrom pipecat.processors.aggregators.llm_context import LLMContextfrom pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPairfrom pipecat.services.openai.llm import OpenAILLMServicefrom pipecat.utils.tracing.setup import setup_tracing
setup_tracing("my-app", exporter=OTLPSpanExporter())
llm = OpenAILLMService( api_key=os.environ["OPENAI_API_KEY"], settings=OpenAILLMService.Settings(model="gpt-4o-mini"),)context = LLMContext(messages=[{"role": "user", "content": "What is the weather in Paris?"}])pair = LLMContextAggregatorPair(context)pipeline = Pipeline([pair.user(), llm, pair.assistant()])
# conversation_id groups the conversation and turn spans into one session.task = PipelineTask(pipeline, enable_tracing=True, conversation_id="conv-1")Run the task the way your application does. enable_tracing=True is needed for the conversation and turn spans.
What you get
Section titled “What you get”- A
chainspan for the conversation and achainspan for each turn. Both carry the session fromconversation_id. - An
llmspan for each model call, with the provider, the models, the token counts, the cost and the input messages. The answer is the output, when the model answers with text.
Limits
Section titled “Limits”- No tool span. The function call has no span of its own. The model call that asks for the function has no output, because its answer is only the call. The next model call’s input carries the call and its result.
- The model call spans carry no session. Only the conversation and turn spans do, so a session view does not group the model calls. Use the trace for each turn.
- Speech-to-text and text-to-speech spans were not captured. The fixture has no audio service. cetra reads their operations as plain
spans. - Only the OpenAI service was captured. cetra reads a model call’s input as messages only when it is an OpenAI-shaped message list. Any other value is kept as text.
- The fixture was captured with Pipecat 1.16.0. Pipecat 2.0 renames
PipelineTask. - If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.
- Traces: read the trace as a tree and a timeline.
- Cost and tokens: how cost is computed from the token counts.