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

pip install agent-transport                     # Core only (Rust bindings)
pip install agent-transport[livekit]            # + LiveKit adapter
pip install agent-transport[pipecat]            # + Pipecat adapter
pip install agent-transport[all]                # Both adapters

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

Building from Source

Requires Rust, a C compiler, and CMake.

# Rust core
cargo build                                     # Core library (SIP transport)
cargo build --features audio-stream             # + Plivo audio streaming
cargo build --features audio-processing         # + jitter buffer, PLC, comfort noise

# Python binding
cd crates/agent-transport-python && pip install -e .

CMake 4.x: If you see Compatibility with CMake < 3.5 has been removed, set CMAKE_POLICY_VERSION_MINIMUM=3.5 in your environment.

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.1.4-cp39-abi3-win_arm64.whl (5.6 MB view details)

Uploaded CPython 3.9+Windows ARM64

agent_transport-0.1.4-cp39-abi3-win_amd64.whl (5.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

agent_transport-0.1.4-cp39-abi3-manylinux_2_28_x86_64.whl (5.8 MB view details)

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

agent_transport-0.1.4-cp39-abi3-manylinux_2_28_aarch64.whl (5.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

agent_transport-0.1.4-cp39-abi3-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

agent_transport-0.1.4-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.1.4-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for agent_transport-0.1.4-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 820185e16c7813a58bc1aea0880a427aaa78a6b6df40088480abef5e7b2a332e
MD5 b88bd2e5a812e3551ae7e3fb4f995467
BLAKE2b-256 d95c5c69e6f3510b0843d31b526984d3c56581d5ed3f656fa4de5223e0b1f530

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.1.4-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.1.4-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for agent_transport-0.1.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9dc27222e087737bbc24c846eee70e3e097e839fe5f879a49ce1080a26941c12
MD5 c415308f98c379a0d289e154d85bf96a
BLAKE2b-256 364cb41e7daf85038edd99f898212e4eebfb17a3995c6e32889c081f4475668d

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.1.4-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.1.4-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for agent_transport-0.1.4-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7138906d78d088bda44f0eea840ff45f3861895a38947654c4edb8495c29fa9a
MD5 9df9338f0d4ef2e5c98ccba3e9340cc1
BLAKE2b-256 7744f022ad45d73c951c8fc7b2d11619a10aa9530afbb4090953715849281f72

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.1.4-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.1.4-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for agent_transport-0.1.4-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4fa891587a28345af4a5628da78edf60bf3c833ec32966573156548b88d65613
MD5 5c4d725bc61c7c7a7dd13f0ae002f1dd
BLAKE2b-256 d88f15eac171367ef1048d8701b64e4d6ac319a92060dccbc439fc5080797136

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.1.4-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.1.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for agent_transport-0.1.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf6d5efd92b7cadebcb43bde8fdf2e190c3aa70df01ae08a098dffbc73d1d37f
MD5 82cc1064644198c67aad332482b58f74
BLAKE2b-256 b5291af89b1ab0f896e09ccd310b610dc31f3468cecc1d806bf14acfc0990bbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.1.4-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.1.4-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for agent_transport-0.1.4-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 646af47542287e60fdd6ce4b8e2f690d9f570b9a562f1e282ad56a8b4063ad06
MD5 8ebf3fc11161c14e49697ca9e0ac6806
BLAKE2b-256 4ca515d55008c6882830bcce8224aa404f11c95bfbdb08f91f6956d35074cfe2

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_transport-0.1.4-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