Metadata-Version: 2.4
Name: zrt
Version: 0.1.0
Summary: Build real-time AI voice agents in Python. Zero Runtime runs the speech-to-speech pipeline (STT, LLM, TTS) for you.
Author-email: Zujo Tech Pvt Ltd <support@videosdk.live>
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://zeroruntime.ai/
Project-URL: Examples, https://github.com/ZeroRuntimeAI/zrt-python-sdk-examples
Keywords: voice-agents,voice-ai,ai-voice-agent,conversational-ai,voice-assistant,speech-to-speech,realtime-voice,voicebot,llm,stt,tts,speech-to-text,text-to-speech,telephony,sip,webrtc,zero-runtime
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: grpcio>=1.81.0
Requires-Dist: protobuf>=6.31.0
Requires-Dist: aiohttp>=3.9.0
Provides-Extra: vision
Requires-Dist: Pillow>=10.0; extra == "vision"
Provides-Extra: dev
Requires-Dist: pytest>=8.4; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: grpcio-tools>=1.81.0; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=6.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Dynamic: license-file

# ZRT: Zero Runtime Python SDK

[![PyPI version](https://img.shields.io/pypi/v/zrt.svg)](https://pypi.org/project/zrt/)
[![Python versions](https://img.shields.io/pypi/pyversions/zrt.svg)](https://pypi.org/project/zrt/)

**Serverless voice AI agents for Python.** Write the agent in real Python with your own
STT, LLM, and TTS providers. **Zero Runtime** runs the live speech‑to‑speech pipeline
(turn detection, denoising, interruptions) at low latency in the cloud.

> **You write the agent. We run the runtime.** No media servers, no GPUs, no autoscaling.

| | Self‑hosted frameworks | No‑code platforms | **Zero Runtime** |
|---|:---:|:---:|:---:|
| Real Python + custom tools | ✅ | ❌ (dashboard) | ✅ |
| Run media servers / GPUs / scaling | ❌ *you operate it* | ✅ managed | ✅ **serverless** |
| Bring any provider + your own keys | ✅ | limited | ✅ |

## Install

```bash
pip install zrt
```

Requires **Python 3.10+**.

## Quickstart

Get your auth token from [app.zeroruntime.ai](https://app.zeroruntime.ai).

```bash
export ZRT_AUTH_TOKEN=<your-token>
export DEEPGRAM_API_KEY=<key>    # speech-to-text
export GOOGLE_API_KEY=<key>      # LLM (Gemini)
export CARTESIA_API_KEY=<key>    # text-to-speech
```

```python
# agent.py
from zrt import serve, invoke, Room
from zrt.agents import Agent, Pipeline, function_tool
from zrt.plugins.deepgram import DeepgramSTT
from zrt.plugins.google import GoogleLLM
from zrt.plugins.cartesia import CartesiaTTS

AGENT_ID = "assistant"


class Assistant(Agent):
    def __init__(self):
        super().__init__(
            instructions="You are a friendly voice assistant. Keep replies short.",
            agent_id=AGENT_ID,
            pipeline=Pipeline(
                stt=DeepgramSTT(),
                llm=GoogleLLM(model="gemini-2.5-flash"),
                tts=CartesiaTTS(),
            ),
        )

    async def on_enter(self):
        await self.session.say("Hi! How can I help?")

    @function_tool
    async def get_weather(self, city: str) -> dict:
        """Get the current weather for a city.

        Args:
            city: City name
        """
        return {"city": city, "temp_c": 22}


def on_ready() -> None:
    # Registration confirmed; start a playground session and print a join link.
    info = invoke(AGENT_ID, room=Room(playground=True))
    if info.get("playground_url"):
        print(f"Join the playground: {info['playground_url']}")


if __name__ == "__main__":
    serve(Assistant(), on_ready=on_ready)
```

```bash
python agent.py
```

`serve()` registers the agent; once it's ready, `on_ready` fires `invoke()` to start a
playground session and print a link you can open to talk to it.

## Concepts

| Building block | What it is |
|---|---|
| **`Agent`** | Your behavior: instructions, tools, and what it says on enter/exit. |
| **`Pipeline`** | STT (hear) → LLM (think) → TTS (speak), plus optional VAD, turn detection, denoising. |
| **`serve(agent)`** | Register the agent and serve a session to each caller. |
| **`invoke(agent_id, …)`** | Start a session on demand (e.g. an outbound call). |

Add a `@function_tool` method to your agent and the LLM calls it (with your typed
args) whenever it needs to. Methods are auto-registered; for tools defined outside
the agent, pass them via `tools=[...]`.

## Providers

Mix and match. Swap any stage in a line:

- **STT:** Deepgram, AssemblyAI, Google, Azure, Sarvam, and more.
- **LLM:** OpenAI, Google Gemini, Anthropic Claude, Groq, Cerebras, xAI Grok, Sarvam, and more.
- **TTS:** Cartesia, ElevenLabs, Google, Azure, Deepgram, and more.
- **Realtime (speech‑to‑speech):** OpenAI Realtime, Gemini Live, and more.
- **Turn detection:** Namo · **VAD:** Silero · **Denoise:** RNNoise

## Resources

- **Docs:** https://docs.zeroruntime.ai/
- **Examples:** https://github.com/ZeroRuntimeAI/zrt-python-sdk-examples
- **Dashboard & tokens:** https://app.zeroruntime.ai
- **Support:** support@zeroruntime.ai

---

© 2026 Zujo Tech Pvt Ltd. All rights reserved.
