A self-hosted voice agent runtime. Speech-to-text, the LLM and text-to-speech run together on one machine and stream into each other, so a reply starts playing while it's still being generated.
On an RTX 3090 with a 7B model: about 490 ms of processing once a turn ends, or 991 ms stopwatched from your last syllable — the difference is a silence wait you can configure. 127 tokens/sec, interruptions honoured mid-sentence.
Answers real phone calls. Point your own Twilio number at it (Exotel and Plivo too), and the agent answers on your GPU. Tested on real Twilio calls: the caller asks about an order, the agent looks it up and changes the delivery with tools mid-call, and the caller can cut in. Phone calls →
Sixteen callers on one GPU. On an RTX 4090 with a 7B model on vLLM, one caller hears a reply about 0.6 s after they stop talking, eight about 1.4 s and sixteen about 2.3 s, with every turn answered. Whisper takes several callers in one pass, Kokoro speaks several sentences at once, and speech can come from any OpenAI-compatible server instead. Several callers at once →
Quickstart
Requires Python 3.11–3.13.
pip install fusion-runtime
The first install can sit quiet for a few minutes: where there's no ready-made llama.cpp for your machine, pip builds it. That's normal.
An agent is one file. This is the whole thing:
# agent.py
from fusion_runtime import Agent, LLM, STT, TTS, Turns
agent = Agent(
name="shopkart-orders",
prompt="You are the order line for ShopKart. Keep answers to one short sentence.",
greeting="Hi, this is ShopKart. How can I help with your order?", # said as soon as a caller connects
stt=STT("whisper-tiny.en"), # or "whisper-small" for better accuracy
llm=LLM("qwen2.5-0.5b-q4", max_tokens=256),
tts=TTS("kokoro-v1.0", voice="af_heart"),
turns=Turns(wait_ms=500, interrupt_after_ms=300),
)
frun models pull agent.py # exactly the models it names, nothing else
frun up agent.py # add --reload to restart on every edit
Then talk to it from a second terminal:
pip install "fusion-runtime[talk]"
frun talk
That is the whole loop — one file, two commands, a conversation. Talk over the agent to interrupt it.
frun up with no file runs a default agent if you just want to hear it work, and frun doctor
checks libraries, GPU, models and audio and says how to fix what it finds.
In a browser instead
The runtime serves a browser client at http://localhost:8000 — the same one you would embed in your own page.
With no keys configured, open it and click Talk. With keys configured (FUSION_ACCEPTED_KEYS),
a page can't hold a secret, so it needs a short-lived session token:
frun token # prints a URL with a token in it — open that
Tokens are single-use and expire in about a minute. The page is handed its next one over the socket it already has, so a conversation keeps going without asking again. If you open the bare URL on a server with keys, the connection closes and the page says the token wasn't accepted.
Naming models
A model is a catalog id (frun models list), a file path, hf:owner/repo for anything on
Hugging Face, or a URL for an OpenAI-compatible endpoint — for speech too, not only the LLM:
stt=STT("http://gpu-box:8003/v1", model_name="openai/whisper-large-v3-turbo"), # vLLM serving Whisper
tts=TTS("https://api.openai.com/v1", model_name="gpt-4o-mini-tts", voice="alloy",
api_key_env="OPENAI_API_KEY"), # or a hosted voice
Speech to text goes to /audio/transcriptions, text to speech to /audio/speech (asked for as raw
PCM and played as it arrives). A model on vLLM, SGLang or
llama-server is named with that server in front — vllm:hf:Qwen/Qwen2.5-7B-Instruct-AWQ — and
found at the server's usual address (url= for another). frun up starts vLLM and SGLang itself.
Settings are checked against the runtime that runs the model, so a misspelt one fails at startup
with the name it probably meant instead of being ignored. For llama.cpp that includes
flash_attn, kv_cache_type="q8_0" (half the context memory), use_mlock, main_gpu and
llama_kwargs for anything else; for an endpoint, extra_body for server-specific sampling.
Secrets never go in the agent file — it names the variable holding a key
(api_key_env="GROQ_API_KEY"), so agent.py is safe to commit.
Tools
A tool is a function. The model reads its name, docstring and type hints, calls it when it needs to, and answers with what it returned:
from fusion_runtime import Agent, LLM, tool
@tool
async def order_status(order_id: str) -> dict:
"""Look up where an order is and when it will arrive.
Args:
order_id: The order number, as the caller reads it out.
"""
return await orders.lookup(order_id)
agent = Agent(prompt="...", llm=LLM("vllm:hf:Qwen/Qwen2.5-7B-Instruct-AWQ"), tools=[order_status])
What the model says before calling ("Let me check.") is spoken while the tool runs. Each call has
a timeout (@tool(timeout_s=...), 10 s by default); ordinary functions run on a worker thread;
a tool that fails tells the model what went wrong rather than ending the call; and talking over
the wait cancels it. After max_tool_rounds calls in one turn (4) the model has to answer.
Tools need an LLM server that can call them — vLLM or SGLang (frun up starts them with tool
calling on), llama-server (--jinja) or a hosted API. The in-process
llama.cpp runtime can't, and frun up says so at startup. A runnable version is
examples/tools_agent.py.
Answering from your own documents
Retrieval is a tool like any other: a function that takes the caller's question and returns a few short passages, which the model answers from.
@tool(timeout_s=3)
def search_help(question: str) -> dict:
"""Search the shop's help articles: returns, refunds, delivery, cancelling orders.
Args:
question: What the caller wants to know, in their words.
"""
return {"passages": my_search(question, limit=3)}
my_search is yours: a vector database, Elasticsearch, your help centre's API.
examples/knowledge_agent.py is a runnable version with a small
keyword search over the Markdown files in examples/knowledge/, in plain
Python with nothing to install.
On a call, two things matter more than in a chat window. A lookup costs a second model round before the caller hears anything, so if your knowledge fits in a page or two, put it in the prompt instead: that's faster than any search. And passages go into the prompt, so keep them short (a few sentences each, a few per search): long ones slow the model's first word.
On your own site
<script src="https://your-server/fusion-runtime.js"></script>
<button id="talk"></button>
<script>FusionRuntime.attach({ button: "#talk" });</script>
The runtime serves the browser client it uses itself, so the page you demo with is the one your
site embeds. With no url it connects back to wherever the script came from.
Browsers only allow a microphone on https://, so a deployment needs TLS and wss://. A page
never holds an API key: your backend mints it a short-lived token.
Phone calls
Tested on real Twilio calls to a US number, from a mobile in India and from a second Twilio number: the agent looked orders up and changed deliveries with tools mid-call, and the caller talked over it and it stopped. On an RTX 4090 (19 November 2026) the agent started answering 400–630 ms after the caller stopped, every cut-in stopped it, and the short words people cut in with ("No, it's 1043", "OK", "Wait") reached the transcript whole. Exotel and Plivo are built from the providers' documentation and tested with the simulator, not yet on real numbers; if your account behaves differently, open an issue.
Keep your own number and your provider account (and its KYC); the provider streams each call to fusion, and the agent answers it. Twilio, Exotel and Plivo:
| Provider | Point the number at | Set where fusion runs |
|---|---|---|
| Twilio | voice webhook "A call comes in": https://<server>/v1/phone/twilio (POST) |
FUSION_TWILIO_AUTH_TOKEN: the account's auth token |
| Exotel | a Voicebot applet in the call flow: wss://fusion:<key>@<server>/v1/phone/exotel/stream?sample-rate=16000 |
FUSION_ACCEPTED_KEYS, with the key in that URL |
| Plivo | the number's answer URL: https://<server>/v1/phone/plivo (POST) |
FUSION_PLIVO_AUTH_TOKEN: the account's auth token |
Each request is checked before a call is taken: Twilio's webhook signature, the key in Exotel's
URL, Plivo's signature on the stream. Behind a proxy, set FUSION_PUBLIC_URL to the address the
provider calls (on a Runpod pod frun up sets it), since that's the address they sign.
A call gets everything a browser conversation does: the same limits, interruption (the provider
drops the agent's unplayed audio the moment the caller talks over it), tools and logs, with
transport=twilio and the call's id on session.start. On top of that:
- The greeting is made when the server starts, so a caller hears it within ~50 ms.
- A full server answers "all our lines are busy" rather than dropping the call.
- A dead line is faint hiss, not silence: nothing from the caller above
FUSION_PHONE_FLOOR_RMS(40) forFUSION_DEAD_LINE_S(10 s) is logged as a quiet line, and every call'ssession.endrecords its loudest moment and whether the caller was heard at all.
Try it without a number or an account: tools/phone_sim plays the
provider's side from your machine, with your microphone, at phone quality.
On Twilio, test by calling a number of your own. The console's test call on a trial account comes from a shared sandbox number that neither signed its requests nor streamed the call's audio to fusion in our tests, and a newly upgraded account may hold calls until Twilio's KYC (a Trust Hub customer profile) is approved. A refused webhook is logged with the address fusion checked, which tells a wrong address from a wrong token.
Calls that cross a border can lose audio on the way, before it reaches fusion: in our tests calls between India and a US number dropped parts of words, and calls Twilio placed to India reported "answered" while the phone was still ringing, then stayed silent. Test with a caller in the number's own country, or call it from a second number with Twilio's Dev Phone.
Phone audio is narrower than a microphone's, and Whisper small mishears more on it: "order 1042"
came through as "RDEF 1042" for one caller. For callers, a larger model and a longer pause help,
for about half a second more before each reply: stt=STT("hf:deepdml/faster-whisper-large-v3-turbo-ct2")
(frun models pull it first) and turns=Turns(wait_ms=800), so a caller who pauses mid-sentence
isn't answered halfway. On a GPU with several callers, the same large model served by vLLM is
faster still: see Several callers at once.
A caller's first sound is soft, and the voice detector is only sure a frame or two into a word, so
the 256 ms before speech is sent along with it: a quick "No" or "Wait" said over the agent isn't
clipped to "o" or "ait". vad=VAD(pre_roll_ms=...) changes it.
Authentication
frun key new
FUSION_ACCEPTED_KEYS=web:frun_kR7m...
Without keys the server answers on localhost only, and frun up --host 0.0.0.0 refuses to
start. frun talk, a backend or curl send the key in an Authorization header; a browser page
gets a short-lived, single-use token from POST /v1/sessions instead, because a page can hold
neither a secret nor a header.
Concurrency caps, message and audio limits, idle timeouts, origin allowlists and proxy trust all have working defaults — see the docs.
Performance
Measured, not estimated. The production profile as it ships — RTX 3090, Qwen 7B q4 + Whisper small + Kokoro on the one card — through the browser client, 21 September 2026:
| Median | Range | |
|---|---|---|
| Processing — turn ends, audio comes back | ~490 ms | 288–657 |
| Stopwatch from your last syllable | 991 ms | 858–1061 |
| ↳ of which: silence wait before the turn is judged over | ~500 ms | turns.wait_ms |
| Speech-to-text | 119 ms | 58–329 |
| LLM first token | 27 ms | 20–70 |
| First token → first audio (a sentence gets written, then spoken) | 430 ms | 320–509 |
| Text-to-speech real-time factor | 0.09 | speech is synthesized ~11× faster than real time |
| LLM tokens/sec | 127 | 106–130 |
Two numbers, because there are two honest answers. A stopwatch started at your last syllable reads 991 ms. About 500 ms of that is the runtime waiting through silence to decide you've finished — which elapses while you're still finishing, so people don't experience it as waiting. What a caller feels is closer to the 490 ms of processing. Quote whichever you like, but say which one: a voice stack claiming a number under 500 ms is almost always measuring from "we decided the caller stopped", not "the caller stopped".
The stages don't sum, and that's not sleight of hand. Transcription of what you already said runs during the silence wait. And "first token → first audio" is mostly the language model writing a sentence — text-to-speech can't start on half a clause — so it is not a measure of how fast Kokoro is. Kokoro's own speed is the real-time factor: 0.09, or about 126 ms of compute for 1.4 seconds of speech.
Every figure is the runtime's own per-turn telemetry (frun talk --verbose, or the browser
console), so you can reproduce them rather than trusting ours. Barge-in fired on every attempt.
Several callers at once
Measured with frun bench on an RTX 4090: real WebSocket sessions, each streaming a recorded
question about an order in real time, three turns each. The time is how long a caller waits from
the end of their question to the first audio of the answer, including the pause that decides
they've finished. Median and worst turn of each round, the middle of three runs; 19 November 2026.
"Before" is speech as it ran in 0.1.4: Whisper one caller at a time, Kokoro one sentence at a time.
| Callers | Before: median | Before: worst | 0.1.5: median | 0.1.5: worst |
|---|---|---|---|---|
| 1 | 724 ms | 876 ms | 596 ms | 760 ms |
| 4 | 1472 ms | 2278 ms | 1014 ms | 1246 ms |
| 8 | 1938 ms | 3362 ms | 1414 ms | 2112 ms |
| 12 | 1692 ms | 4094 ms | 1868 ms | 2722 ms |
| 16 | 3068 ms | 7152 ms | 2264 ms | 3277 ms |
The worst turn is where it shows: at sixteen callers it went from 6.6–8.5 s to 3.1–3.7 s. The medians move less and are noisier (at twelve, "before" ranged 1.3–1.9 s over its three runs). Nothing failed in either. The "before" rows for 1 and 4 callers are a single run. Qwen2.5-7B-Instruct-AWQ on vLLM, Whisper small and Kokoro, all on the one card: the tools agent with its defaults.
What changed in 0.1.5:
- Whisper takes callers together. Questions that arrive while it's busy go through in one pass,
up to 8 on a GPU (
STT(..., max_batch=N)). A caller who finds it free goes at once, alone, so one caller is never slower for it. At sixteen callers, speech to text held at about 1 s instead of 1.5–3 s. - Kokoro speaks four sentences at once on a GPU (
TTS(..., max_concurrency=N)). With Whisper faster, callers had just queued for the voice instead. - The server stopped freezing under load. Compressing every frame of reply audio, and setting
up many calls at once, held up everyone's audio and interruptions for 100–400 ms at a time.
Both are fixed, and a stall now names the code that caused it in the log (
event_loop.stall where=...).
Speech from a server of its own. vLLM can serve Whisper too, and fusion talks to it like any OpenAI-compatible endpoint. The same large model, Whisper large-v3-turbo, at sixteen callers:
| Whisper large-v3-turbo | 1 caller | 8 callers | 16 callers |
|---|---|---|---|
On vLLM, STT("http://localhost:8003/v1", model_name=...) |
573 ms | 1405 ms | 1850 ms |
In fusion, STT("hf:deepdml/faster-whisper-large-v3-turbo-ct2") |
745 ms | 1620 ms | 3174 ms |
So on a GPU with many callers, the more accurate model costs nothing if vLLM serves it. You start that server yourself for now:
~/vllm-env/bin/pip install "vllm[audio]"
~/vllm-env/bin/vllm serve openai/whisper-large-v3-turbo --port 8003 --gpu-memory-utilization 0.12
The language model was never the limit on vLLM or SGLang. Its first token stayed under ~260 ms from one caller to sixteen. With the model in-process on llama.cpp, four callers is the ceiling: one context decodes one reply at a time (on a 3090, twelve callers waited 4.8 s for a first token). Earlier measurements, on an RTX 3090 in September:
| Callers | In-process llama.cpp | vLLM | SGLang |
|---|---|---|---|
| 1 | ~460 ms | 398 ms | 410 ms |
| 4 | ~740 ms | 698 ms | 848 ms |
| 8 | ~4600 ms | 1086 ms | 1054 ms |
| 12 | ~7500 ms | 1083 ms | 1264 ms |
| 16 | — | 2064 ms | 1598 ms |
These are the server's own figures (the turn is judged over, then audio comes back), so they read
lower than the 4090 table above, which includes the pause. Measured 26 September 2026:
Qwen2.5-7B-Instruct-AWQ, --gpu-memory-utilization 0.6, --max-model-len 4096, Whisper small and
Kokoro on the same card, both servers with default settings otherwise. The in-process column is
Qwen 7B q4 GGUF on llama.cpp, 21 September.
Tools hold up under load. On that 3090, every caller asked about the same order on every turn: vLLM looked it up in 122 of 123 turns, SGLang in 109. On SGLang every session looked it up the first time; the turns without a lookup were the question asked a second, third or fourth time, answered from the lookup already in the conversation. That is correct, but if your data can change during a call, tell the agent to look things up again.
To run the model on vLLM or SGLang, name it in the agent and frun up starts the server for you:
llm = LLM("vllm:hf:Qwen/Qwen2.5-7B-Instruct-AWQ") # frun up starts vLLM on :8002
llm = LLM("sglang:hf:Qwen/Qwen2.5-7B-Instruct-AWQ") # ...or SGLang on :30000
llm = LLM("http://gpu-box:8000/v1", model_name="...") # or any OpenAI-compatible server you run
Install the engine once, in its own environment (it brings its own torch and CUDA), and tell fusion where it is:
python3 -m venv ~/vllm-env && ~/vllm-env/bin/pip install vllm
export FUSION_LLM_ENGINE_ENV=~/vllm-env
frun models pull agent.py # the LLM too (5.6 GB here), where vLLM looks for it
frun up agent.py
Without the pull, vLLM downloads the model during its first start, which takes 5–15 minutes and looks like nothing is happening.
frun up starts the server before loading speech, so it takes its share of the GPU first (60%
by default, which fits a 4-bit 7B model next to Whisper and Kokoro on a 24 GB card), restarts it
if it exits, and stops it with Ctrl+C. GPU memory, context length, tool parsing, extra engine
flags and logs are in the docs.
Docker
| Image | Compose file | |
|---|---|---|
| A laptop, or any machine without an NVIDIA GPU | ghcr.io/samarthurs18/fusion-runtime:cpu |
docker/docker-compose.yml |
| An NVIDIA GPU server | ghcr.io/samarthurs18/fusion-runtime:latest |
docker/docker-compose.gpu.yml (fusion + vLLM) |
cd docker
docker compose run --rm fusion models pull # once
docker compose up # or: -f docker-compose.gpu.yml
On a laptop, pip install fusion-runtime is simpler still. Keys, models and your own agent
file are in the docs.
The frun CLI
frun up [agent.py] |
Starts the server, and vLLM or SGLang if the agent names one. --host, --port, --reload, --llm-log |
frun talk |
Talks to it from a terminal, with a latency summary per turn |
frun bench |
Several callers at once against a running server, and which stage they wait on |
frun models list / pull |
What's available, and downloading it |
frun key new / keys list / token |
Keys and browser tokens |
frun doctor |
Checks the machine and says how to fix what's wrong |
frun version |
The installed version. --version and -V work too |
fusion-runtime works as an alias for frun.
Using it as a library
frun up agent.py covers running an agent. The pipeline can also run inside your own process —
for a queue worker, a test, or a batch job over recorded calls — with no server involved. See
examples/sdk_example.py, which is runnable, and
the docs.
Documentation and contact
Everything else — configuration, turn detection, languages, the server API, telemetry, limits, GPU setup and deployment — is at fusion-runtime.dev/docs.
| Site and docs | fusion-runtime.dev |
| Questions, or anything else | hello@fusion-runtime.dev |
| Security problems | security@fusion-runtime.dev — not a public issue, please (why) |
Development
uv sync --extra dev --extra talk # or: pip install -e ".[dev,talk]"
pytest
CI runs the suite on Python 3.11, 3.12 and 3.13. CONTRIBUTING.md has the layout, the design rules a review will hold you to, and how to add a runtime.
License
Apache-2.0. Embed it in a commercial product, rebrand it, ship it closed — keep the
copyright notice and the NOTICE file in what you distribute, and don't use the project's name
to imply it endorses you.
The models it downloads by default are permissive too (Whisper MIT, Silero VAD MIT, Qwen2.5 Apache-2.0, Kokoro Apache-2.0), so the whole default path is clear for commercial use. A model you point it at yourself carries its own licence — check that one before you ship it.
Metadata
Release files for fusion-runtime 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fusion_runtime-0.1.5.tar.gz | 493.9 kB | Without provenance | Details for fusion_runtime-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fusion_runtime-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for fusion_runtime-0.1.5-py3-none-any.whl |
Total release size: 908.6 kB
Release files / fusion_runtime-0.1.5.tar.gz
| Download URL | fusion_runtime-0.1.5.tar.gz |
|---|---|
| Size | 493.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62a99395b27eff1f496a523c881d1e61ef8f4f2d354a2f8caa48c0d0e93274b9
|
|
BLAKE2b-256 checksum How to use checksums |
6f229b45e1601721dd3342c5960dc23e3c3a5b0ad5ac66775c1d79f11cf81ce6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.1
|
Release files / fusion_runtime-0.1.5-py3-none-any.whl
| Download URL | fusion_runtime-0.1.5-py3-none-any.whl |
|---|---|
| Size | 414.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce817b67e0404c42caa7ca7d4b5482cfbb863e606a7eff9a653beb209f7caf2a
|
|
BLAKE2b-256 checksum How to use checksums |
fad55651f51997aa30254a9dc29275f025f810e800dbf3f451fccb6c8a8fd8d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.1
|
Security for fusion-runtime 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.