Skip to main content

SIP and audio streaming transport for AI voice agents (pure Rust)

Project description

Agent Transport

PyPI npm Build Python Build Node Test License: MIT

Transport library (SIP/RTP & Audio Streaming) for voice AI agents to be used with frameworks like LiveKit Agents and Pipecat.

Agent Transport provides signaling and media primitives that AI agent frameworks need to make and receive voice calls. The core is written in Rust for efficient, low-jitter packet processing — audio pacing, RTP handling, and jitter buffering. Framework adapters for LiveKit Agents and Pipecat are provided as drop-in plugins. Bindings in Python and TypeScript/Node.js are also available for other use cases.

Transports

SIP/RTP — Register with any SIP provider, make and receive calls over RTP. G.711 codecs (PCMU/PCMA), DTMF (RFC 2833), NAT traversal (TCP signaling with Via alias, STUN for RTP), hold/unhold, call transfer. No server required, directly connect with telephony providers over SIP like Plivo.

Audio Streaming — Websocket based audio streaming that works with cloud telephony providers like Plivo that support bidirectional audio streaming.

Both transports produce and consume the same AudioFrame format (int16 PCM, 16kHz mono), so agent code works identically regardless of transport.

Framework Adapters

LiveKit Agents

Same AgentSession pipeline -- add ctx.session = session to wire SIP/audio stream transport:

SIP/RTP:

# LiveKit WebRTC                                # Agent Transport SIP/RTP
from livekit.agents import AgentServer,         from agent_transport.sip.livekit import
    JobProcess                                      AgentServer, JobProcess
server = AgentServer()                          server = AgentServer(sip_username=..., sip_password=...)

def prewarm(proc: JobProcess):                  def prewarm(proc: JobProcess):
    proc.userdata["vad"] = silero.VAD.load()        proc.userdata["vad"] = silero.VAD.load()
server.setup_fnc = prewarm                      server.setup_fnc = prewarm

@server.rtc_session()                           @server.sip_session()
async def entrypoint(ctx):                      async def entrypoint(ctx):
    session = AgentSession(                         session = AgentSession(
        vad=ctx.proc.userdata["vad"], ...)              vad=ctx.proc.userdata["vad"], ...)
    await session.start(                            ctx.session = session
        agent=Assistant(),                          await session.start(
        room=ctx.room)                                  agent=Assistant(), room=ctx.room)
cli.run_app(server)                             server.run()

Audio Streaming:

# LiveKit WebRTC                                # Agent Transport AudioStream
from livekit.agents import AgentServer,         from agent_transport.audio_stream.livekit import
    JobProcess                                      AudioStreamServer, JobProcess
server = AgentServer()                          server = AudioStreamServer(listen_addr="0.0.0.0:8765")

def prewarm(proc: JobProcess):                  def prewarm(proc: JobProcess):
    proc.userdata["vad"] = silero.VAD.load()        proc.userdata["vad"] = silero.VAD.load()
server.setup_fnc = prewarm                      server.setup_fnc = prewarm

@server.rtc_session()                           @server.audio_stream_session()
async def entrypoint(ctx):                      async def entrypoint(ctx):
    session = AgentSession(                         session = AgentSession(
        vad=ctx.proc.userdata["vad"], ...)              vad=ctx.proc.userdata["vad"], ...)
    await session.start(                            ctx.session = session
        agent=Assistant(),                          await session.start(
        room=ctx.room)                                  agent=Assistant(), room=ctx.room)
cli.run_app(server)                             server.run()

Full examples: sip_agent.py · sip_multi_agent.py · audio_stream_agent.py · audio_stream_multi_agent.py

See LiveKit SIP Transport docs for recording, Prometheus metrics, outbound API, and full reference.

Pipecat

Same Pipeline — swap transport, everything else stays identical. Audio pacing moves from Python to Rust:

# Pipecat + Plivo (Python audio pacing)          # Agent Transport (Rust audio pacing)
from pipecat.serializers.plivo import             from agent_transport.audio_stream.pipecat \
    PlivoFrameSerializer                              .serializers.plivo import PlivoFrameSerializer
from pipecat.transports.websocket.fastapi import  from agent_transport.audio_stream.pipecat \
    FastAPIWebsocketTransport                         .transports.websocket import WebsocketServerTransport

serializer = PlivoFrameSerializer(                serializer = PlivoFrameSerializer(
    stream_id=..., call_id=...,                       auth_id=..., auth_token=...)
    auth_id=..., auth_token=...)                  server = WebsocketServerTransport(
transport = FastAPIWebsocketTransport(                serializer=serializer)
    websocket=ws, params=Params(
        serializer=serializer))                   @server.handler()
                                                  async def run_bot(transport):
pipeline = Pipeline([                                 pipeline = Pipeline([
    transport.input(), stt, llm, tts,                     transport.input(), stt, llm, tts,
    transport.output()])                                   transport.output()])
task = PipelineTask(pipeline)                         task = PipelineTask(pipeline)

@transport.event_handler("on_client_connected")       @transport.event_handler("on_client_connected")
async def on_connected(transport, client):            async def on_connected(transport):
    await task.queue_frames([LLMRunFrame()])               await task.queue_frames([LLMRunFrame()])

await PipelineRunner().run(task)                      await PipelineRunner().run(task)

                                                  server.run()

