zeroruntime 0.1.0__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 (87) hide show
  1. zeroruntime-0.1.0.dist-info/METADATA +128 -0
  2. zeroruntime-0.1.0.dist-info/RECORD +87 -0
  3. zeroruntime-0.1.0.dist-info/WHEEL +5 -0
  4. zeroruntime-0.1.0.dist-info/entry_points.txt +2 -0
  5. zeroruntime-0.1.0.dist-info/licenses/LICENSE +54 -0
  6. zeroruntime-0.1.0.dist-info/top_level.txt +1 -0
  7. zrt/__init__.py +65 -0
  8. zrt/_cli.py +193 -0
  9. zrt/_cli_download.py +186 -0
  10. zrt/_client/__init__.py +1 -0
  11. zrt/_client/auth.py +122 -0
  12. zrt/_client/channel.py +343 -0
  13. zrt/_client/credentials.py +76 -0
  14. zrt/_client/registry.py +483 -0
  15. zrt/_client/tool_bridge.py +186 -0
  16. zrt/_client/translate.py +165 -0
  17. zrt/_invoke.py +242 -0
  18. zrt/_log_format.py +72 -0
  19. zrt/_mcp_client.py +250 -0
  20. zrt/_plugins/__init__.py +14 -0
  21. zrt/_plugins/_registry.py +104 -0
  22. zrt/_plugins/anam.py +43 -0
  23. zrt/_plugins/anthropic.py +52 -0
  24. zrt/_plugins/assemblyai.py +51 -0
  25. zrt/_plugins/aws.py +91 -0
  26. zrt/_plugins/azure.py +91 -0
  27. zrt/_plugins/cambai.py +51 -0
  28. zrt/_plugins/cartesia.py +70 -0
  29. zrt/_plugins/cerebras.py +49 -0
  30. zrt/_plugins/cometapi.py +77 -0
  31. zrt/_plugins/deepgram.py +100 -0
  32. zrt/_plugins/elevenlabs.py +79 -0
  33. zrt/_plugins/gladia.py +49 -0
  34. zrt/_plugins/google.py +132 -0
  35. zrt/_plugins/groq.py +46 -0
  36. zrt/_plugins/humeai.py +44 -0
  37. zrt/_plugins/inworldai.py +51 -0
  38. zrt/_plugins/lmnt.py +52 -0
  39. zrt/_plugins/murfai.py +49 -0
  40. zrt/_plugins/navana.py +44 -0
  41. zrt/_plugins/neuphonic.py +47 -0
  42. zrt/_plugins/nvidia.py +68 -0
  43. zrt/_plugins/openai.py +145 -0
  44. zrt/_plugins/papla.py +42 -0
  45. zrt/_plugins/resemble.py +44 -0
  46. zrt/_plugins/rime.py +53 -0
  47. zrt/_plugins/rnnoise.py +38 -0
  48. zrt/_plugins/sarvamai.py +104 -0
  49. zrt/_plugins/silero.py +60 -0
  50. zrt/_plugins/simli.py +45 -0
  51. zrt/_plugins/smallestai.py +56 -0
  52. zrt/_plugins/speechify.py +48 -0
  53. zrt/_plugins/ultravox.py +44 -0
  54. zrt/_plugins/xai.py +106 -0
  55. zrt/_serve.py +571 -0
  56. zrt/_spec.py +185 -0
  57. zrt/_version.py +5 -0
  58. zrt/_wire/__init__.py +5 -0
  59. zrt/_wire/zeroruntime_pb2.py +186 -0
  60. zrt/_wire/zeroruntime_pb2.pyi +910 -0
  61. zrt/_wire/zeroruntime_pb2_grpc.py +317 -0
  62. zrt/core/__init__.py +1 -0
  63. zrt/core/_tasks.py +49 -0
  64. zrt/core/agent.py +302 -0
  65. zrt/core/context.py +19 -0
  66. zrt/core/enums.py +137 -0
  67. zrt/core/errors.py +44 -0
  68. zrt/core/events.py +146 -0
  69. zrt/core/mcp.py +74 -0
  70. zrt/core/pipeline.py +288 -0
  71. zrt/core/room.py +322 -0
  72. zrt/core/session.py +1377 -0
  73. zrt/core/stt_stream.py +89 -0
  74. zrt/core/tools.py +199 -0
  75. zrt/core/transfer.py +160 -0
  76. zrt/core/tuning.py +119 -0
  77. zrt/core/utterance.py +47 -0
  78. zrt/inference/__init__.py +80 -0
  79. zrt/inference/_registry.py +45 -0
  80. zrt/inference/denoise.py +44 -0
  81. zrt/inference/llm.py +48 -0
  82. zrt/inference/realtime.py +20 -0
  83. zrt/inference/stt.py +76 -0
  84. zrt/inference/tts.py +62 -0
  85. zrt/inference/turn.py +54 -0
  86. zrt/plugins/__init__.py +134 -0
  87. zrt/py.typed +0 -0
