Skip to content

[bot] Add Pipecat (pipecat-ai) integration for Pipeline execution and LLM service frame instrumentation #550

Description

@braintrust-bot

Summary

Pipecat (pipecat-ai) is an open-source Python framework for building real-time voice and multimodal conversational AI agents. It provides a pipeline execution model (Pipeline, PipelineTask) that orchestrates AI services (LLM, STT, TTS, image generation, vision) via composable frame processors. The latest release is v1.5.0 and the project is actively maintained with multiple releases per month. This repository has zero instrumentation for any Pipecat execution surface — no integration directory, no wrapper, no patcher, no auto_instrument() support.

Pipecat is a distinct framework from the already-instrumented livekit-agents. LiveKit agents run inside LiveKit rooms with an AgentSession event model; Pipecat uses an independent frame-processing pipeline architecture and has its own LLM service abstractions, transport layer, and execution model. Users who build voice AI agents with Pipecat rather than LiveKit get zero Braintrust spans today.

Comparable real-time AI agent frameworks with existing integrations in this repo: livekit_agents.

What needs to be instrumented

The pipecat-ai package exposes these execution surfaces, none of which are instrumented:

Pipeline execution (highest priority)

Class / Method Description
PipelineTask.run() Primary async pipeline execution — runs the full frame-processing pipeline until completion or cancellation
Pipeline.__init__(processors) Assembles a directed pipeline graph of frame processors (LLM, STT, TTS, transport, etc.)

PipelineTask.run() drives the entire agent loop: frames flow through processors sequentially or in parallel. Each frame carries conversation content, audio, images, or control signals. The integration should create a parent span for the pipeline run.

LLM service frame processors (highest priority)

Class Description Providers covered
OpenAILLMService LLM completions via OpenAI gpt-4o, gpt-4-turbo, etc.
AnthropicLLMService LLM completions via Anthropic Claude models
GoogleAILLMService LLM completions via Google AI Gemini models
AzureOpenAILLMService LLM completions via Azure OpenAI Azure-hosted OpenAI models
GroqLLMService LLM completions via Groq Llama, Mixtral on Groq
MistralAILLMService LLM completions via Mistral Mistral models
OLLamaLLMService LLM completions via Ollama Local models

All LLM services inherit from LLMService and process LLMMessagesFrame inputs, producing LLMResponseStartFrame, TextFrame chunks, and LLMResponseEndFrame outputs. The integration should create child spans for each LLM frame processing cycle, capturing input messages, generated text, token usage (where available), model name, and latency.

Function/tool calling

Class Description
LLMService.push_frame(LLMFunctionCallFrame) Tool/function calls invoked by the LLM during pipeline execution
FunctionCallResultFrame Result of a tool/function call fed back into the pipeline

When the LLM invokes a function tool during generation, the pipeline emits LLMFunctionCallFrame and later LLMFunctionCallResultFrame. These should be captured as child spans of the LLM frame span.

Context management

Class Description
OpenAILLMContext / LLMContext Maintains conversation history (messages, tools, system prompt) across pipeline frames

The context object holds the accumulating conversation, making it available for span input logging across multi-turn voice interactions.

Implementation notes

Frame-based execution model: Pipecat's pipeline processes frames asynchronously. Unlike request/response SDKs, LLM calls happen when an LLMMessagesFrame flows through an LLMService processor. The integration should patch LLMService._process_context() or the provider-specific _stream_chat_completions() methods, wrapping each LLM call cycle in a span.

Async-first: All pipeline operations are async (async def run(), async def process_frame()). Spans must be managed in async context.

Streaming: LLM services stream token-by-token as TextFrame outputs. The integration should accumulate frames between LLMResponseStartFrame and LLMResponseEndFrame to compute the full response and finalize the span.

Provider-agnostic tracing: Each LLM service subclass targets a specific provider. The integration should capture the provider name and model from the service instance, independent of which backend is configured.

Audio frames: STT/TTS frames are non-generative (audio transcription, speech synthesis). The highest-priority instrumentation target is LLM generation frames, not audio pipeline stages.

Token usage: Token counts are available in LLMUsageFrame objects emitted after each LLM response. The integration should capture these for span metrics.

No coverage in any instrumentation layer

  • No integration directory (py/src/braintrust/integrations/pipecat/)
  • No wrapper function (e.g. wrap_pipecat())
  • No patcher in any existing integration
  • No nox test session (test_pipecat)
  • No version entry in py/src/braintrust/integrations/versioning.py
  • No mention in py/src/braintrust/integrations/__init__.py

A grep for pipecat across py/src/braintrust/ returns zero matches.

Braintrust docs status

not_found — Pipecat is not listed on the Braintrust integrations directory or the tracing guide. There is no auto_instrument() reference, no wrap_pipecat() function, and no Pipecat setup documentation anywhere in Braintrust docs.

Upstream references

Local repo files inspected

  • py/src/braintrust/integrations/ — no pipecat/ directory exists on main
  • py/src/braintrust/wrappers/ — no Pipecat wrapper
  • py/noxfile.py — no test_pipecat session
  • py/pyproject.toml [tool.braintrust.matrix] — no pipecat-ai entry
  • py/src/braintrust/integrations/__init__.py — Pipecat not listed in integration registry
  • py/src/braintrust/integrations/versioning.py — no Pipecat version matrix
  • py/src/braintrust/integrations/livekit_agents/ — covers LiveKit-specific agent runner, not Pipecat's pipeline model
  • Full repo grep for pipecat across py/src/braintrust/ — zero matches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions