Using a coding agent? Paste this prompt directly in your Pipecat agent codebase to jumpstart your Cekura integration.
Overview
Pipecat Tracing provides deep observability into your Pipecat agent’s performance by integrating the Cekura Python SDK directly into your agent code. This integration significantly enhances the information available in the Cekura platform for end-to-end visibility over agent execution. What you get:- Complete agent-side conversation transcripts with UTC timestamps
- Tool/function calls with inputs and outputs
- Dual-channel audio recording (agent + user) for production monitoring
- OpenTelemetry traces with conversation, turn, and service spans (STT, LLM, TTS)
- Session logs capture from agent
- Session metadata for correlation and debugging
Replacing an existing direct API integration? If you currently post call data to the
POST /observability/v1/observe/ endpoint directly, the Pipecat SDK is a replacement, not an add-on — these two approaches are mutually exclusive for the same session. Running both creates duplicate records with no merging. Migrate by moving your metadata to set_custom_metadata() and removing the direct API call. See Migrating from the direct API to the SDK for step-by-step instructions.Video Tutorial
Watch this video to see the Pipecat tracing integration in action:Prerequisites
- A Cekura account with an API key
- A Pipecat agent project
Setup
- Testing
- Observability
Use this setup in your test agents while running simulation calls from the Cekura platform. This mode captures transcripts, logs, and OTel traces — no audio recording.
Integrate the SDK in your Pipecat agent
Add the Cekura tracer to your Pipecat agent:What this does:
- Initialize the tracer with your API key and agent ID
- Track your pipeline to capture transcripts, tool calls, logs, and OTel traces
- Register task handlers for automatic cleanup
- Captures transcripts and tool calls
- Captures session logs (INFO+)
- Exports OpenTelemetry traces (conversation, turn, STT/LLM/TTS spans)
- Sends data to Cekura’s simulation webhook for test analysis
- No audio recording — lightweight for testing
Configure Pipecat provider and enable tracing
Navigate to your agent settings in the Cekura dashboard, select Pipecat as the provider, and enable tracing:Required configuration:
- Provider: Select “Pipecat” as your voice integration provider
- Pipecat Cloud API Key: Your authentication key from Pipecat Cloud
- Pipecat Agent Name: Your agent name in Pipecat (e.g., “my-agent”)
- Tracing Enabled: Set to true to enable SDK-based tracing
- WebRTC: Direct Pipecat session connection using the credentials configured above
- Telephony: Phone-based testing if your Pipecat agent is connected to a phone system (requires Contact Number)
Run tests
Run tests using your preferred connection type:
- WebRTC: Select WebRTC under Voice connections in the Configure Run dialog for WebRTC-based testing
- Telephony: Select Telephony under Voice connections for phone-based testing
Enhanced Data in Cekura UI
With tracing enabled, you’ll see enriched information in the Cekura platform:- Complete Transcript: Full conversation history with UTC timestamps
- Tool Calls: Function call requests and responses with inputs and outputs
- OpenTelemetry Traces: Conversation, turn, and service-level spans (STT, LLM, TTS) with latency and usage metrics
- Session Logs: INFO+ logs captured during the session for debugging
- Session Metadata: Session IDs for correlating Cekura calls with your logs
- Audio Recording: Dual-channel recordings (agent + user) for quality monitoring (observability mode only)
- Custom Metadata: Additional metadata passed via
custom_metadataparameter

OpenTelemetry Tracing
The SDK automatically exports OpenTelemetry traces for every call, giving you detailed visibility into your agent’s execution pipeline. Traces are exported to the Cekura platform by default and correlated with call logs automatically.Trace Structure
Each call produces a hierarchical trace:How It Works
When using the single-step API (observe_and_create_task / track_and_create_task), OTel tracing is configured automatically — no additional code needed.
When using the multi-step API (observe_pipeline / track_pipeline), you need to enable tracing on the PipelineTask yourself:
Additional Span Attributes
You can attach custom attributes to the conversation-level span viaadditional_span_attributes on the PipelineTask. This is useful for adding your own correlation IDs or metadata to traces.
Disabling OTel Traces
To disable OTel trace export entirely:Custom Metadata
Pass custom metadata at initialization or update it anytime before the session tears down:set_custom_metadata() can be called at any point before the pipeline session finalizes — including in cleanup or post-processing handlers that execute before the session tears down. Once the session has ended and data has been submitted to Cekura, the record is immutable and metadata cannot be updated.
Deferred Upload (Compliance)
For compliance scenarios where you need user consent before sending any data to the backend, usedefer_upload=True. All audio is buffered locally and no data (audio, transcript, logs) is sent until you explicitly grant consent.
If you currently send call data to
observability/v1/observe/ and want to adopt the SDK — or are wondering whether both can run simultaneously — see Can I also add the Pipecat SDK if I already post to the observability endpoint? in the FAQ.If you already capture audio in your own pipeline and want to understand how the SDK’s parallel recording works, see If I already capture and store audio in my own Pipecat pipeline, will the Cekura SDK record it again? in the FAQ.Best Practices
-
Use the right method for your environment: Use
track_pipeline()/track_and_create_task()in your test/UAT environments for simulation testing. Useobserve_pipeline()/observe_and_create_task()in your production environment for monitoring live calls with audio recording. - Use environment variables for credentials: Don’t hardcode API keys in your code
-
Keep the SDK updated: Run
pip install --upgrade cekuraperiodically for the latest features -
Use session IDs: The SDK resolves the session ID in this order: explicit
session_idparameter >runner_args.session_id> auto-generated. Pass a custom session ID to correlate Cekura data with your application logs -
Create one
PipecatTracerinstance per call — do not share instances across concurrent sessions:PipecatTraceris not thread-safe to share. When running multiple concurrent calls in the same event loop, instantiate a freshPipecatTracerfor each call (with its ownsession_id) inside the function that handles that call. With this pattern the SDK is safe for concurrent use — each instance holds its own session state and submits data independently.
SDK Reference
PipecatTracer Initialization
observe_pipeline()
Adds observability to your pipeline — captures transcripts and records audio. For production monitoring.bot_channel or user_channel parameters are required.
track_pipeline()
Adds simulation-mode tracking to your pipeline — captures transcripts only, no audio. For testing.observe_and_create_task()
Single-step observability setup. Combinesobserve_pipeline(), PipelineTask creation, and register_task_handlers(). Automatically configures OTel tracing when enabled.
track_and_create_task()
Single-step simulation setup. Combinestrack_pipeline(), PipelineTask creation, and register_task_handlers(). Automatically configures OTel tracing when enabled.
register_task_handlers()
Registers cleanup handlers for automatic resource management when the session ends. Only needed when using the two-step approach.start_audio_upload()
Grants consent and begins uploading session data whendefer_upload=True. Flushes any buffered audio to S3 and enables normal upload for the rest of the session. No-op if defer_upload was not set.
abort()
Stops all capture mid-call and prevents data from being sent to the Cekura backend. Clears any deferred audio buffer and aborts in-progress S3 uploads.set_custom_metadata()
Update custom metadata at any point during the session.get_custom_metadata()
Retrieve the current custom metadata.CEKURA_TRACER_ENABLED="false": Disable the tracer entirely
Troubleshooting
Missing Aggregators Warning
If you see:LLMUserAggregator and LLMAssistantAggregator for transcript capture. Add aggregators to your pipeline:
Import Error
If you see:Next Steps
- Create custom metrics to evaluate your agents
- Set up automated testing for your Pipecat agents
- Explore predefined metrics