This guide covers the Python SDK for pipecat-ai. The package is available on PyPI. A Node.js SDK is coming soon.
Video Tutorial
Prerequisites
- Tuner Active Account
- Configured Agent with provider “Custom API” in Tuner
- Python 3.11–3.13 (3.14 is not yet supported due to pipecat dependencies)
- Python project running pipecat-ai v1.0.0 or later
Overview
The tuner-pipecat-sdk is a lightweight observer that captures flow transitions, latency signals, transcript segments, and usage metadata from your Pipecat pipeline, then sends a structuredCallPayload to Tuner when the call ends — no manual API calls required. If your agent’s LLM step is a LangChain runnable or LangGraph graph, the same observer also captures node transitions, tool calls, and token usage from that layer — see LangChain / LangGraph observability below.
1
Install the SDK
Add the package to your project with pip.
2
Set Your Credentials
Configure your Tuner API key, workspace ID, and agent remote ID.
3
Add the Observer
Create an observer instance and attach it to pipecat.
Step 1: Install the SDK
For pipecat-ai pipelines:pipecat-ai>=1.0.0. Do not use Python 3.14 — pipecat dependencies (onnxruntime, numba) do not yet have 3.14 wheels.
Step 2: Set Your Credentials
You can configure credentials via environment variables or pass them directly in code.- Environment Variables
- Inline in Code
Step 3: Add the Observer
Create anObserver instance and attach turn tracking:
enable_metrics and enable_usage_metrics, the observer will log warnings and LLM/TTS metric fields will be absent from the payload.
For more examples, see the tuner-pipecat-sdk-python examples.
End-of-Utterance (EOU) Delay
Wire your user context aggregator to the observer to capture how long the pipeline took to decide the user was done talking — the gap between the user going silent and the turn actually closing. This appears on every user turn in the transcript view aseou_delay, eou_confidence, and
eou_reason.
eou_reason tells you which signal closed the turn, so eou_delay means
something different depending on the value:
All three fields are omitted from a turn’s metadata when nothing decided
that turn’s end.
SIP / Telephony Calls
If you plan to run Call Simulation against this agent, the observer needs the SIP Call-ID of the inbound call. Tuner uses it to match the simulation call it dialled with the call your observer syncs back — without it, simulated calls show up as ordinary production traffic.This applies to inbound simulation, where Tuner dials your agent. For outbound simulation, pass the dialed SIP URI as
recipient instead, see Outbound Simulation."twilio", "telnyx", "plivo", "exotel", "jambonz". For an unlisted provider, pass a callable extractor instead:
LangChain / LangGraph observability
Using LangGraph or LangChain for your LLM step? The observer can capture node transitions, tool calls, and token usage from inside that runnable alongside the standard call data. See LangChain / LangGraph.Configuration Options
Call Type
Call Type
Override the default call type label:
Recipient
Recipient
The phone number or SIP URI of the callee. Optional — pass it when you want to record who the call was directed to:
Recording URL
Recording URL
Provide a recording URL if available. Default is
"pipecat://no-recording":Disconnection Reason
Disconnection Reason
Record why a call ended by passing a
disconnection_reason_resolver callable. The resolver is called at flush time and should return a string or None.Use the built-in constants from DisconnectReason:Model Names
Model Names
Specify your ASR, LLM, and TTS models for metadata:
Agent Version
Agent Version
Track which version of your agent handled each call. Set Using GitHub Actions or CircleCI? Tuner reads
APP_VERSION in your environment:GITHUB_RUN_NUMBER / CIRCLE_BUILD_NUM automatically. Manual override via constructor takes priority:Debug Mode
Debug Mode
Log the full transcript when flushing:
Cost Calculation
Cost Calculation
Provide a callable that receives the call’s usage summary and returns the call cost in USD cents. Implement the method that matches your pricing plan; the snippet below is illustrative.
Full Example
observer.attach_sip_from_telephony(call_data, provider="twilio") after creating the observer — the SDK reads the SIP Call-ID from the payload for you.
Webhooks
Tuner can notify your systems when it has something to report on a call — see Webhooks.Troubleshooting
No matching distribution found for onnxruntime
No matching distribution found for onnxruntime
Python 3.14: Pipecat pins
onnxruntime versions that have no 3.14 wheels. Switch to Python 3.12 or 3.13 and create a new venv.Failed to build numba / Cannot install on Python 3.14
Failed to build numba / Cannot install on Python 3.14
Same as above: use Python 3.12 or 3.13.
Calls don't appear in Tuner
Calls don't appear in Tuner
- Verify that
agent_idis the Agent Remote ID from Agent Settings → Agent Connection (not your agent’s display name). - Confirm
workspace_idis correct. - Ensure
enable_metrics=Trueandenable_usage_metrics=Trueare set onPipelineParams. - Check your application logs for any error messages from the observer.
wrap_graph / wrap_chain raises ImportError
wrap_graph / wrap_chain raises ImportError
The
langchain extra isn’t installed. Run pip install tuner-pipecat-sdk[langchain].What’s Next?
Configuring Your Agent
Set up call outcomes, user intents, and evals.
Custom Integration
Learn about the underlying API if you need more control.
Classifying Calls
Define how Tuner categorizes your calls.
Real-Time Alerts
Get notified when issues are detected.