Skip to content
Docs

Pipecat Transport Provider

The Pipecat provider implements bidirectional audio transport through a Pipecat server over WebSocket. It enables Beluga’s voice pipeline to interoperate with Pipecat-based audio processing systems.

Choose Pipecat when you need to bridge Beluga’s voice pipeline with an existing Pipecat-based processing system over WebSocket. This is useful for hybrid architectures where some audio processing happens in a Pipecat server while Beluga handles the agent logic. For WebRTC-based transport, consider LiveKit or Daily.

Terminal window
go get github.com/lookatitude/beluga-ai/v2/voice/transport/providers/pipecat
FieldRequiredDefaultDescription
URLYes—Pipecat server WebSocket URL
SampleRateNo16000Audio sample rate in Hz
package main
import (
"context"
"fmt"
"log"
"github.com/lookatitude/beluga-ai/v2/voice/transport"
_ "github.com/lookatitude/beluga-ai/v2/voice/transport/providers/pipecat"
)
func main() {
t, err := transport.New("pipecat", transport.Config{
URL: "ws://localhost:8765",
})
if err != nil {
log.Fatal(err)
}
defer t.Close()
// Receive incoming audio frames
for frame, err := range t.Recv(context.Background()) {
if err != nil {
log.Fatal(err)
}
fmt.Printf("Received %d bytes of audio\n", len(frame.Data))
}
}

Write processed audio back to the Pipecat server using voice.NewAudioFrame:

frame := voice.NewAudioFrame(processedPCM, 16000)
err := t.Send(ctx, frame)
if err != nil {
log.Printf("send failed: %v", err)
}

For direct audio piping without frame wrapping:

writer := t.AudioOut()
_, err := writer.Write(rawPCMData)
if err != nil {
log.Printf("audio write failed: %v", err)
}
import "github.com/lookatitude/beluga-ai/v2/voice/transport/providers/pipecat"
t, err := pipecat.New(transport.Config{
URL: "ws://localhost:8765",
SampleRate: 16000,
})

transport.New("pipecat", ...) currently always fails with an error wrapping transport.ErrNotImplemented, so check for it and fall back to a working transport:

t, err := transport.New("pipecat", cfg)
if errors.Is(err, transport.ErrNotImplemented) {
// pipecat is not implemented yet; use the built-in WebSocket transport
t, err = transport.NewWebSocketTransport(ctx, wsURL)
}
if err != nil {
log.Fatal(err)
}
defer t.Close()

Refer to the Pipecat documentation for server setup and configuration.