One runnable Pipecat pipeline, on local mic/speaker audio so it needs no
telephony or video setup. Native pipecat.services metered by
attach() (the single passive meter), with the LLM wrapped by
one guard() call for fallback, a rate limit, and a daily
spend cap. The public surface is the same as the
LiveKit agent; only the providers differ.
Install
agent.py
Run
Before this, start the daemon in another terminal: voicegw init once, then voicegw serve (see Quickstart).
Speak into your microphone; the pipeline replies through your speakers. Costs
and latency land in the dashboard under the pipecat-demo project at
http://localhost:8080.
PipelineRunner is deprecated upstream since pipecat-ai 1.3.0 in favor of
WorkerRunner, but stays functional through the 1.x series (removal is
planned for 2.0). VoiceGateway’s attach() calls task.add_observer(...),
which needs a PipelineTask, so keep PipelineTask / PipelineRunner (not
PipelineWorker / WorkerRunner) until VoiceGateway’s Pipecat integration is
updated.
attach() vs Observer
Both do the same thing; pick whichever reads cleaner:
Fallback scope on Pipecat
guard() fallback on Pipecat switches providers before the first output
frame. If the primary fails to produce its first frame, the fallback runs.
Once the primary has started streaming output there is no mid-stream
recovery. See guard() for the full fallback scope on each
framework.
Notes
- The service constructors above use each service’s
settings= object
(OpenAILLMService.Settings, CartesiaTTSService.Settings) rather than the
older flat model= / voice_id= kwargs, which pipecat-ai deprecated in
favor of settings=.
- A real deployment swaps
LocalAudioTransport for a WebRTC or telephony
transport (Daily, a SIP serializer, etc.). The transport also drives
attach()’s channel auto-detect (telephony vs. web).