Also available for SIP/RTP: from agent_transport.sip.pipecat import SipTransport

Full examples: audio_stream_agent.py · sip_agent.py

Installation

Python

For LiveKit Agents

pip install "agent-transport[livekit]"

For Pipecat

pip install "agent-transport[pipecat]"

Minimum versions: livekit-agents>=1.5, pipecat-ai>=0.0.108

Node.js

For LiveKit Agents

npm install agent-transport @livekit/agents @livekit/rtc-node

macOS note: The ONNX runtime bundled with @livekit/agents-plugin-livekit (v1.21+) has a known mutex crash on macOS that kills the turn detection inference process. Add "overrides": { "onnxruntime-node": "1.20.1" } to your package.json to pin a working version.

Building from source | Local development

Examples

Example Description
livekit/sip_agent.py SIP voice agent with tool calling, turn detection, preemptive generation
livekit/sip_agent.ts TypeScript SIP agent with tool calling, turn detection, metrics
livekit/sip_multi_agent.py Multi-agent with greeter -> sales/support handoff and tool calling
livekit/sip_multi_agent.ts TypeScript multi-agent with class inheritance and llm.handoff()
livekit/audio_stream_agent.py LiveKit agent over Plivo audio streaming
livekit/audio_stream_agent.ts TypeScript agent over Plivo audio streaming
livekit/audio_stream_multi_agent.py Audio streaming multi-agent with handoff and tool calling
livekit/audio_stream_multi_agent.ts TypeScript audio streaming multi-agent
pipecat/sip_agent.py Pipecat pipeline over SIP/RTP with VAD
pipecat/sip_multi_agent.py Pipecat multi-agent with greeter → sales/support handoff
pipecat/audio_stream_agent.py Pipecat over Plivo audio streaming with Rust recorder + mixer
pipecat/audio_stream_multi_agent.py Pipecat audio streaming multi-agent with handoff
cli/phone.py Interactive CLI softphone with mic/speaker, DTMF, mute, hold/unhold

See also: Feature Flags & CLI Phone docs

Releasing

Publishing is label-driven. Bump the version, add release-python-sdk or release-node-sdk label to your PR, and merge — CI handles the rest. Python and Node releases are independent.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

agent_transport-0.2.1-cp39-abi3-win_arm64.whl (5.6 MB view details)

Uploaded CPython 3.9+Windows ARM64

agent_transport-0.2.1-cp39-abi3-win_amd64.whl (5.6 MB view details)

Uploaded CPython 3.9+Windows x86-64

agent_transport-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

agent_transport-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl (5.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

agent_transport-0.2.1-cp39-abi3-macosx_11_0_arm64.whl (5.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

agent_transport-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file agent_transport-0.2.1-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for agent_transport-0.2.1-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 2d711d15de07ebe2c08382059be4b08892c360594f948a4d1d4ac6de7ebc1cbf
MD5 23da9a24e40e3f214203d6d44a41218f
BLAKE2b-256 276d82f9c9e56f0eebd189008adc30b4f6e828602361ec2a2e6202b03d2b9e23

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.2.1-cp39-abi3-win_arm64.whl:

Publisher: publish-python.yml on plivo-labs/agent-transport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_transport-0.2.1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for agent_transport-0.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c5cc4d6c4cf7071c5f53a69bf7548aec8527c51a5e2526432e6de6e421977175
MD5 08ae8af5be55c28c0119dfee79e46f56
BLAKE2b-256 62aa4d079bcf8cc76295ae068448fc1b316f80286a2a9c70d22257748911dd23

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.2.1-cp39-abi3-win_amd64.whl:

Publisher: publish-python.yml on plivo-labs/agent-transport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_transport-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for agent_transport-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 78b372ab443efa87d0a50aab661a908d6e63975b4590b76ea0ccbdf5c99915b7
MD5 593534fa17040e8b8aa4fe785a6fb2dd
BLAKE2b-256 d40862629a143107138137e14b8aa2d99ec27ffa1cac9155ca71c392a55637ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl:

Publisher: publish-python.yml on plivo-labs/agent-transport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_transport-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for agent_transport-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c342fc576073def215aed65037fdcfc52303ea42dd3ff12b67a3b5dff6c29d42
MD5 3161f2f39702db1afaeda96acbf3535b
BLAKE2b-256 d90aaad4ef72156609010c299a71c1a1aafb4576225a01382d773fe74494117a

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: publish-python.yml on plivo-labs/agent-transport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_transport-0.2.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for agent_transport-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb2960bc0b28bcea4c20956cb63dee77e661a5756b81b8deaa8470c58a9968ba
MD5 23cd8dfc834bdeb93e38380fbc0014ad
BLAKE2b-256 daaf12174d713dd8de419b4934841cdbf141b9e29ab151e0aeb5eeaff4407c45

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.2.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish-python.yml on plivo-labs/agent-transport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_transport-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for agent_transport-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6dfb50232b04077c29a3afb5a4ed662693dae1aa764fa9deeb272044a2e14942
MD5 aaaa918c318441649f891d41c6650725
BLAKE2b-256 3219d7c4d9241ced1135e22fb790291088e71f15635adf7be93df1fee5c25374

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-python.yml on plivo-labs/agent-transport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page