# openinference-instrumentation-pipecat

**Python · Instrumentation**

OpenInference Pipecat Instrumentation

- **Module**: `openinference.instrumentation.pipecat`
- **Version**: 2.0.14
- **Python**: >=3.11, <3.15
- **Instruments**: `pipecat-ai>=1.3`

[PyPI](https://pypi.org/project/openinference-instrumentation-pipecat/) · [README](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pipecat/README.md) · [Source](https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-pipecat)

## Install

```sh
pip install openinference-instrumentation-pipecat
```

## Usage

Instrument once, at startup, before the library is used. The [`PipecatInstrumentor`](https://openinf.dev/python/openinference-instrumentation-pipecat.html.md#openinference.instrumentation.pipecat.PipecatInstrumentor) reference below lists the options.

```python
from opentelemetry.sdk.trace import TracerProvider
from openinference.instrumentation import TraceConfig
from openinference.instrumentation.pipecat import PipecatInstrumentor

tracer_provider = TracerProvider()
# ...add a span processor that exports to Phoenix or any OTLP backend.

PipecatInstrumentor().instrument(
    tracer_provider=tracer_provider,
    config=TraceConfig(hide_inputs=True),  # optional
)
```

## `openinference.instrumentation.pipecat`

OpenInference instrumentation for Pipecat.

### `PipecatInstrumentor`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pipecat/src/openinference/instrumentation/pipecat/__init__.py#L22-L120)

```python
class PipecatInstrumentor(BaseInstrumentor)
```

An instrumentor for Pipecat pipelines.

Automatically instruments PipelineWorker to observe frame flow and create OpenInference-compliant spans for LLM, TTS, and STT services. The deprecated `PipelineTask` alias (a thin subclass of `PipelineWorker`) is covered transparently because its `__init__` calls `super().__init__`.

#### `instrument`

_method_

```python
def instrument(
    *,
    tracer_provider: Optional[TracerProvider] = None,
    config: Optional[TraceConfig] = None,
    skip_dep_check: bool = False,
) -> None
```

Start tracing `pipecat-ai`: patch it so its calls make OpenInference spans. Calling it again does nothing. Inherited from OpenTelemetry’s [`BaseInstrumentor`](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/base/instrumentor.html).

**Parameters**

| Name | Description |
| - | - |
| `tracer_provider` | The tracer provider the spans are made with. Defaults to the global one, `opentelemetry.trace.get_tracer_provider()`. |
| `config` | What the spans record: hide inputs, outputs or messages, or limit image sizes. Defaults to `TraceConfig()`, which reads the `OPENINFERENCE_*` environment variables. See [`TraceConfig`](https://openinf.dev/python/openinference-instrumentation.html.md#openinference.instrumentation.TraceConfig). |
| `skip_dep_check` | Instrument even if the installed version of `pipecat-ai` is outside the supported range. |

#### `uninstrument`

_method_

```python
def uninstrument() -> None
```

Stop tracing: undo the patches `instrument()` made. Inherited from OpenTelemetry’s [`BaseInstrumentor`](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/base/instrumentor.html).

#### `instrumentation_dependencies`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pipecat/src/openinference/instrumentation/pipecat/__init__.py#L32-L33)

```python
def instrumentation_dependencies() -> Collection[str]
```

#### `create_observer`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pipecat/src/openinference/instrumentation/pipecat/__init__.py#L35-L53)

```python
def create_observer() -> Any
```

Create an OpenInferenceObserver manually.

**Returns**

| Type | Description |
| - | - |
| `Any` | OpenInferenceObserver instance |

**Raises**

| Type | Description |
| - | - |
| `RuntimeError` | If instrumentor is not instrumented yet |
