fusion-runtime 0.1.1__tar.gz

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 (120) hide show
  1. fusion_runtime-0.1.1/LICENSE +201 -0
  2. fusion_runtime-0.1.1/NOTICE +13 -0
  3. fusion_runtime-0.1.1/PKG-INFO +357 -0
  4. fusion_runtime-0.1.1/README.md +303 -0
  5. fusion_runtime-0.1.1/fusion_runtime/__init__.py +66 -0
  6. fusion_runtime-0.1.1/fusion_runtime/agent.py +356 -0
  7. fusion_runtime-0.1.1/fusion_runtime/audio/__init__.py +1 -0
  8. fusion_runtime-0.1.1/fusion_runtime/audio/duplex_audio.py +304 -0
  9. fusion_runtime-0.1.1/fusion_runtime/audio/echo_canceller.py +482 -0
  10. fusion_runtime-0.1.1/fusion_runtime/catalog/__init__.py +21 -0
  11. fusion_runtime-0.1.1/fusion_runtime/catalog/download.py +244 -0
  12. fusion_runtime-0.1.1/fusion_runtime/catalog/entries.py +173 -0
  13. fusion_runtime-0.1.1/fusion_runtime/catalog/gguf.py +129 -0
  14. fusion_runtime-0.1.1/fusion_runtime/catalog/models.toml +91 -0
  15. fusion_runtime-0.1.1/fusion_runtime/cli/__init__.py +11 -0
  16. fusion_runtime-0.1.1/fusion_runtime/cli/__main__.py +4 -0
  17. fusion_runtime-0.1.1/fusion_runtime/cli/_checks.py +388 -0
  18. fusion_runtime-0.1.1/fusion_runtime/cli/_common.py +21 -0
  19. fusion_runtime-0.1.1/fusion_runtime/cli/_talk_client.py +252 -0
  20. fusion_runtime-0.1.1/fusion_runtime/cli/app.py +57 -0
  21. fusion_runtime-0.1.1/fusion_runtime/cli/doctor.py +30 -0
  22. fusion_runtime-0.1.1/fusion_runtime/cli/keys.py +98 -0
  23. fusion_runtime-0.1.1/fusion_runtime/cli/models.py +169 -0
  24. fusion_runtime-0.1.1/fusion_runtime/cli/talk.py +89 -0
  25. fusion_runtime-0.1.1/fusion_runtime/cli/up.py +249 -0
  26. fusion_runtime-0.1.1/fusion_runtime/cli/version.py +13 -0
  27. fusion_runtime-0.1.1/fusion_runtime/config.py +350 -0
  28. fusion_runtime-0.1.1/fusion_runtime/contract/__init__.py +37 -0
  29. fusion_runtime-0.1.1/fusion_runtime/contract/common.py +244 -0
  30. fusion_runtime-0.1.1/fusion_runtime/contract/llm.py +68 -0
  31. fusion_runtime-0.1.1/fusion_runtime/contract/stt.py +43 -0
  32. fusion_runtime-0.1.1/fusion_runtime/contract/tts.py +33 -0
  33. fusion_runtime-0.1.1/fusion_runtime/contract/turn.py +59 -0
  34. fusion_runtime-0.1.1/fusion_runtime/engine/__init__.py +3 -0
  35. fusion_runtime-0.1.1/fusion_runtime/engine/barge_in.py +65 -0
  36. fusion_runtime-0.1.1/fusion_runtime/engine/conversation.py +125 -0
  37. fusion_runtime-0.1.1/fusion_runtime/engine/orchestrator.py +1445 -0
  38. fusion_runtime-0.1.1/fusion_runtime/engine/scheduler.py +167 -0
  39. fusion_runtime-0.1.1/fusion_runtime/engine/streaming.py +156 -0
  40. fusion_runtime-0.1.1/fusion_runtime/engine/text.py +90 -0
  41. fusion_runtime-0.1.1/fusion_runtime/env.py +47 -0
  42. fusion_runtime-0.1.1/fusion_runtime/registry.py +122 -0
  43. fusion_runtime-0.1.1/fusion_runtime/resolver.py +456 -0
  44. fusion_runtime-0.1.1/fusion_runtime/runtimes/__init__.py +11 -0
  45. fusion_runtime-0.1.1/fusion_runtime/runtimes/ctranslate2/__init__.py +1 -0
  46. fusion_runtime-0.1.1/fusion_runtime/runtimes/ctranslate2/stt.py +194 -0
  47. fusion_runtime-0.1.1/fusion_runtime/runtimes/llama_cpp/__init__.py +1 -0
  48. fusion_runtime-0.1.1/fusion_runtime/runtimes/llama_cpp/llm.py +252 -0
  49. fusion_runtime-0.1.1/fusion_runtime/runtimes/onnx/__init__.py +1 -0
  50. fusion_runtime-0.1.1/fusion_runtime/runtimes/onnx/kokoro.py +93 -0
  51. fusion_runtime-0.1.1/fusion_runtime/runtimes/onnx/tts.py +104 -0
  52. fusion_runtime-0.1.1/fusion_runtime/runtimes/openai_http/__init__.py +1 -0
  53. fusion_runtime-0.1.1/fusion_runtime/runtimes/openai_http/llm.py +321 -0
  54. fusion_runtime-0.1.1/fusion_runtime/security/__init__.py +32 -0
  55. fusion_runtime-0.1.1/fusion_runtime/security/auth.py +177 -0
  56. fusion_runtime-0.1.1/fusion_runtime/security/keys.py +164 -0
  57. fusion_runtime-0.1.1/fusion_runtime/security/limits.py +179 -0
  58. fusion_runtime-0.1.1/fusion_runtime/security/origins.py +61 -0
  59. fusion_runtime-0.1.1/fusion_runtime/security/tokens.py +81 -0
  60. fusion_runtime-0.1.1/fusion_runtime/server.py +749 -0
  61. fusion_runtime-0.1.1/fusion_runtime/telemetry/__init__.py +20 -0
  62. fusion_runtime-0.1.1/fusion_runtime/telemetry/errors.py +74 -0
  63. fusion_runtime-0.1.1/fusion_runtime/telemetry/events.py +57 -0
  64. fusion_runtime-0.1.1/fusion_runtime/telemetry/hub.py +184 -0
  65. fusion_runtime-0.1.1/fusion_runtime/telemetry/loop_monitor.py +66 -0
  66. fusion_runtime-0.1.1/fusion_runtime/telemetry/metrics.py +179 -0
  67. fusion_runtime-0.1.1/fusion_runtime/telemetry/redact.py +21 -0
  68. fusion_runtime-0.1.1/fusion_runtime/telemetry/sinks.py +142 -0
  69. fusion_runtime-0.1.1/fusion_runtime/telemetry/trace.py +250 -0
  70. fusion_runtime-0.1.1/fusion_runtime/testing/__init__.py +1 -0
  71. fusion_runtime-0.1.1/fusion_runtime/testing/conformance.py +387 -0
  72. fusion_runtime-0.1.1/fusion_runtime/testing/fakes.py +218 -0
  73. fusion_runtime-0.1.1/fusion_runtime/tools.py +319 -0
  74. fusion_runtime-0.1.1/fusion_runtime/turns/__init__.py +22 -0
  75. fusion_runtime-0.1.1/fusion_runtime/turns/silence.py +34 -0
  76. fusion_runtime-0.1.1/fusion_runtime/vad/__init__.py +11 -0
  77. fusion_runtime-0.1.1/fusion_runtime/vad/base.py +19 -0
  78. fusion_runtime-0.1.1/fusion_runtime/vad/silero.py +24 -0
  79. fusion_runtime-0.1.1/fusion_runtime/vad/turn.py +27 -0
  80. fusion_runtime-0.1.1/fusion_runtime/web/__init__.py +41 -0
  81. fusion_runtime-0.1.1/fusion_runtime/web/fusion-runtime.js +425 -0
  82. fusion_runtime-0.1.1/fusion_runtime/web/index.html +210 -0
  83. fusion_runtime-0.1.1/fusion_runtime.egg-info/PKG-INFO +357 -0
  84. fusion_runtime-0.1.1/fusion_runtime.egg-info/SOURCES.txt +118 -0
  85. fusion_runtime-0.1.1/fusion_runtime.egg-info/dependency_links.txt +1 -0
  86. fusion_runtime-0.1.1/fusion_runtime.egg-info/entry_points.txt +3 -0
  87. fusion_runtime-0.1.1/fusion_runtime.egg-info/requires.txt +43 -0
  88. fusion_runtime-0.1.1/fusion_runtime.egg-info/top_level.txt +1 -0
  89. fusion_runtime-0.1.1/pyproject.toml +152 -0
  90. fusion_runtime-0.1.1/setup.cfg +4 -0
  91. fusion_runtime-0.1.1/tests/test_agent.py +262 -0
  92. fusion_runtime-0.1.1/tests/test_barge_in.py +152 -0
  93. fusion_runtime-0.1.1/tests/test_catalog.py +207 -0
  94. fusion_runtime-0.1.1/tests/test_cli.py +569 -0
  95. fusion_runtime-0.1.1/tests/test_client_barge_in.py +89 -0
  96. fusion_runtime-0.1.1/tests/test_conformance.py +171 -0
  97. fusion_runtime-0.1.1/tests/test_contract.py +117 -0
  98. fusion_runtime-0.1.1/tests/test_conversation.py +147 -0
  99. fusion_runtime-0.1.1/tests/test_core.py +138 -0
  100. fusion_runtime-0.1.1/tests/test_doctor.py +149 -0
  101. fusion_runtime-0.1.1/tests/test_duplex_audio.py +171 -0
  102. fusion_runtime-0.1.1/tests/test_echo_canceller.py +208 -0
  103. fusion_runtime-0.1.1/tests/test_engine_streaming.py +77 -0
  104. fusion_runtime-0.1.1/tests/test_env_file.py +91 -0
  105. fusion_runtime-0.1.1/tests/test_event_loop_blocking.py +128 -0
  106. fusion_runtime-0.1.1/tests/test_http_llm.py +284 -0
  107. fusion_runtime-0.1.1/tests/test_languages.py +134 -0
  108. fusion_runtime-0.1.1/tests/test_llama_cpp_stream.py +179 -0
  109. fusion_runtime-0.1.1/tests/test_model_paths.py +53 -0
  110. fusion_runtime-0.1.1/tests/test_registry.py +91 -0
  111. fusion_runtime-0.1.1/tests/test_resolver.py +408 -0
  112. fusion_runtime-0.1.1/tests/test_runtimes.py +197 -0
  113. fusion_runtime-0.1.1/tests/test_scheduler.py +179 -0
  114. fusion_runtime-0.1.1/tests/test_security.py +562 -0
  115. fusion_runtime-0.1.1/tests/test_self_echo.py +182 -0
  116. fusion_runtime-0.1.1/tests/test_server_telemetry.py +168 -0
  117. fusion_runtime-0.1.1/tests/test_telemetry.py +369 -0
  118. fusion_runtime-0.1.1/tests/test_tools.py +432 -0
  119. fusion_runtime-0.1.1/tests/test_turn_taking.py +426 -0
  120. fusion_runtime-0.1.1/tests/test_web.py +112 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,13 @@