@@ -0,0 +1,128 @@
1
+ Metadata-Version: 2.4
2
+ Name: zeroruntime
3
+ Version: 0.1.0
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 :: 5 - Production/Stable
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
+ Requires-Dist: mcp>=1.28.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8.0; extra == "dev"
32
+ Requires-Dist: grpcio-tools==1.83.0; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # zeroruntime
36
+
37
+ Build real-time voice agents in Python. You describe the agent — instructions,
38
+ tools, and a pipeline of providers — and the runtime runs it.
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ pip install zeroruntime
44
+ ```
45
+
46
+ or pin the version:
47
+
48
+ ```bash
49
+ pip install zeroruntime==0.1.0
50
+ ```
51
+
52
+ Requires Python 3.10 or newer.
53
+
54
+ Most providers need no extra: their credential is a string you set in the
55
+ environment, so the base install is enough.
56
+
57
+ ## Quickstart
58
+
59
+ ```python
60
+ import zrt
61
+ from zrt import Agent, Pipeline, Room, function_tool
62
+ from zrt.inference import TurnDetector
63
+ from zrt.plugins import CartesiaTTS, DeepgramSTT, GoogleLLM, SileroVAD
64
+
65
+ AGENT_ID = "cascade-basic-agent"
66
+
67
+
68
+ class VoiceAgent(Agent):
69
+ def __init__(self) -> None:
70
+ super().__init__(
71
+ agent_id=AGENT_ID,
72
+ instructions="You are a helpful voice assistant.",
73
+ pipeline=Pipeline(
74
+ stt=DeepgramSTT(),
75
+ llm=GoogleLLM(),
76
+ tts=CartesiaTTS(),
77
+ vad=SileroVAD(),
78
+ turn_detector=TurnDetector(),
79
+ ),
80
+ )
81
+
82
+ async def on_enter(self) -> None:
83
+ await self.session.say("Hello, how can I help you today?")
84
+
85
+ @function_tool
86
+ async def get_weather(self, latitude: str, longitude: str) -> dict:
87
+ """Fetch the current weather for a location.
88
+
89
+ Args:
90
+ latitude: Latitude of the location. Estimate it; do not ask.
91
+ longitude: Longitude of the location. Estimate it; do not ask.
92
+ """
93
+ return {"latitude": latitude, "longitude": longitude, "temperature_c": 28}
94
+
95
+
96
+ def invoke_agent() -> None:
97
+ zrt.invoke(AGENT_ID, room=Room(name="Cascade Agent", playground=True))
98
+
99
+
100
+ if __name__ == "__main__":
101
+ zrt.serve(VoiceAgent, on_ready=invoke_agent)
102
+ ```
103
+
104
+ Run it and the playground URL is printed once, on stdout. Open it to talk to
105
+ the agent.
106
+
107
+ ## Credentials
108
+
109
+ Set your runtime token in the environment before serving:
110
+
111
+ ```bash
112
+ export ZERORUNTIME_AUTH_TOKEN="..."
113
+ ```
114
+
115
+ Vendor keys go in the environment too, one per provider you use — each provider
116
+ names the variable it reads when the key is missing.
117
+
118
+ ## Providers
119
+
120
+ `zrt.plugins` calls the vendor directly with your key on your account.
121
+ `zrt.inference` reaches a subset of the same providers through the runtime
122
+ gateway instead. The names mirror each other, so swapping the import swaps who
123
+ makes the call and who is billed:
124
+
125
+ ```python
126
+ from zrt.plugins import DeepgramSTT # your Deepgram account
127
+ from zrt.inference import DeepgramSTT # through the gateway
128
+ ```
@@ -0,0 +1,87 @@
1
+ zeroruntime-0.1.0.dist-info/licenses/LICENSE,sha256=NlSU1VZTHtB2VSpKBmJnuyhqTNAOw5GIn7JQffXhdls,2864
2
+ zrt/__init__.py,sha256=2BO0XlhJgL-t4a_U2TJm_bNeiBG9uucUuybrHpN6wMM,2720
3
+ zrt/_cli.py,sha256=WNAurySEUjnBYL4eP1_1yByOersAVXGlLE6JrueD5Os,5839
4
+ zrt/_cli_download.py,sha256=2GmpmPmI57DWnT68HKIKsoTPqPWiPnSjFgHe4YAtfzg,6308
5
+ zrt/_invoke.py,sha256=JDL508q0d43BVG8047iUdlJFGul-Ueq2iZ5RrKLmAis,8369
6
+ zrt/_log_format.py,sha256=CjzS2Lty3aR-CdP8o4I319ZDqIZHWMNqlgzLePf0Ato,2215
7
+ zrt/_mcp_client.py,sha256=r6UCT4vfxwdJAPPFshKevsVrJKpU8SxTb2qLkIuy1tE,8423
8
+ zrt/_serve.py,sha256=ktZT9NhSqgwwedOgw5RmP4zEy9tDkDwBZlYxmiOeAHw,19882
9
+ zrt/_spec.py,sha256=2IqEQgVuB-uO3PwHa3l5veSlYeDrR2RUAU4lwWc2n-U,7134
10
+ zrt/_version.py,sha256=BqrlbKZZBAHhA1__5ZHwLPQaCkW7Pi_dgI-cgbAZm40,85
11
+ zrt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ zrt/_client/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
13
+ zrt/_client/auth.py,sha256=Teb7z0H_Y5uphYod80vsYKngGRRCSi5AeJUCXRhN17o,3673
14
+ zrt/_client/channel.py,sha256=DCyKjn7oPREhtYk0O2mTpxZdFKWmguOn9XQns28oUME,10857
15
+ zrt/_client/credentials.py,sha256=32rENbbC3y7LgeRnbHQUB-rXt6ha0RDbC6uhKtNk2UE,2540
16
+ zrt/_client/registry.py,sha256=tvekzgUS4mB1w-ptdbSxFJqxWrN8iKVNNlWENRWTrn8,17020
17
+ zrt/_client/tool_bridge.py,sha256=l9I_KW6Q7ZvIwmo5jL2QATBBfN8dM1Jeg72rONopBMU,5877
18
+ zrt/_client/translate.py,sha256=S_qMNCfepzWoFjNr-0qFdLrHAnizKGDpbZiPMWKdx8E,4841
19
+ zrt/_plugins/__init__.py,sha256=vHlVoCywD6x-DVbsZ4ryFrhLt0quvz3o1j5zXW9Z7LM,773
20
+ zrt/_plugins/_registry.py,sha256=CSSi_TfQJ9_hjxsSDbPFIP9sABrrtdG74H2t44_I0pI,6594
21
+ zrt/_plugins/anam.py,sha256=EE6K7TU5XgSqGCXMLzwBTQcpb0UWtZSAVstsCMNLxvs,1719
22
+ zrt/_plugins/anthropic.py,sha256=iwqqHZUosnJtbkUGos6o9gLunG5RzSwNtPkznaIRgYI,2250
23
+ zrt/_plugins/assemblyai.py,sha256=NcQKNhXhP8X6nn6udmipBzuPzxL8RoYFgSiR5-fmuHQ,2300
24
+ zrt/_plugins/aws.py,sha256=5rVkN5lUCyo1RxsdQJkp02Dvwz_NO4IAnf0UK5T-dGk,3695
25
+ zrt/_plugins/azure.py,sha256=ulFSOVvkzu_cQrm_YsVkBHhxjmtSwgU2Jk3s5dVGWDE,3667
26
+ zrt/_plugins/cambai.py,sha256=xtiz9eqCW7j5P7KBztVL_Dhcjlg6tWpm1oC9rjfg0A0,2269
27
+ zrt/_plugins/cartesia.py,sha256=Iiz-PgZICgZB7Hz81LmehEVAXK8X1cCZoNYcEqnqnoU,2948
28
+ zrt/_plugins/cerebras.py,sha256=BinlNjreMkt9Q2TacP6cuDkBNtTZ1d27iOz5Z_45vyc,2080
29
+ zrt/_plugins/cometapi.py,sha256=SHx5ZAQa69bEnvx0Y93yphDkSUyJXbsWcqp4Iel_v5s,2785
30
+ zrt/_plugins/deepgram.py,sha256=zzxeApMZlT6i2tb-FzFyue4xNYhL6bbn8_WVZYQLWzQ,4235
31
+ zrt/_plugins/elevenlabs.py,sha256=rMI8yyUk-cpEBPG_HhPCoEPjpYvWdjC0udnUs9byNU0,3457
32
+ zrt/_plugins/gladia.py,sha256=HVzOGp6WY_GiDKD-HmwMTizvxozI2h6W5lDhdv2BX2Y,2068
33
+ zrt/_plugins/google.py,sha256=yEwQ8EKEwPYFONJ-yWVUfLxsd1VSkP0BA09Jrz3llrk,5763
34
+ zrt/_plugins/groq.py,sha256=UHOdnfza_xgXPcnwEVCbb2NdznvdNkDdNdbf0W_DjbU,1884
35
+ zrt/_plugins/humeai.py,sha256=S1Z5bpK2LVIWUDwTExP1fnbH4t1axMiFw2ZxKfzemeQ,1802
36
+ zrt/_plugins/inworldai.py,sha256=S5LxU0MS2gKhmOkq3X0NXG8R9h4qDxuACStBOzMvMSM,2239
37
+ zrt/_plugins/lmnt.py,sha256=xB0p2e8p-4irPLzEj9XzWEdxhQrAoy56R4G_vmC1Fno,2473
38
+ zrt/_plugins/murfai.py,sha256=ztp_ZL9sogwxMHnuVLlj-O2nNGHXVFhKo46YXGJRkL4,2064
39
+ zrt/_plugins/navana.py,sha256=j5H27Gyt7Oi_XIrCu1_3mEYSLLJNnOtNDxJc7QeTx8s,1785
40
+ zrt/_plugins/neuphonic.py,sha256=S0uev7yGBltxVp-t-F-AYLirTN4VHGXtiwSR4Z49MmU,2012
41
+ zrt/_plugins/nvidia.py,sha256=x53gmHC3BG2pxzNQlsYnHFzDjntyur70P96iI3wiX2o,2759
42
+ zrt/_plugins/openai.py,sha256=gtkUIa-EJMd9ivKV-MxQxTOxeDFK2kvHY68H2QQrCMY,6070
43
+ zrt/_plugins/papla.py,sha256=Y0P7fE9Y1BoY9nSXutmkIymrJRffqX6XizlWp6NsLnY,1652
44
+ zrt/_plugins/resemble.py,sha256=nU8CKsNoWGles951wFEAKsRCQjY97CON3Ghy3iSDnms,1772
45
+ zrt/_plugins/rime.py,sha256=Slg2j-tfXnfPxXalJV1_q9FUBv2xX-UkgnhPVIdsb5k,2294
46
+ zrt/_plugins/rnnoise.py,sha256=3yaHOgtl5GNxwuwVaec5yD9uacBzLepG6GJU4uZ7uq4,1503
47
+ zrt/_plugins/sarvamai.py,sha256=g98ZSBX6ccVZ-co-moGBBx8GccQxBDH2YvFfObCEP88,4402
48
+ zrt/_plugins/silero.py,sha256=aUpiflKHNWMqtPycmJUWyQVuIVadym57fN5VSMlufXM,2786
49
+ zrt/_plugins/simli.py,sha256=ZDWK3H7S0qa1UtP_Fgbaq4hTT7ho3EH_ZJ1F-ZqUyn0,1828
50
+ zrt/_plugins/smallestai.py,sha256=qDN88qB9bgo5AncMf0-sdjXj_FqRX_Uvomcxk3XZ0D8,2546
51
+ zrt/_plugins/speechify.py,sha256=bRQKW3iZCfPs4YbdzesYJKZmUTe1J2RgCOnYfmKG3YQ,2094
52
+ zrt/_plugins/ultravox.py,sha256=HGMGf8ESUC854pGYqBuajf5xuu8ZwxvPJwfBjfluDOU,1846
53
+ zrt/_plugins/xai.py,sha256=-Xn9yQ1HOq8ImrZTvrOl_6UkGsD8iSKVJNdfwWvgQRU,4083
54
+ zrt/_wire/__init__.py,sha256=xrm3qpd7gQenvLVd_KxzUYRVKST45IjMwBdu7zmufoY,239
55
+ zrt/_wire/zeroruntime_pb2.py,sha256=71qbTSBG2Mnh4JKeuSx1oWM7M_JTc45KO5EZuNxS8Cw,28567
56
+ zrt/_wire/zeroruntime_pb2.pyi,sha256=E8NFtCnLBhwaHaCMBV5Lqa5lTSFeqJzEN5dzV-DA-8U,45958
57
+ zrt/_wire/zeroruntime_pb2_grpc.py,sha256=Wot5iwhtZg0VQ6TV9ZaMVMxCxC314JwqKGFvrdn-B9k,12954
58
+ zrt/core/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
59
+ zrt/core/_tasks.py,sha256=oxFC7TZNYRMUfsj7L2fjG-331xjNYcN2ndXvMnm4zyQ,1350
60
+ zrt/core/agent.py,sha256=RVkEuPxCeoPCRomjAPKE7Q1jdV5P2rpbQxK8_DeN59Y,10062
61
+ zrt/core/context.py,sha256=gnva28bJigvGICkxHVXbklcYXE-NSiX1eDvnJBm8qyk,425
62
+ zrt/core/enums.py,sha256=QQVAY1nhCoCJTk3LUs-s8xDCBeCjYUbpDQR46E0i1r4,3087
63
+ zrt/core/errors.py,sha256=PkgkZ-RDWx4BCkFvuY164OYqNTyLe5f8VEQNq7eUHoI,1106
64
+ zrt/core/events.py,sha256=3ntUdiD8mOjvbctQD-ja61u82Xpt50hm-cy1jY76cHA,4743
65
+ zrt/core/mcp.py,sha256=6F8LrkQCqWcKWcAPv-9XVXASmNDS4MA86Y2wmNNXMLA,2681
66
+ zrt/core/pipeline.py,sha256=NjU37dg0ZamyJswNCG2sBLLq-3pnvCDAeSTBdsrnNzk,9513
67
+ zrt/core/room.py,sha256=Y9cGiiIgf2gIf9n44ksgNbQY8hpVvFMx66Xzi2WspFU,13090
68
+ zrt/core/session.py,sha256=X_A2Ijb-FsDfME8lPK5GxPO6JSyh6d0Q-y6j5eJKhpo,48499
69
+ zrt/core/stt_stream.py,sha256=83mRto7dLCGwfQDNPiAifjcOw8-A-T6qYQf6NiHM6AI,2473
70
+ zrt/core/tools.py,sha256=mMF6G3_7pW7JXFyoeprr0cUJJAeNOgLf-adcJNXSBW0,5506
71
+ zrt/core/transfer.py,sha256=F89D42h0WWFamkZlX1_fL8VOJ0SEtLPP2r7wKeDsvLc,6371
72
+ zrt/core/tuning.py,sha256=5q1CgOC0Vw5qlx0hHjCJyoYe1xrr05e485WGrzTSF2k,4883
73
+ zrt/core/utterance.py,sha256=RxNvTiNEW5UvwxpsYA1LKYSF2xuzIMbCjrX6qX2L1NE,1317
74
+ zrt/inference/__init__.py,sha256=vvlwOd1GfXoCd7yMEw01PtX-6lEDskeyABRM89GIb0w,3344
75
+ zrt/inference/_registry.py,sha256=4V_teHpPReND-OIMv3ujUadQP44sfUj-dASC_FcuhM8,2235
76
+ zrt/inference/denoise.py,sha256=sv72PhLdew7pPotwBdly8M1n05b2I8r_YrrCnnunIBI,1504
77
+ zrt/inference/llm.py,sha256=ygGsrWgnMCEm0F8kvTahRwF7L0sPrsxUjO0L61xOiSY,1440
78
+ zrt/inference/realtime.py,sha256=iXziXhy1aldORZBQn857_f8-OGqS8GVFbVLuyGxSNrs,591
79
+ zrt/inference/stt.py,sha256=cYQmJX28hzz5KlNhA4Uawr2BZaR8laBbkfrdXSyHLKE,2401
80
+ zrt/inference/tts.py,sha256=F_scA8nopZhu-I9HmVDswtw9BQ-CKSYfUwHCj2co5UA,1903
81
+ zrt/inference/turn.py,sha256=HcaCSblSHgdWPNHdvu9YHhA8BT5I64hV5ixzT6hv1G4,1859
82
+ zrt/plugins/__init__.py,sha256=aPLcE64cn2fWRjou659-P-Ab9jemS-VXkv3DM1TRIe0,6702
83
+ zeroruntime-0.1.0.dist-info/METADATA,sha256=tTVBrVMk6Hm_6vWwblVrX_EVBmkFvVO4el8cWMV6zQM,3926
84
+ zeroruntime-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
85
+ zeroruntime-0.1.0.dist-info/entry_points.txt,sha256=39I-K-0tUoRpYfUF8542UIJKC_NE9eLCyj2-J1ZQBnY,38
86
+ zeroruntime-0.1.0.dist-info/top_level.txt,sha256=44yp2UXFleIaf-P1xQJl61ajDgHcl9dy15WQwYc8eCk,4
87
+ zeroruntime-0.1.0.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,2 @@
1
+ [console_scripts]
2
+ zrt = zrt._cli:main
@@ -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,65 @@
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
+ "AgentContext": ("zrt.core.context", "AgentContext"),
11
+ "BackgroundAudio": ("zrt.core.agent", "BackgroundAudio"),
12
+ "CallSummary": ("zrt.core.agent", "CallSummary"),
13
+ "Pipeline": ("zrt.core.pipeline", "Pipeline"),
14
+ "NO_CHANGE": ("zrt.core.pipeline", "NO_CHANGE"),
15
+ "EOUConfig": ("zrt.core.tuning", "EOUConfig"),
16
+ "InterruptConfig": ("zrt.core.tuning", "InterruptConfig"),
17
+ "function_tool": ("zrt.core.tools", "function_tool"),
18
+ "MCPServerStdio": ("zrt.core.mcp", "MCPServerStdio"),
19
+ "MCPServerHTTP": ("zrt.core.mcp", "MCPServerHTTP"),
20
+ "SIPDestination": ("zrt.core.transfer", "SIPDestination"),
21
+ "WarmTransferConfig": ("zrt.core.transfer", "WarmTransferConfig"),
22
+ "WarmTransferPhase": ("zrt.core.transfer", "WarmTransferPhase"),
23
+ "WarmTransferResult": ("zrt.core.transfer", "WarmTransferResult"),
24
+ "run_stt": ("zrt.core.stt_stream", "run_stt"),
25
+ "Room": ("zrt.core.room", "Room"),
26
+ "UNSET": ("zrt.core.room", "UNSET"),
27
+ "Sip": ("zrt.core.room", "Sip"),
28
+ "Observability": ("zrt.core.room", "Observability"),
29
+ "Exporter": ("zrt.core.room", "Exporter"),
30
+ "Session": ("zrt.core.session", "Session"),
31
+ "UtteranceHandle": ("zrt.core.utterance", "UtteranceHandle"),
32
+ "PronunciationRule": ("zrt.core.pipeline", "PronunciationRule"),
33
+ "ContextWindow": ("zrt.core.pipeline", "ContextWindow"),
34
+ "RoomMessage": ("zrt.core.session", "RoomMessage"),
35
+ "Participant": ("zrt.core.session", "Participant"),
36
+ "serve": ("zrt._serve", "serve"),
37
+ "invoke": ("zrt._invoke", "invoke"),
38
+ "ZeroRuntimeChannel": ("zrt._client.channel", "ZeroRuntimeChannel"),
39
+ "ZrtError": ("zrt.core.errors", "ZrtError"),
40
+ "SessionRejected": ("zrt.core.errors", "SessionRejected"),
41
+ "ProviderUnavailable": ("zrt.core.errors", "ProviderUnavailable"),
42
+ "ZeroRuntimeUnreachable": ("zrt.core.errors", "ZeroRuntimeUnreachable"),
43
+ "ToolTimeout": ("zrt.core.errors", "ToolTimeout"),
44
+ "AgentState": ("zrt.core.enums", "AgentState"),
45
+ "UserState": ("zrt.core.enums", "UserState"),
46
+ "PipelineMode": ("zrt.core.enums", "PipelineMode"),
47
+ "ChatRole": ("zrt.core.enums", "ChatRole"),
48
+ }
49
+
50
+
51
+ def __getattr__(name: str) -> Any:
52
+ try:
53
+ module, attr = _LAZY[name]
54
+ except KeyError:
55
+ raise AttributeError(f"module 'zrt' has no attribute {name!r}") from None
56
+ value = getattr(importlib.import_module(module), attr)
57
+ globals()[name] = value
58
+ return value
59
+
60
+
61
+ def __dir__() -> list[str]:
62
+ return sorted(_LAZY)
63
+
64
+
65
+ __all__ = [*sorted(_LAZY), "__version__"]
zrt/_cli.py ADDED
@@ -0,0 +1,193 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import platform
5
+ import sys
6
+ import time
7
+ from typing import Optional
8
+
9
+ from ._version import __version__ as _PACKAGE_VERSION
10
+
11
+ REQUIRED_CLI_VERSION = "latest"
12
+ _LATEST_TTL_S = 24 * 60 * 60
13
+
14
+ _ARCH = {
15
+ "x86_64": "x86_64",
16
+ "amd64": "x86_64",
17
+ "AMD64": "x86_64",
18
+ "arm64": "aarch64",
19
+ "aarch64": "aarch64",
20
+ }
21
+
22
+
23
+ def cli_version() -> str:
24
+ return os.environ.get("ZRT_CLI_VERSION", "").strip() or REQUIRED_CLI_VERSION
25
+
26
+
27
+ def detect_target(
28
+ system: Optional[str] = None, machine: Optional[str] = None
29
+ ) -> str:
30
+ system = system or platform.system()
31
+ machine = machine or platform.machine()
32
+ arch = _ARCH.get(machine) or _ARCH.get(machine.lower())
33
+ if not arch:
34
+ raise RuntimeError(
35
+ f"The ZRT CLI is not available for this architecture: {machine}."
36
+ )
37
+ if system == "Darwin":
38
+ return f"{arch}-apple-darwin"
39
+ if system == "Linux":
40
+ return f"{arch}-unknown-linux-gnu"
41
+ if system == "Windows":
42
+ return f"{arch}-pc-windows-msvc"
43
+ raise RuntimeError(
44
+ f"The ZRT CLI is not available for this operating system: {system}."
45
+ )
46
+
47
+
48
+ def cli_binary_name() -> str:
49
+ return "zrt.exe" if sys.platform.startswith("win") else "zrt"
50
+
51
+
52
+ def zrt_home() -> str:
53
+ return os.environ.get("ZRT_HOME") or os.path.join(os.path.expanduser("~"), ".zrt")
54
+
55
+
56
+ def cli_install_path(version: Optional[str] = None) -> str:
57
+ return os.path.join(
58
+ zrt_home(), "bin", version or cli_version(), cli_binary_name()
59
+ )
60
+
61
+
62
+ def checksum_record_path(binary_path: str) -> str:
63
+ return binary_path + ".sha256"
64
+
65
+
66
+ def package_record_path(binary_path: str) -> str:
67
+ """Which ``zrt`` release this cached CLI was fetched for."""
68
+ return binary_path + ".pkg"
69
+
70
+
71
+ def cached_package_version(binary_path: str) -> str:
72
+ try:
73
+ with open(package_record_path(binary_path), "r", encoding="utf-8") as f:
74
+ return f.read().strip()
75
+ except OSError:
76
+ return ""
77
+
78
+
79
+ def stamp_package_version(binary_path: str) -> None:
80
+ """Record the package this CLI belongs to, so the next upgrade invalidates it."""
81
+ try:
82
+ with open(package_record_path(binary_path), "w", encoding="utf-8") as f:
83
+ f.write(_PACKAGE_VERSION)
84
+ except OSError:
85
+ # A cache that cannot be stamped just re-checks the CDN next time, which
86
+ # is the safe direction to fail in.
87
+ pass
88
+
89
+
90
+ def _is_exec(path: str) -> bool:
91
+ return bool(path) and os.path.isfile(path) and os.access(path, os.X_OK)
92
+
93
+
94
+ def refresh_requested() -> bool:
95
+ """ZRT_CLI_REFRESH: fetch the CLI again, whatever the cache says."""
96
+ return os.environ.get("ZRT_CLI_REFRESH", "").lower() in ("1", "true", "yes")
97
+
98
+
99
+ def _is_stale(binary_path: str, version: str) -> bool:
100
+ if refresh_requested():
101
+ return True
102
+
103
+ # A CLI cached for a different `zrt` release. The two ship as one product,
104
+ # so installing the package is exactly the moment its CLI has to be
105
+ # re-checked -- otherwise an upgrade keeps running the previous binary until
106
+ # the 24h TTL happens to expire, and a pinned version never re-checks at all.
107
+ #
108
+ # This is the whole reason the cache is keyed on the package rather than on
109
+ # time: a wheel install runs no code of ours, so there is no post-install
110
+ # hook to clear it from. The first `zrt` command after the upgrade is the
111
+ # earliest we can notice, and this is what makes it notice.
112
+ if cached_package_version(binary_path) != _PACKAGE_VERSION:
113
+ return True
114
+
115
+ if version != "latest":
116
+ return False
117
+ try:
118
+ age = time.time() - os.path.getmtime(checksum_record_path(binary_path))
119
+ except OSError:
120
+ return True
121
+ return age > _LATEST_TTL_S
122
+
123
+
124
+ def _local_build_fallback() -> Optional[str]:
125
+ name = cli_binary_name()
126
+ rel_targets = (
127
+ os.path.join("zrt-cli", "target"),
128
+ os.path.join("zrt", "target"),
129
+ "target",
130
+ )
131
+ cur = os.path.abspath(os.getcwd())
132
+ while True:
133
+ for rel in rel_targets:
134
+ for profile in ("release", "debug"):
135
+ cand = os.path.join(cur, rel, profile, name)
136
+ if _is_exec(cand):
137
+ return cand
138
+ parent = os.path.dirname(cur)
139
+ if parent == cur:
140
+ return None
141
+ cur = parent
142
+
143
+
144
+ def resolve_cli_binary(version: Optional[str] = None) -> str:
145
+ version = version or cli_version()
146
+
147
+ override = os.environ.get("ZRT_CLI_BIN", "").strip()
148
+ if override:
149
+ if _is_exec(override):
150
+ return override
151
+ raise RuntimeError(
152
+ f"ZRT_CLI_BIN points at {override!r}, which is not an executable file."
153
+ )
154
+
155
+ local_build = _local_build_fallback()
156
+ if local_build:
157
+ return local_build
158
+
159
+ installed = cli_install_path(version)
160
+ if _is_exec(installed) and not _is_stale(installed, version):
161
+ return installed
162
+
163
+ from ._cli_download import download_cli
164
+
165
+ try:
166
+ download_cli(version, installed)
167
+ except Exception:
168
+ if _is_exec(installed) and not refresh_requested():
169
+ return installed
170
+ raise
171
+
172
+ if _is_exec(installed):
173
+ return installed
174
+ raise RuntimeError(
175
+ f"Could not resolve the ZRT CLI ({version}). Set ZRT_CLI_BIN to a built "
176
+ f"binary, or ensure network access to the CLI download CDN."
177
+ )
178
+
179
+
180
+ def main() -> None:
181
+ """Entry point for the ``zrt`` command: resolve the CLI (downloading it on
182
+ first use) and run it, forwarding all arguments and the exit code."""
183
+ try:
184
+ binary = resolve_cli_binary()
185
+ except Exception as e:
186
+ print(f"zrt: {e}", file=sys.stderr)
187
+ raise SystemExit(1)
188
+ args = [binary, *sys.argv[1:]]
189
+ if os.name == "nt":
190
+ import subprocess
191
+
192
+ raise SystemExit(subprocess.run(args).returncode)
193
+ os.execv(binary, args)