zeroruntime 0.1.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. zeroruntime-0.1.0b1.dist-info/METADATA +143 -0
  2. zeroruntime-0.1.0b1.dist-info/RECORD +83 -0
  3. zeroruntime-0.1.0b1.dist-info/WHEEL +5 -0
  4. zeroruntime-0.1.0b1.dist-info/licenses/LICENSE +54 -0
  5. zeroruntime-0.1.0b1.dist-info/top_level.txt +1 -0
  6. zrt/__init__.py +62 -0
  7. zrt/_client/__init__.py +1 -0
  8. zrt/_client/auth.py +118 -0
  9. zrt/_client/channel.py +342 -0
  10. zrt/_client/credentials.py +76 -0
  11. zrt/_client/registry.py +442 -0
  12. zrt/_client/tool_bridge.py +186 -0
  13. zrt/_client/translate.py +166 -0
  14. zrt/_invoke.py +225 -0
  15. zrt/_log_format.py +72 -0
  16. zrt/_mcp_client.py +250 -0
  17. zrt/_plugins/__init__.py +14 -0
  18. zrt/_plugins/_registry.py +104 -0
  19. zrt/_plugins/anam.py +43 -0
  20. zrt/_plugins/anthropic.py +52 -0
  21. zrt/_plugins/assemblyai.py +51 -0
  22. zrt/_plugins/aws.py +91 -0
  23. zrt/_plugins/azure.py +91 -0
  24. zrt/_plugins/cambai.py +51 -0
  25. zrt/_plugins/cartesia.py +70 -0
  26. zrt/_plugins/cerebras.py +49 -0
  27. zrt/_plugins/cometapi.py +77 -0
  28. zrt/_plugins/deepgram.py +100 -0
  29. zrt/_plugins/elevenlabs.py +79 -0
  30. zrt/_plugins/gladia.py +49 -0
  31. zrt/_plugins/google.py +132 -0
  32. zrt/_plugins/groq.py +46 -0
  33. zrt/_plugins/humeai.py +44 -0
  34. zrt/_plugins/inworldai.py +51 -0
  35. zrt/_plugins/lmnt.py +52 -0
  36. zrt/_plugins/murfai.py +49 -0
  37. zrt/_plugins/navana.py +44 -0
  38. zrt/_plugins/neuphonic.py +47 -0
  39. zrt/_plugins/nvidia.py +68 -0
  40. zrt/_plugins/openai.py +145 -0
  41. zrt/_plugins/papla.py +42 -0
  42. zrt/_plugins/resemble.py +44 -0
  43. zrt/_plugins/rime.py +53 -0
  44. zrt/_plugins/rnnoise.py +38 -0
  45. zrt/_plugins/sarvamai.py +104 -0
  46. zrt/_plugins/silero.py +60 -0
  47. zrt/_plugins/simli.py +45 -0
  48. zrt/_plugins/smallestai.py +56 -0
  49. zrt/_plugins/speechify.py +48 -0
  50. zrt/_plugins/ultravox.py +44 -0
  51. zrt/_plugins/xai.py +106 -0
  52. zrt/_serve.py +456 -0
  53. zrt/_spec.py +185 -0
  54. zrt/_version.py +5 -0
  55. zrt/_wire/__init__.py +5 -0
  56. zrt/_wire/zeroruntime_pb2.py +186 -0
  57. zrt/_wire/zeroruntime_pb2.pyi +910 -0
  58. zrt/_wire/zeroruntime_pb2_grpc.py +317 -0
  59. zrt/core/__init__.py +1 -0
  60. zrt/core/_tasks.py +49 -0
  61. zrt/core/agent.py +306 -0
  62. zrt/core/enums.py +137 -0
  63. zrt/core/errors.py +44 -0
  64. zrt/core/events.py +146 -0
  65. zrt/core/mcp.py +74 -0
  66. zrt/core/pipeline.py +237 -0
  67. zrt/core/room.py +215 -0
  68. zrt/core/session.py +1202 -0
  69. zrt/core/stt_stream.py +70 -0
  70. zrt/core/tools.py +199 -0
  71. zrt/core/transfer.py +160 -0
  72. zrt/core/tuning.py +119 -0
  73. zrt/core/utterance.py +47 -0
  74. zrt/inference/__init__.py +80 -0
  75. zrt/inference/_registry.py +45 -0
  76. zrt/inference/denoise.py +44 -0
  77. zrt/inference/llm.py +48 -0
  78. zrt/inference/realtime.py +20 -0
  79. zrt/inference/stt.py +76 -0
  80. zrt/inference/tts.py +62 -0
  81. zrt/inference/turn.py +54 -0
  82. zrt/plugins/__init__.py +134 -0
  83. zrt/py.typed +0 -0
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: zeroruntime
3
+ Version: 0.1.0b1
4
+ Summary: Build real-time voice agents in Python.
5
+ Author: ZeroRuntime
6
+ License-Expression: LicenseRef-Proprietary
7
+ Project-URL: Homepage, https://github.com/ZeroRuntimeAI/zeroruntime-py
8
+ Project-URL: Repository, https://github.com/ZeroRuntimeAI/zeroruntime-py
9
+ Project-URL: Issues, https://github.com/ZeroRuntimeAI/zeroruntime-py/issues
10
+ Keywords: voice,voice-agents,realtime,speech,stt,tts,llm,grpc
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: grpcio>=1.83.0
26
+ Requires-Dist: protobuf<8.0,>=7.35.1
27
+ Requires-Dist: aiohttp>=3.9.0
28
+ Requires-Dist: python-dotenv>=1.0
29
+ Provides-Extra: mcp
30
+ Requires-Dist: mcp>=1.28.0; extra == "mcp"
31
+ Provides-Extra: vision
32
+ Requires-Dist: Pillow>=10.0; extra == "vision"
33
+ Provides-Extra: aws
34
+ Requires-Dist: boto3>=1.34; extra == "aws"
35
+ Provides-Extra: google
36
+ Requires-Dist: google-auth>=2.30; extra == "google"
37
+ Provides-Extra: all
38
+ Requires-Dist: zeroruntime[aws,google,mcp,vision]; extra == "all"
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=8.0; extra == "dev"
41
+ Requires-Dist: grpcio-tools==1.83.0; extra == "dev"
42
+ Dynamic: license-file
43
+
44
+ # zeroruntime
45
+
46
+ Build real-time voice agents in Python. You describe the agent — instructions,
47
+ tools, and a pipeline of providers — and the runtime runs it.
48
+
49
+ > **Beta.** This is a pre-release. The API may still change between betas, so
50
+ > pin an exact version in anything you depend on.
51
+
52
+ ## Install
53
+
54
+ Beta releases are not installed by default, so ask for them explicitly:
55
+
56
+ ```bash
57
+ pip install --pre zeroruntime
58
+ ```
59
+
60
+ or pin the version:
61
+
62
+ ```bash
63
+ pip install zeroruntime==0.1.0b1
64
+ ```
65
+
66
+ Requires Python 3.10 or newer.
67
+
68
+
69
+ Most providers need no extra: their credential is a string you set in the
70
+ environment, so the base install is enough.
71
+
72
+ ## Quickstart
73
+
74
+ ```python
75
+ import zrt
76
+ from zrt import Agent, Pipeline, Room, function_tool
77
+ from zrt.inference import TurnDetector
78
+ from zrt.plugins import CartesiaTTS, DeepgramSTT, GoogleLLM, SileroVAD
79
+
80
+ AGENT_ID = "cascade-basic-agent"
81
+
82
+
83
+ class VoiceAgent(Agent):
84
+ def __init__(self) -> None:
85
+ super().__init__(
86
+ agent_id=AGENT_ID,
87
+ instructions="You are a helpful voice assistant.",
88
+ pipeline=Pipeline(
89
+ stt=DeepgramSTT(),
90
+ llm=GoogleLLM(),
91
+ tts=CartesiaTTS(),
92
+ vad=SileroVAD(),
93
+ turn_detector=TurnDetector(),
94
+ ),
95
+ )
96
+
97
+ async def on_enter(self) -> None:
98
+ await self.session.say("Hello, how can I help you today?")
99
+
100
+ @function_tool
101
+ async def get_weather(self, latitude: str, longitude: str) -> dict:
102
+ """Fetch the current weather for a location.
103
+
104
+ Args:
105
+ latitude: Latitude of the location. Estimate it; do not ask.
106
+ longitude: Longitude of the location. Estimate it; do not ask.
107
+ """
108
+ return {"latitude": latitude, "longitude": longitude, "temperature_c": 28}
109
+
110
+
111
+ def invoke_agent() -> None:
112
+ zrt.invoke(AGENT_ID, room=Room(name="Cascade Agent", playground=True))
113
+
114
+
115
+ if __name__ == "__main__":
116
+ zrt.serve(VoiceAgent, on_ready=invoke_agent)
117
+ ```
118
+
119
+ Run it and the playground URL is printed once, on stdout. Open it to talk to
120
+ the agent.
121
+
122
+ ## Credentials
123
+
124
+ Set your runtime token in the environment before serving:
125
+
126
+ ```bash
127
+ export ZERORUNTIME_AUTH_TOKEN="..."
128
+ ```
129
+
130
+ Vendor keys go in the environment too, one per provider you use — each provider
131
+ names the variable it reads when the key is missing.
132
+
133
+ ## Providers
134
+
135
+ `zrt.plugins` calls the vendor directly with your key on your account.
136
+ `zrt.inference` reaches a subset of the same providers through the runtime
137
+ gateway instead. The names mirror each other, so swapping the import swaps who
138
+ makes the call and who is billed:
139
+
140
+ ```python
141
+ from zrt.plugins import DeepgramSTT # your Deepgram account
142
+ from zrt.inference import DeepgramSTT # through the gateway
143
+ ```
@@ -0,0 +1,83 @@
1
+ zeroruntime-0.1.0b1.dist-info/licenses/LICENSE,sha256=NlSU1VZTHtB2VSpKBmJnuyhqTNAOw5GIn7JQffXhdls,2864
2
+ zrt/__init__.py,sha256=I2pfb3XxNfNrfyjK1yASFhhFRtlQHr-YI1viJ2c7Dp0,2568
3
+ zrt/_invoke.py,sha256=Ead-HYAZypUk8vanoigRd3jIt4jG6s_GgsVxvb-zhUk,7734
4
+ zrt/_log_format.py,sha256=CjzS2Lty3aR-CdP8o4I319ZDqIZHWMNqlgzLePf0Ato,2215
5
+ zrt/_mcp_client.py,sha256=r6UCT4vfxwdJAPPFshKevsVrJKpU8SxTb2qLkIuy1tE,8423
6
+ zrt/_serve.py,sha256=qDUv9_J00h1Z9T5AndmV3AlGSpqcx5-_Mf0aOBAQY7g,14726
7
+ zrt/_spec.py,sha256=2IqEQgVuB-uO3PwHa3l5veSlYeDrR2RUAU4lwWc2n-U,7134
8
+ zrt/_version.py,sha256=31UnuPE94Oba1j9sub-0G-n5OaMCgZSTb2ysd6gRCZA,87
9
+ zrt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ zrt/_client/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
11
+ zrt/_client/auth.py,sha256=C5r0JYeytcI5U0oqeNKUv6mdvfnQq40-ydk4TpGuKIw,3560
12
+ zrt/_client/channel.py,sha256=8xJy3uzGnWmLI8-Vhx1D65XntxGi6Eq2jzpR0OJsF7A,10847
13
+ zrt/_client/credentials.py,sha256=32rENbbC3y7LgeRnbHQUB-rXt6ha0RDbC6uhKtNk2UE,2540
14
+ zrt/_client/registry.py,sha256=KnA72Z-yyauE4D50xWCAGIYNtaAIaTQ6UiSOrcUy7_w,15143
15
+ zrt/_client/tool_bridge.py,sha256=l9I_KW6Q7ZvIwmo5jL2QATBBfN8dM1Jeg72rONopBMU,5877
16
+ zrt/_client/translate.py,sha256=91-qIATsJNae34TbGB_hZaSKGjQV31jOWx4bTtv3hbA,4842
17
+ zrt/_plugins/__init__.py,sha256=vHlVoCywD6x-DVbsZ4ryFrhLt0quvz3o1j5zXW9Z7LM,773
18
+ zrt/_plugins/_registry.py,sha256=CSSi_TfQJ9_hjxsSDbPFIP9sABrrtdG74H2t44_I0pI,6594
19
+ zrt/_plugins/anam.py,sha256=EE6K7TU5XgSqGCXMLzwBTQcpb0UWtZSAVstsCMNLxvs,1719
20
+ zrt/_plugins/anthropic.py,sha256=iwqqHZUosnJtbkUGos6o9gLunG5RzSwNtPkznaIRgYI,2250
21
+ zrt/_plugins/assemblyai.py,sha256=NcQKNhXhP8X6nn6udmipBzuPzxL8RoYFgSiR5-fmuHQ,2300
22
+ zrt/_plugins/aws.py,sha256=5rVkN5lUCyo1RxsdQJkp02Dvwz_NO4IAnf0UK5T-dGk,3695
23
+ zrt/_plugins/azure.py,sha256=ulFSOVvkzu_cQrm_YsVkBHhxjmtSwgU2Jk3s5dVGWDE,3667
24
+ zrt/_plugins/cambai.py,sha256=xtiz9eqCW7j5P7KBztVL_Dhcjlg6tWpm1oC9rjfg0A0,2269
25
+ zrt/_plugins/cartesia.py,sha256=Iiz-PgZICgZB7Hz81LmehEVAXK8X1cCZoNYcEqnqnoU,2948
26
+ zrt/_plugins/cerebras.py,sha256=BinlNjreMkt9Q2TacP6cuDkBNtTZ1d27iOz5Z_45vyc,2080
27
+ zrt/_plugins/cometapi.py,sha256=SHx5ZAQa69bEnvx0Y93yphDkSUyJXbsWcqp4Iel_v5s,2785
28
+ zrt/_plugins/deepgram.py,sha256=zzxeApMZlT6i2tb-FzFyue4xNYhL6bbn8_WVZYQLWzQ,4235
29
+ zrt/_plugins/elevenlabs.py,sha256=rMI8yyUk-cpEBPG_HhPCoEPjpYvWdjC0udnUs9byNU0,3457
30
+ zrt/_plugins/gladia.py,sha256=HVzOGp6WY_GiDKD-HmwMTizvxozI2h6W5lDhdv2BX2Y,2068
31
+ zrt/_plugins/google.py,sha256=yEwQ8EKEwPYFONJ-yWVUfLxsd1VSkP0BA09Jrz3llrk,5763
32
+ zrt/_plugins/groq.py,sha256=UHOdnfza_xgXPcnwEVCbb2NdznvdNkDdNdbf0W_DjbU,1884
33
+ zrt/_plugins/humeai.py,sha256=S1Z5bpK2LVIWUDwTExP1fnbH4t1axMiFw2ZxKfzemeQ,1802
34
+ zrt/_plugins/inworldai.py,sha256=S5LxU0MS2gKhmOkq3X0NXG8R9h4qDxuACStBOzMvMSM,2239
35
+ zrt/_plugins/lmnt.py,sha256=xB0p2e8p-4irPLzEj9XzWEdxhQrAoy56R4G_vmC1Fno,2473
36
+ zrt/_plugins/murfai.py,sha256=ztp_ZL9sogwxMHnuVLlj-O2nNGHXVFhKo46YXGJRkL4,2064
37
+ zrt/_plugins/navana.py,sha256=j5H27Gyt7Oi_XIrCu1_3mEYSLLJNnOtNDxJc7QeTx8s,1785
38
+ zrt/_plugins/neuphonic.py,sha256=S0uev7yGBltxVp-t-F-AYLirTN4VHGXtiwSR4Z49MmU,2012
39
+ zrt/_plugins/nvidia.py,sha256=x53gmHC3BG2pxzNQlsYnHFzDjntyur70P96iI3wiX2o,2759
40
+ zrt/_plugins/openai.py,sha256=gtkUIa-EJMd9ivKV-MxQxTOxeDFK2kvHY68H2QQrCMY,6070
41
+ zrt/_plugins/papla.py,sha256=Y0P7fE9Y1BoY9nSXutmkIymrJRffqX6XizlWp6NsLnY,1652
42
+ zrt/_plugins/resemble.py,sha256=nU8CKsNoWGles951wFEAKsRCQjY97CON3Ghy3iSDnms,1772
43
+ zrt/_plugins/rime.py,sha256=Slg2j-tfXnfPxXalJV1_q9FUBv2xX-UkgnhPVIdsb5k,2294
44
+ zrt/_plugins/rnnoise.py,sha256=3yaHOgtl5GNxwuwVaec5yD9uacBzLepG6GJU4uZ7uq4,1503
45
+ zrt/_plugins/sarvamai.py,sha256=g98ZSBX6ccVZ-co-moGBBx8GccQxBDH2YvFfObCEP88,4402
46
+ zrt/_plugins/silero.py,sha256=aUpiflKHNWMqtPycmJUWyQVuIVadym57fN5VSMlufXM,2786
47
+ zrt/_plugins/simli.py,sha256=ZDWK3H7S0qa1UtP_Fgbaq4hTT7ho3EH_ZJ1F-ZqUyn0,1828
48
+ zrt/_plugins/smallestai.py,sha256=qDN88qB9bgo5AncMf0-sdjXj_FqRX_Uvomcxk3XZ0D8,2546
49
+ zrt/_plugins/speechify.py,sha256=bRQKW3iZCfPs4YbdzesYJKZmUTe1J2RgCOnYfmKG3YQ,2094
50
+ zrt/_plugins/ultravox.py,sha256=HGMGf8ESUC854pGYqBuajf5xuu8ZwxvPJwfBjfluDOU,1846
51
+ zrt/_plugins/xai.py,sha256=-Xn9yQ1HOq8ImrZTvrOl_6UkGsD8iSKVJNdfwWvgQRU,4083
52
+ zrt/_wire/__init__.py,sha256=xrm3qpd7gQenvLVd_KxzUYRVKST45IjMwBdu7zmufoY,239
53
+ zrt/_wire/zeroruntime_pb2.py,sha256=71qbTSBG2Mnh4JKeuSx1oWM7M_JTc45KO5EZuNxS8Cw,28567
54
+ zrt/_wire/zeroruntime_pb2.pyi,sha256=E8NFtCnLBhwaHaCMBV5Lqa5lTSFeqJzEN5dzV-DA-8U,45958
55
+ zrt/_wire/zeroruntime_pb2_grpc.py,sha256=Wot5iwhtZg0VQ6TV9ZaMVMxCxC314JwqKGFvrdn-B9k,12954
56
+ zrt/core/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
57
+ zrt/core/_tasks.py,sha256=oxFC7TZNYRMUfsj7L2fjG-331xjNYcN2ndXvMnm4zyQ,1350
58
+ zrt/core/agent.py,sha256=oNP2x7HDvISNQajBrIbffJpggRTNYgpJOII2eYk23no,10294
59
+ zrt/core/enums.py,sha256=QQVAY1nhCoCJTk3LUs-s8xDCBeCjYUbpDQR46E0i1r4,3087
60
+ zrt/core/errors.py,sha256=PkgkZ-RDWx4BCkFvuY164OYqNTyLe5f8VEQNq7eUHoI,1106
61
+ zrt/core/events.py,sha256=3ntUdiD8mOjvbctQD-ja61u82Xpt50hm-cy1jY76cHA,4743
62
+ zrt/core/mcp.py,sha256=6F8LrkQCqWcKWcAPv-9XVXASmNDS4MA86Y2wmNNXMLA,2681
63
+ zrt/core/pipeline.py,sha256=vkyqjFZvBXbrwglrE801K_zVMfofhIVXtOpnc8Kee04,8016
64
+ zrt/core/room.py,sha256=F2y-elAmCTzIvAkIjBI4EkxsrY7fQZDmtgcmxKv8GrY,9013
65
+ zrt/core/session.py,sha256=jjqkgRLSFLSkCd8g3EEhh2nK6ggDh2sxWjULo8FGcAA,42143
66
+ zrt/core/stt_stream.py,sha256=hSAaxzNN1HVFxYc0jSfp8EdJzz-VZwF5pTHtVGQiH6g,1968
67
+ zrt/core/tools.py,sha256=mMF6G3_7pW7JXFyoeprr0cUJJAeNOgLf-adcJNXSBW0,5506
68
+ zrt/core/transfer.py,sha256=F89D42h0WWFamkZlX1_fL8VOJ0SEtLPP2r7wKeDsvLc,6371
69
+ zrt/core/tuning.py,sha256=5q1CgOC0Vw5qlx0hHjCJyoYe1xrr05e485WGrzTSF2k,4883
70
+ zrt/core/utterance.py,sha256=RxNvTiNEW5UvwxpsYA1LKYSF2xuzIMbCjrX6qX2L1NE,1317
71
+ zrt/inference/__init__.py,sha256=vvlwOd1GfXoCd7yMEw01PtX-6lEDskeyABRM89GIb0w,3344
72
+ zrt/inference/_registry.py,sha256=4V_teHpPReND-OIMv3ujUadQP44sfUj-dASC_FcuhM8,2235
73
+ zrt/inference/denoise.py,sha256=sv72PhLdew7pPotwBdly8M1n05b2I8r_YrrCnnunIBI,1504
74
+ zrt/inference/llm.py,sha256=ygGsrWgnMCEm0F8kvTahRwF7L0sPrsxUjO0L61xOiSY,1440
75
+ zrt/inference/realtime.py,sha256=iXziXhy1aldORZBQn857_f8-OGqS8GVFbVLuyGxSNrs,591
76
+ zrt/inference/stt.py,sha256=cYQmJX28hzz5KlNhA4Uawr2BZaR8laBbkfrdXSyHLKE,2401
77
+ zrt/inference/tts.py,sha256=F_scA8nopZhu-I9HmVDswtw9BQ-CKSYfUwHCj2co5UA,1903
78
+ zrt/inference/turn.py,sha256=HcaCSblSHgdWPNHdvu9YHhA8BT5I64hV5ixzT6hv1G4,1859
79
+ zrt/plugins/__init__.py,sha256=aPLcE64cn2fWRjou659-P-Ab9jemS-VXkv3DM1TRIe0,6702
80
+ zeroruntime-0.1.0b1.dist-info/METADATA,sha256=pL3GEzFhDAQbBGGoCH_jwWiHoO4c-UEmH21GLbA9vck,4456
81
+ zeroruntime-0.1.0b1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
82
+ zeroruntime-0.1.0b1.dist-info/top_level.txt,sha256=44yp2UXFleIaf-P1xQJl61ajDgHcl9dy15WQwYc8eCk,4
83
+ zeroruntime-0.1.0b1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,54 @@
1
+ Zeroruntime SDK — Proprietary License
2
+
3
+ Copyright (c) 2026 Zujo Tech Pvt Ltd. All rights reserved.
4
+
5
+ This software, including its source code, object code, and accompanying
6
+ documentation (collectively, the "Software"), is the proprietary and
7
+ confidential property of Zujo Tech Pvt Ltd ("Licensor"). The Software is
8
+ licensed, not sold. No ownership rights are transferred to you. "Zero Runtime"
9
+ and "ZRT" are products and services of Zujo Tech Pvt Ltd.
10
+
11
+ 1. License Grant. Subject to your continued compliance with this License (and
12
+ with any separate written agreement you have entered into with Licensor),
13
+ Licensor grants you a limited, non-exclusive, non-transferable, non-
14
+ sublicensable, revocable license to install and use the Software solely to
15
+ develop and operate applications that connect to and interoperate with the
16
+ Zero Runtime service.
17
+
18
+ 2. Restrictions. Except to the extent expressly permitted in Section 1, by a
19
+ separate written agreement with Licensor, or by applicable law that cannot
20
+ be contractually waived, you may NOT:
21
+ (a) copy, modify, adapt, translate, or create derivative works of the
22
+ Software;
23
+ (b) distribute, publish, sublicense, sell, rent, lease, lend, or
24
+ otherwise make the Software available to any third party;
25
+ (c) reverse engineer, decompile, or disassemble the Software, or attempt
26
+ to derive its source code where not provided;
27
+ (d) use the Software to build or operate a product or service that
28
+ competes with the Zero Runtime service; or
29
+ (e) remove, obscure, or alter any proprietary notices, labels, or marks
30
+ on or in the Software.
31
+
32
+ 3. Ownership. The Software is protected by copyright and other intellectual
33
+ property laws and treaties. Licensor and its licensors retain all right,
34
+ title, and interest in and to the Software, including all intellectual
35
+ property rights therein.
36
+
37
+ 4. Termination. This License is effective until terminated. It terminates
38
+ automatically, without notice, if you breach any of its terms. Upon
39
+ termination you must cease all use of the Software and destroy all copies
40
+ in your possession or control.
41
+
42
+ 5. No Warranty. THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT
43
+ WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
44
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
45
+ NONINFRINGEMENT.
46
+
47
+ 6. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT
48
+ SHALL LICENSOR BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
49
+ CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS, DATA, OR USE,
50
+ ARISING OUT OF OR RELATED TO THIS LICENSE OR THE SOFTWARE, WHETHER IN
51
+ CONTRACT, TORT, OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
52
+ DAMAGES.
53
+
54
+ For licensing inquiries, contact: support@videosdk.live
@@ -0,0 +1 @@
1
+ zrt
zrt/__init__.py ADDED
@@ -0,0 +1,62 @@
1
+ from __future__ import annotations
2
+
3
+ import importlib
4
+ from typing import Any
5
+
6
+ from ._version import __version__
7
+
8
+ _LAZY: dict[str, tuple[str, str]] = {
9
+ "Agent": ("zrt.core.agent", "Agent"),
10
+ "BackgroundAudio": ("zrt.core.agent", "BackgroundAudio"),
11
+ "CallSummary": ("zrt.core.agent", "CallSummary"),
12
+ "Pipeline": ("zrt.core.pipeline", "Pipeline"),
13
+ "EOUConfig": ("zrt.core.tuning", "EOUConfig"),
14
+ "InterruptConfig": ("zrt.core.tuning", "InterruptConfig"),
15
+ "function_tool": ("zrt.core.tools", "function_tool"),
16
+ "MCPServerStdio": ("zrt.core.mcp", "MCPServerStdio"),
17
+ "MCPServerHTTP": ("zrt.core.mcp", "MCPServerHTTP"),
18
+ "SIPDestination": ("zrt.core.transfer", "SIPDestination"),
19
+ "WarmTransferConfig": ("zrt.core.transfer", "WarmTransferConfig"),
20
+ "WarmTransferPhase": ("zrt.core.transfer", "WarmTransferPhase"),
21
+ "WarmTransferResult": ("zrt.core.transfer", "WarmTransferResult"),
22
+ "run_stt": ("zrt.core.stt_stream", "run_stt"),
23
+ "Room": ("zrt.core.room", "Room"),
24
+ "Sip": ("zrt.core.room", "Sip"),
25
+ "Observability": ("zrt.core.room", "Observability"),
26
+ "Exporter": ("zrt.core.room", "Exporter"),
27
+ "Session": ("zrt.core.session", "Session"),
28
+ "UtteranceHandle": ("zrt.core.utterance", "UtteranceHandle"),
29
+ "PronunciationRule": ("zrt.core.pipeline", "PronunciationRule"),
30
+ "ContextWindow": ("zrt.core.pipeline", "ContextWindow"),
31
+ "RoomMessage": ("zrt.core.session", "RoomMessage"),
32
+ "Participant": ("zrt.core.session", "Participant"),
33
+ "serve": ("zrt._serve", "serve"),
34
+ "invoke": ("zrt._invoke", "invoke"),
35
+ "ZeroRuntimeChannel": ("zrt._client.channel", "ZeroRuntimeChannel"),
36
+ "ZrtError": ("zrt.core.errors", "ZrtError"),
37
+ "SessionRejected": ("zrt.core.errors", "SessionRejected"),
38
+ "ProviderUnavailable": ("zrt.core.errors", "ProviderUnavailable"),
39
+ "ZeroRuntimeUnreachable": ("zrt.core.errors", "ZeroRuntimeUnreachable"),
40
+ "ToolTimeout": ("zrt.core.errors", "ToolTimeout"),
41
+ "AgentState": ("zrt.core.enums", "AgentState"),
42
+ "UserState": ("zrt.core.enums", "UserState"),
43
+ "PipelineMode": ("zrt.core.enums", "PipelineMode"),
44
+ "ChatRole": ("zrt.core.enums", "ChatRole"),
45
+ }
46
+
47
+
48
+ def __getattr__(name: str) -> Any:
49
+ try:
50
+ module, attr = _LAZY[name]
51
+ except KeyError:
52
+ raise AttributeError(f"module 'zrt' has no attribute {name!r}") from None
53
+ value = getattr(importlib.import_module(module), attr)
54
+ globals()[name] = value
55
+ return value
56
+
57
+
58
+ def __dir__() -> list[str]:
59
+ return sorted(_LAZY)
60
+
61
+
62
+ __all__ = [*sorted(_LAZY), "__version__"]
@@ -0,0 +1 @@
1
+ from __future__ import annotations
zrt/_client/auth.py ADDED
@@ -0,0 +1,118 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import logging
5
+ import os
6
+ from typing import Optional
7
+ from urllib.parse import urljoin, urlparse
8
+
9
+ from zrt.core.errors import ZrtError
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+ AUTH_TOKEN_ENV = "ZERORUNTIME_AUTH_TOKEN"
14
+
15
+ SIGNALING_BASE_URL_ENV = "VIDEOSDK_SIGNALING_BASE_URL"
16
+ DEFAULT_SIGNALING_BASE_URL = "api.videosdk.live"
17
+
18
+ _dotenv_loaded = False
19
+
20
+
21
+ def _load_dotenv_once() -> None:
22
+ global _dotenv_loaded
23
+ if _dotenv_loaded:
24
+ return
25
+ _dotenv_loaded = True
26
+ try:
27
+ from dotenv import load_dotenv
28
+ except ImportError: # pragma: no cover - python-dotenv is a base dependency
29
+ return
30
+ try:
31
+ load_dotenv()
32
+ except Exception: # pragma: no cover - a malformed .env is not fatal
33
+ logger.debug("could not read .env", exc_info=True)
34
+
35
+
36
+ def env_value(key: str) -> Optional[str]:
37
+ value = os.environ.get(key)
38
+ if value:
39
+ return value
40
+ _load_dotenv_once()
41
+ return os.environ.get(key) or None
42
+
43
+
44
+ def resolve_auth_token(explicit: Optional[str] = None) -> Optional[str]:
45
+ return explicit or env_value(AUTH_TOKEN_ENV)
46
+
47
+
48
+ def require_auth_token(explicit: Optional[str] = None) -> str:
49
+ token = resolve_auth_token(explicit)
50
+ if not token:
51
+ raise ZrtError(
52
+ f"{AUTH_TOKEN_ENV} is not set. Every session needs it: the agent "
53
+ "joins the room with it and the inference gateway authenticates with "
54
+ "it. Export it, put it in a .env beside your script, or pass "
55
+ "auth_token= explicitly."
56
+ )
57
+ return token
58
+
59
+
60
+ def signaling_base_url(explicit: Optional[str] = None) -> str:
61
+ return explicit or os.environ.get(SIGNALING_BASE_URL_ENV) or DEFAULT_SIGNALING_BASE_URL
62
+
63
+
64
+ async def fetch_registry_url(
65
+ auth_token: str, base_url: Optional[str] = None
66
+ ) -> str:
67
+ import aiohttp
68
+
69
+ host = signaling_base_url(base_url)
70
+ url = f"https://{host}/v2/agent/init-config"
71
+ async with aiohttp.ClientSession() as http:
72
+ async with http.post(
73
+ url,
74
+ headers={"Authorization": auth_token, "Content-Type": "application/json"},
75
+ ) as response:
76
+ body = await response.text()
77
+ if response.status != 200:
78
+ raise ZrtError(f"init-config failed: HTTP {response.status}: {body}")
79
+ try:
80
+ data = json.loads(body)
81
+ except json.JSONDecodeError as exc:
82
+ raise ZrtError(f"init-config returned non-JSON: {body[:200]}") from exc
83
+
84
+ if not data.get("success"):
85
+ raise ZrtError(f"init-config returned an error: {data.get('message')}")
86
+ registry_url = (data.get("data") or {}).get("registryUrl")
87
+ if not registry_url:
88
+ raise ZrtError("init-config response has no registryUrl")
89
+ return registry_url
90
+
91
+
92
+ def to_websocket_url(registry_url: str) -> str:
93
+ if "://" not in registry_url:
94
+ registry_url = f"wss://{registry_url}"
95
+ parsed = urlparse(registry_url)
96
+ scheme = {"http": "ws", "https": "wss", "ws": "ws", "wss": "wss"}.get(
97
+ parsed.scheme, "wss"
98
+ )
99
+ base = f"{scheme}://{parsed.netloc}{parsed.path}".rstrip("/") + "/"
100
+ return urljoin(base, "agent")
101
+
102
+
103
+ def registry_ws_headers(auth_token: str) -> dict[str, str]:
104
+ return {"Authorization": f"Bearer {auth_token}"}
105
+
106
+
107
+ __all__ = [
108
+ "AUTH_TOKEN_ENV",
109
+ "DEFAULT_SIGNALING_BASE_URL",
110
+ "SIGNALING_BASE_URL_ENV",
111
+ "env_value",
112
+ "fetch_registry_url",
113
+ "registry_ws_headers",
114
+ "require_auth_token",
115
+ "resolve_auth_token",
116
+ "signaling_base_url",
117
+ "to_websocket_url",
118
+ ]