1
+ fusion-runtime
2
+ Copyright 2026 Samarth Urs
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
+ this software except in compliance with the License. A copy is in the LICENSE
6
+ file beside this one, and at http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ This product bundles no third-party source code. It downloads models at run time
9
+ and installs libraries from PyPI; those carry their own licences, which the
10
+ `frun models list` output and the dependency metadata state. The models used by
11
+ default are permissively licensed (Whisper MIT, Silero VAD MIT, Qwen2.5
12
+ Apache-2.0, Kokoro Apache-2.0), but a model you point it at yourself may not be —
13
+ check before you ship one.
@@ -0,0 +1,357 @@
1
+ Metadata-Version: 2.4
2
+ Name: fusion-runtime
3
+ Version: 0.1.1
4
+ Summary: Self-hosted voice agent runtime: speech-to-text, LLM and text-to-speech on your own GPU, with tools
5
+ Author-email: Samarth Urs <hello@fusion-runtime.dev>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://fusion-runtime.dev
8
+ Project-URL: Documentation, https://fusion-runtime.dev/docs
9
+ Project-URL: Repository, https://github.com/SamarthUrs18/fusion-runtime
10
+ Project-URL: Issues, https://github.com/SamarthUrs18/fusion-runtime/issues
11
+ Requires-Python: <3.14,>=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Requires-Dist: fastapi>=0.110.0
16
+ Requires-Dist: uvicorn[standard]>=0.29.0
17
+ Requires-Dist: pydantic>=2.7.0
18
+ Requires-Dist: pydantic-settings>=2.3.0
19
+ Requires-Dist: numpy>=1.26.0
20
+ Requires-Dist: scipy>=1.13.0
21
+ Requires-Dist: soundfile>=0.12.1
22
+ Requires-Dist: websockets>=12.0
23
+ Requires-Dist: python-multipart>=0.0.9
24
+ Requires-Dist: httpx>=0.27.0
25
+ Requires-Dist: python-dotenv>=1.0
26
+ Requires-Dist: faster-whisper>=1.1.0
27
+ Requires-Dist: llama-cpp-python>=0.2.80
28
+ Requires-Dist: onnxruntime>=1.18.0
29
+ Requires-Dist: kokoro-onnx<0.7,>=0.6.1
30
+ Requires-Dist: torch==2.9.1
31
+ Requires-Dist: torchaudio==2.9.1
32
+ Requires-Dist: huggingface-hub>=0.23.0
33
+ Requires-Dist: typer>=0.12
34
+ Requires-Dist: prometheus-client>=0.20
35
+ Requires-Dist: psutil>=5.9
36
+ Provides-Extra: cuda
37
+ Requires-Dist: onnxruntime-gpu<1.30,>=1.18.0; extra == "cuda"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
40
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
41
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
42
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.10.0; extra == "dev"
44
+ Requires-Dist: pre-commit>=3.6.0; extra == "dev"
45
+ Provides-Extra: talk
46
+ Requires-Dist: sounddevice>=0.4.6; extra == "talk"
47
+ Provides-Extra: examples
48
+ Requires-Dist: fusion-runtime[talk]; extra == "examples"
49
+ Provides-Extra: all
50
+ Requires-Dist: fusion-runtime[cuda]; extra == "all"
51
+ Requires-Dist: fusion-runtime[dev]; extra == "all"
52
+ Requires-Dist: fusion-runtime[talk]; extra == "all"
53
+ Dynamic: license-file
54
+
55
+ <p align="center">
56
+ <picture>
57
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/SamarthUrs18/fusion-runtime/main/docs/brand/logo-dark.png">
58
+ <img alt="fusion-runtime" src="https://raw.githubusercontent.com/SamarthUrs18/fusion-runtime/main/docs/brand/logo-light.png" width="340">
59
+ </picture>
60
+ </p>
61
+
62
+ <p align="center">
63
+ <a href="https://github.com/SamarthUrs18/fusion-runtime"><img alt="GitHub stars" src="https://img.shields.io/github/stars/SamarthUrs18/fusion-runtime?style=social&cacheSeconds=3600"></a>
64
+ <a href="https://pypi.org/project/fusion-runtime/"><img alt="PyPI" src="https://img.shields.io/pypi/v/fusion-runtime?cacheSeconds=3600"></a>
65
+ <a href="https://fusion-runtime.dev/docs"><img alt="Docs" src="https://img.shields.io/badge/docs-fusion--runtime.dev-d9612f"></a>
66
+ <img alt="Python 3.11 to 3.13" src="https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue">
67
+ </p>
68
+
69
+ **A self-hosted voice agent runtime.** Speech-to-text, the LLM and text-to-speech run together on
70
+ one machine and stream into each other, so a reply starts playing while it's still being generated.
71
+
72
+ **On an RTX 3090 with a 7B model: about 490 ms of processing once a turn ends**, or 991 ms
73
+ stopwatched from your last syllable — the difference is a silence wait you can configure. 127
74
+ tokens/sec, interruptions honoured mid-sentence.
75
+
76
+ ## Quickstart
77
+
78
+ Requires Python 3.11–3.13.
79
+
80
+ ```bash
81
+ pip install fusion-runtime
82
+ ```
83
+
84
+ An agent is one file. This is the whole thing:
85
+
86
+ ```python
87
+ # agent.py
88
+ from fusion_runtime import Agent, LLM, STT, TTS, Turns
89
+
90
+ agent = Agent(
91
+ name="shopkart-orders",
92
+ prompt="You are the order line for ShopKart. Keep answers to one short sentence.",
93
+ stt=STT("whisper-tiny.en"), # or "whisper-small" for better accuracy
94
+ llm=LLM("qwen2.5-0.5b-q4", max_tokens=256),
95
+ tts=TTS("kokoro-v1.0", voice="af_heart"),
96
+ turns=Turns(wait_ms=500, interrupt_after_ms=300),
97
+ )
98
+ ```
99
+
100
+ ```bash
101
+ frun models pull agent.py # exactly the models it names, nothing else
102
+ frun up agent.py # add --reload to restart on every edit
103
+ ```
104
+
105
+ Then talk to it from a second terminal:
106
+
107
+ ```bash
108
+ pip install "fusion-runtime[talk]"
109
+ frun talk
110
+ ```
111
+
112
+ That is the whole loop — one file, two commands, a conversation. Talk over the agent to
113
+ interrupt it.
114
+
115
+ `frun up` with no file runs a default agent if you just want to hear it work, and `frun doctor`
116
+ checks libraries, GPU, models and audio and says how to fix what it finds.
117
+
118
+ ### In a browser instead
119
+
120
+ The runtime serves a browser client at **http://localhost:8000** — the same one you would embed
121
+ in your own page.
122
+
123
+ With no keys configured, open it and click Talk. With keys configured (`FUSION_ACCEPTED_KEYS`),
124
+ a page can't hold a secret, so it needs a short-lived session token:
125
+
126
+ ```bash
127
+ frun token # prints a URL with a token in it — open that
128
+ ```
129
+
130
+ Tokens are single-use and expire in about a minute. The page is handed its next one over the
131
+ socket it already has, so a conversation keeps going without asking again. If you open the bare
132
+ URL on a server with keys, the connection closes and the page says the token wasn't accepted.
133
+
134
+ ### Naming models
135
+
136
+ A model is a catalog id (`frun models list`), a file path, `hf:owner/repo` for anything on
137
+ Hugging Face, or a URL for an OpenAI-compatible endpoint. A model on a vLLM, SGLang or
138
+ llama-server you started is named with that server in front — `vllm:hf:Qwen/Qwen2.5-7B-Instruct-AWQ`
139
+ — and found at the server's usual address (`url=` for another).
140
+
141
+ Settings are checked against the runtime that runs the model, so a misspelt one fails at startup
142
+ with the name it probably meant instead of being ignored. For llama.cpp that includes
143
+ `flash_attn`, `kv_cache_type="q8_0"` (half the context memory), `use_mlock`, `main_gpu` and
144
+ `llama_kwargs` for anything else; for an endpoint, `extra_body` for server-specific sampling.
145
+
146
+ Secrets never go in the agent file — it names the *variable* holding a key
147
+ (`api_key_env="GROQ_API_KEY"`), so `agent.py` is safe to commit.
148
+
149
+ ### Tools
150
+
151
+ A tool is a function. The model reads its name, docstring and type hints, calls it when it needs
152
+ to, and answers with what it returned:
153
+
154
+ ```python
155
+ from fusion_runtime import Agent, LLM, tool
156
+
157
+ @tool
158
+ async def order_status(order_id: str) -> dict:
159
+ """Look up where an order is and when it will arrive.
160
+
161
+ Args:
162
+ order_id: The order number, as the caller reads it out.
163
+ """
164
+ return await orders.lookup(order_id)
165
+
166
+ agent = Agent(prompt="...", llm=LLM("vllm:hf:Qwen/Qwen2.5-7B-Instruct-AWQ"), tools=[order_status])
167
+ ```
168
+
169
+ What the model says before calling ("Let me check.") is spoken while the tool runs. Each call has
170
+ a timeout (`@tool(timeout_s=...)`, 10 s by default); ordinary functions run on a worker thread;
171
+ a tool that fails tells the model what went wrong rather than ending the call; and talking over
172
+ the wait cancels it. After `max_tool_rounds` calls in one turn (4) the model has to answer.
173
+
174
+ Tools need an LLM server that can call them — vLLM (`--enable-auto-tool-choice
175
+ --tool-call-parser ...`), SGLang, llama-server (`--jinja`) or a hosted API. The in-process
176
+ llama.cpp runtime can't, and `frun up` says so at startup. A runnable version is
177
+ [`examples/tools_agent.py`](examples/tools_agent.py).
178
+
179
+ ## On your own site
180
+
181
+ ```html
182
+ <script src="https://your-server/fusion-runtime.js"></script>
183
+ <button id="talk"></button>
184
+ <script>FusionRuntime.attach({ button: "#talk" });</script>
185
+ ```
186
+
187
+ The runtime serves the browser client it uses itself, so the page you demo with is the one your
188
+ site embeds. With no `url` it connects back to wherever the script came from.
189
+
190
+ Browsers only allow a microphone on `https://`, so a deployment needs TLS and `wss://`. A page
191
+ never holds an API key: your backend mints it a short-lived token.
192
+
193
+ ## Authentication
194
+
195
+ ```bash
196
+ frun key new
197
+ FUSION_ACCEPTED_KEYS=web:frun_kR7m...
198
+ ```
199
+
200
+ Without keys the server answers on `localhost` only, and `frun up --host 0.0.0.0` refuses to
201
+ start. `frun talk`, a backend or curl send the key in an `Authorization` header; a browser page
202
+ gets a short-lived, single-use token from `POST /v1/sessions` instead, because a page can hold
203
+ neither a secret nor a header.
204
+
205
+ Concurrency caps, message and audio limits, idle timeouts, origin allowlists and proxy trust all
206
+ have working defaults — see the docs.
207
+
208
+ ## Performance
209
+
210
+ Measured, not estimated. The production profile as it ships — RTX 3090, Qwen 7B q4 + Whisper
211
+ small + Kokoro on the one card — through the browser client, 21 September 2026:
212
+
213
+ | | Median | Range |
214
+ |---|---|---|
215
+ | **Processing** — turn ends, audio comes back | **~490 ms** | 288–657 |
216
+ | **Stopwatch from your last syllable** | **991 ms** | 858–1061 |
217
+ | ↳ of which: silence wait before the turn is judged over | ~500 ms | `turns.wait_ms` |
218
+ | Speech-to-text | 119 ms | 58–329 |
219
+ | LLM first token | 27 ms | 20–70 |
220
+ | First token → first audio (a sentence gets written, then spoken) | 430 ms | 320–509 |
221
+ | Text-to-speech real-time factor | 0.09 | speech is synthesized ~11× faster than real time |
222
+ | LLM tokens/sec | 127 | 106–130 |
223
+
224
+ **Two numbers, because there are two honest answers.** A stopwatch started at your last syllable
225
+ reads 991 ms. About 500 ms of that is the runtime waiting through silence to decide you've
226
+ finished — which elapses while you're still finishing, so people don't experience it as waiting.
227
+ What a caller feels is closer to the 490 ms of processing. Quote whichever you like, but say
228
+ which one: a voice stack claiming a number under 500 ms is almost always measuring from "we
229
+ decided the caller stopped", not "the caller stopped".
230
+
231
+ **The stages don't sum, and that's not sleight of hand.** Transcription of what you already said
232
+ runs during the silence wait. And "first token → first audio" is mostly the language model
233
+ writing a sentence — text-to-speech can't start on half a clause — so it is not a measure of how
234
+ fast Kokoro is. Kokoro's own speed is the real-time factor: 0.09, or about 126 ms of compute for
235
+ 1.4 seconds of speech.
236
+
237
+ Every figure is the runtime's own per-turn telemetry (`frun talk --verbose`, or the browser
238
+ console), so you can reproduce them rather than trusting ours. Barge-in fired on every attempt.
239
+
240
+ ## Several callers at once
241
+
242
+ Measured on the same 3090, real WebSocket sessions, three turns each
243
+ ([`scripts/concurrency_check.py`](scripts/concurrency_check.py)). Response is the server's own
244
+ figure: the turn ends, audio comes back.
245
+
246
+ | Callers | In-process llama.cpp | vLLM | SGLang |
247
+ |---|---|---|---|
248
+ | 1 | ~460 ms | 398 ms | 410 ms |
249
+ | 4 | ~740 ms | 698 ms | 848 ms |
250
+ | 8 | ~4600 ms | 1086 ms | 1054 ms |
251
+ | 12 | ~7500 ms | 1083 ms | 1264 ms |
252
+ | 16 | — | 2064 ms | 1598 ms |
253
+
254
+ **With the model in-process, four callers is the ceiling.** At twelve, the language model's first
255
+ token takes 4790 ms of a 5312 ms response, while speech-to-text stays at 76 ms and text-to-speech
256
+ at 469 ms: one llama.cpp context decodes one reply at a time.
257
+
258
+ **With vLLM or SGLang, twelve callers answer in about a second.** Both batch every caller's reply
259
+ into each step on the GPU, and the language model's first token stayed between 36 and 72 ms from
260
+ one caller to sixteen. The limit moves to speech, which still runs one caller at a time: Kokoro's
261
+ first audio grows from ~350 ms alone to 1.5–2 s at sixteen callers, and Whisper grows with how
262
+ long people talk (a 3-second question: ~200 ms alone, 1.6–2.2 s at sixteen). Batching speech is
263
+ the next step, not the language model.
264
+
265
+ **Tools hold up under load.** Every caller asked about the same order on every turn: vLLM looked
266
+ it up in 122 of 123 turns, SGLang in 109. On SGLang every session looked it up the first time;
267
+ the turns without a lookup were the question asked a second, third or fourth time, answered from
268
+ the lookup already in the conversation. That is correct, but if your data can change during a
269
+ call, tell the agent to look things up again.
270
+
271
+ Measured 26 September 2026: Qwen2.5-7B-Instruct-AWQ, `--gpu-memory-utilization 0.6`,
272
+ `--max-model-len 4096`, Whisper small and Kokoro on the same card, both servers with default
273
+ settings otherwise. The in-process column is Qwen 7B q4 GGUF on llama.cpp, 21 September.
274
+
275
+ To run the model on a server and leave speech where it is:
276
+
277
+ ```python
278
+ llm = LLM("vllm:hf:Qwen/Qwen2.5-7B-Instruct-AWQ", url="http://localhost:8002/v1")
279
+ llm = LLM("llama_server:qwen2.5-7b-instruct") # llama-server -np N, on :8080
280
+ llm = LLM("http://gpu-box:8000/v1", model_name="...") # any OpenAI-compatible server
281
+ ```
282
+
283
+ **On one 24 GB card** (RTX 3090, L4) the server shares the GPU with Whisper and Kokoro, and vLLM
284
+ reserves 90% of the card by default. Cap it, and start it first:
285
+
286
+ ```bash
287
+ vllm serve Qwen/Qwen2.5-7B-Instruct-AWQ --port 8002 \
288
+ --gpu-memory-utilization 0.6 --max-model-len 4096 --max-num-seqs 16 \
289
+ --enable-auto-tool-choice --tool-call-parser hermes
290
+ frun up agent.py # an Agent(profile="production", ...), so Whisper runs on the GPU too
291
+ ```
292
+
293
+ SGLang the same way (its usual port is 30000, and `sglang:` finds it there):
294
+
295
+ ```bash
296
+ python -m sglang.launch_server --model-path Qwen/Qwen2.5-7B-Instruct-AWQ --port 30000 \
297
+ --mem-fraction-static 0.6 --context-length 4096 --tool-call-parser qwen25
298
+ ```
299
+
300
+ `0.6` is about 14 GB: the weights plus every caller's context. Voice turns are short, so a 4096
301
+ context fits more callers than the model's maximum would. The tool flags are only needed for
302
+ tools, and the parser depends on the model family. Port 8002, because `frun up` is on 8000 and some hosts (Runpod's pod images) already use 8001.
303
+
304
+ A 4-bit model (AWQ or GPTQ) leaves room for speech; a 16-bit 7B model needs ~15 GB for its
305
+ weights alone and doesn't. The L4 has about a third of the 3090's memory bandwidth, so expect
306
+ slower tokens there. `nvidia-smi` shows what is actually used.
307
+
308
+ ## The `frun` CLI
309
+
310
+ | | |
311
+ |---|---|
312
+ | `frun up [agent.py]` | Starts the server. `--host`, `--port`, `--reload`, `--config` |
313
+ | `frun talk` | Talks to it from a terminal, with a latency summary per turn |
314
+ | `frun models list` / `pull` | What's available, and downloading it |
315
+ | `frun key new` / `keys list` / `token` | Keys and browser tokens |
316
+ | `frun doctor` | Checks the machine and says how to fix what's wrong |
317
+ | `frun version` | The installed version. `--version` and `-V` work too |
318
+
319
+ `fusion-runtime` works as an alias for `frun`.
320
+
321
+ ## Using it as a library
322
+
323
+ `frun up agent.py` covers running an agent. The pipeline can also run inside your own process —
324
+ for a queue worker, a test, or a batch job over recorded calls — with no server involved. See
325
+ [`examples/sdk_example.py`](examples/sdk_example.py), which is runnable, and
326
+ [the docs](https://fusion-runtime.dev/docs#python).
327
+
328
+ ## Documentation and contact
329
+
330
+ Everything else — configuration, turn detection, languages, the server API, telemetry, limits,
331
+ GPU setup and deployment — is at **[fusion-runtime.dev/docs](https://fusion-runtime.dev/docs)**.
332
+
333
+ | | |
334
+ |---|---|
335
+ | Site and docs | **[fusion-runtime.dev](https://fusion-runtime.dev)** |
336
+ | Questions, or anything else | **hello@fusion-runtime.dev** |
337
+ | Security problems | **security@fusion-runtime.dev** — not a public issue, please ([why](CONTRIBUTING.md#security)) |
338
+
339
+ ## Development
340
+
341
+ ```bash
342
+ uv sync --extra dev --extra talk # or: pip install -e ".[dev,talk]"
343
+ pytest
344
+ ```
345
+
346
+ CI runs the suite on Python 3.11, 3.12 and 3.13. [CONTRIBUTING.md](CONTRIBUTING.md) has the
347
+ layout, the design rules a review will hold you to, and how to add a runtime.
348
+
349
+ ## License
350
+
351
+ [Apache-2.0](LICENSE). Embed it in a commercial product, rebrand it, ship it closed — keep the
352
+ copyright notice and the `NOTICE` file in what you distribute, and don't use the project's name
353
+ to imply it endorses you.
354
+
355
+ The models it downloads by default are permissive too (Whisper MIT, Silero VAD MIT, Qwen2.5
356
+ Apache-2.0, Kokoro Apache-2.0), so the whole default path is clear for commercial use. A model
357
+ you point it at yourself carries its own licence — check that one before you ship it.