tokenspeed-engine
The engine's control plane, in Rust, as
RFC 0002 describes it: every
engine rank is a ts-host process that runs the scheduling loop in Rust and
embeds CPython for the data plane. The design rules of the loop are in
docs/design/event-loop.md.
| Source crate | Published package | Role |
|---|---|---|
ts-wire |
tokenspeed-wire |
The engine IPC schema and its msgpack codec, byte-compatible with the Python structs in python/tokenspeed/runtime/engine/io_struct.py and zmq_wire.py. |
ts-client |
tokenspeed-client |
A frontend's connection to the engines: the startup handshake, request routing across attention-DP ranks, output streams, aborts, control operations and an EPD encode server's encode requests. |
ts-py |
tokenspeed-py |
tokenspeed_engine._native: ts-client for Python tests and tools (entrypoints/wire_driver.py), with tokenspeed_engine.host_binary() naming the installed ts-host, and ts-l3's executor for Python tests over a data plane's Host pool. |
ts-collective |
tokenspeed-collective |
CPU collectives among an engine's ranks over a TCP mesh: broadcast, all-gather and all-reduce, each frame checked against the collective the receiver is in. |
ts-scheduler |
tokenspeed-scheduler |
The C++ scheduler and its nanobind module compiled into the binary, with a cxx facade for the control thread. The module is registered as a built-in of the embedded interpreter, so the plans Python reads are the same C++ objects the control thread produced. |
ts-control |
tokenspeed-control |
One rank's control plane: ingress checks, request state and output processing, the scheduling loop and its in-flight queue, cache-op acknowledgment, control operations, grammars, the expert rebalance, KV events, the engine side of the msgpack wire, and the per-round agreements among ranks. |
ts-grammar |
tokenspeed-grammar |
Grammar-constrained decoding on xgrammar's C++ library: compilation and the matchers, which the data plane drives through C entry points. |
ts-metrics |
tokenspeed-metrics |
The engine's metrics: Prometheus' multiprocess files, written directly, and the events the node's plugin relay runs output plugins on. |
ts-mooncake |
tokenspeed-mooncake |
The Mooncake transfer engine and store client through their C APIs, loaded at runtime from the tokenspeed-mooncake wheel. |
ts-l3 |
tokenspeed-l3 |
The L3 storage tier's Host-only executor (asynchronous L3): object naming, the Host pool's layout and ownership, bounded queues and workers, backend health, and the stores (the Mooncake store client, and an in-memory one for tests). |
ts-pd |
tokenspeed-pd |
The PD transfer peer: the P/D handshake, room states, transfer workers and the per-round agreement on transfer progress. |
ts-host |
tokenspeed-host |
The rank binary: it embeds the interpreter, has engine/rust_host.py build the data plane and the scheduler, and runs the loop on its main thread and the data plane on its forward thread. |
The crates.io packages use the tokenspeed- prefix. Their Rust library names
remain ts_wire, ts_client, and so on; the Python module remains _native,
and the host executable remains ts-host. For example:
[dependencies]
ts-client = { package = "tokenspeed-client", version = "0.1.0" }
Wire conformance
crates/ts-wire/tests/fixtures/ holds messages written by the Python encoder.
cargo test decodes each one, compares it field by field with the values the
generator used, and re-encodes it byte for byte;
test/runtime/test_ts_wire_fixtures.py checks that the files still match the
Python encoding. After an intentional schema change on the Python side, run
python tokenspeed-engine/crates/ts-wire/tests/fixtures/generate.py
and update the ts-wire structs to match. Give every new field a distinct,
non-default value in the generator: a field decoded into the wrong slot still
re-encodes to the same bytes, so only the value checks catch it.
The optional output_token_cumulative_probs_val tail carries each selected
token's cumulative probability diagnostic alongside its logprob. The control
plane retains the same token ordering, stop truncation and streaming slices
for both columns, and emits diagnostics only for requests returning logprobs.
Once a request has any value, each of its outputs carries one per token, NaN
for a token that came without one, so the column never misaligns with the
tokens. An older producer defaults this column to empty; older readers skip
it.
The appended reasoning_tokens column is cumulative per request, like
completion_tokens, and excludes reasoning-block delimiters. The control plane
counts committed token ids before detokenization, including a PD prefill's
bootstrap token. An older producer defaults the column to empty and its output
rows report zero; older readers skip the appended column. ts-client output
chunks, the Python chunk dictionaries, and WireDriver.Completion expose the
same cumulative count.
Building
Snapshot SDK updates carry a complete publication directory in the optional
UpdateWeightsFromMooncakeReqInput.snapshot map. The native host and Python
runtime must be built together to transport this field. The existing global
commit and memory-saver rules still apply. The configured SDK updater receives
update_weights(models, version=..., snapshot=...). Tensor data remains in the
SDK's store. Requests without a snapshot retain the existing SDK protocol.
The native crates target Linux and need a C++ compiler, CMake, OpenSSL
development headers, and Python development headers. Set PYO3_PYTHON to
an interpreter with nanobind>=2.13.0 and tokenspeed-spdlog==1.15.1
installed. The scheduler source is bundled in its crate; the grammar build
downloads the pinned, SHA256-checked xgrammar source release and therefore
needs network access (or FETCHCONTENT_SOURCE_DIR_XGRAMMAR for a local copy).
ts-host and ts-py link the CPython the engine runs under; build with it
as PYO3_PYTHON, which needs nanobind and tokenspeed-spdlog, as the
scheduler wheel build does:
PYO3_PYTHON=$(which python) cargo build --release -p tokenspeed-host -p tokenspeed-py
The tokenspeed-engine wheel (pyproject.toml, built with setuptools) carries
tokenspeed_engine._native and the ts-host binary. To run a development
build instead, put _native on the Python path and point
TOKENSPEED_HOST_BINARY at the binary. TS_HOST_LOG sets the Rust log
filter (info by default; ts_control=debug logs admissions and cache-op
acknowledgments).
Releasing Python wheels
Use Release TokenSpeed Engine in GitHub Actions. Select dry-run to
build and test wheels, or publish on main to upload them to PyPI. The
workflow uses the version in pyproject.toml; merge a version bump before
each release. An interrupted publication can be rerun to upload missing files.
Wheels support Linux with glibc 2.28 or newer, x86_64 and aarch64, and
CPython 3.10–3.13. They contain the Python extension, ts-host, and a private
CPython shared library for the host process, including its built-in native
stdlib modules. The host uses the launching interpreter's Python library
paths and environment. Installing a wheel needs no
Rust toolchain. Each wheel is tested in a separate Python container and venv
by importing the extension and starting the embedded scheduler and Python.
The build uses a full checkout because the engine also compiles the sibling scheduler source. No source distribution is published; source builds must use the repository checkout and the dependencies described above.
Configure the tokenspeed-engine project's PyPI Trusted Publisher with
owner lightseekorg, repository tokenspeed, workflow filename
release-tokenspeed-engine.yml, and GitHub environment pypi. Publication
uses GitHub OIDC and does not require a stored PyPI token.
Releasing Rust crates
Use Release TokenSpeed Engine Crates in GitHub Actions. Select dry-run
to build and verify the workspace's package archives without uploading.
Select publish on main to publish missing versions in dependency order;
versions already on crates.io are skipped, so a partial release can be rerun.
The run summary lists each package's version and the source commit.
Before a release, update [workspace.package].version in Cargo.toml and
the internal dependency versions in crates/*/Cargo.toml, run
cargo update --workspace to refresh Cargo.lock, and merge the version
change. The workflow publishes the committed versions; it does not bump them.
Publishing uses crates.io Trusted Publishing rather than a stored API token. Configure it once:
- Create the GitHub environment
crates-ioand restrict its deployment branches tomain. - In each published crate's Settings → Trusted Publishing, add a GitHub
publisher with repository owner
lightseekorg, repositorytokenspeed, workflow filenamerelease-tokenspeed-engine-crates.yml, and environmentcrates-io.
New crates need their initial token-based publication before Trusted Publishing can be configured. Registry rate limits still apply.
Running against an engine
Start a headless engine (one rank process per GPU is launched for you); it dials the handshake address the client binds:
ts serve --headless --model <model> \
--data-parallel-rpc-port 30500 [--data-parallel-size N --dist-init-addr <host:port>]
cargo run --release --example generate -- tcp://127.0.0.1:30500 <N> <max-new-tokens> <prompts-file>
Each line of the prompts file is a comma-separated list of prompt token ids.
Metadata
Release files for tokenspeed-engine 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 145.6 MB
Release files / tokenspeed_engine-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | tokenspeed_engine-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 20.1 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
bca828c5f03878c5c5740571cc7fe4d60c3b6281a8b80659ca775392af991356
|
|
BLAKE2b-256 checksum How to use checksums |
67d052cd0d21cb911634ae9eae8e682cae113bff4714b3eaa8a86ffd4d676022
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl
| Download URL | tokenspeed_engine-0.1.0-cp313-cp313-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 18.0 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ee1033ae8f0a7073a6d9b90893193b8691f49c079ab5ffefd8ac485941693b4a
|
|
BLAKE2b-256 checksum How to use checksums |
fd10fa6208087c790f299b19112697322d66036d56a610a5f1d52dc86e65dfa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | tokenspeed_engine-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 19.9 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
7055062716f17b9742975420d0ad2cd4156c65bd6fc8d2372602855c8a6e6e93
|
|
BLAKE2b-256 checksum How to use checksums |
89196b6b18f3905c4fb329a7800270f9a4c84a07397cdfc5b6f3f068cfd67fc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
| Download URL | tokenspeed_engine-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 17.9 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
1ad57d6ba0d2cf780fbd4f8526514ce46f196414cc68afd24a0036b37685b099
|
|
BLAKE2b-256 checksum How to use checksums |
808e1f4ed20c2f9bda3ebc0273ef535ac65150f17e337738352d5994a0e839c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | tokenspeed_engine-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.8 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c1167256c06df4d8fee4ee76d5d5019fa38d6786628e4a5694c84fdc8747bbfe
|
|
BLAKE2b-256 checksum How to use checksums |
2e023b3c9ec3d744fc6d119e32ca0386223654d5610cc55824c7ebe41f4ef6ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl
| Download URL | tokenspeed_engine-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 17.8 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
23c065cd2bd97a9f0658f2c55d9489ff92f44baf8ddb245714ad02b858e3c932
|
|
BLAKE2b-256 checksum How to use checksums |
b28faf2ec24eb2da96f6c88317bc7548ffdd6250017fe381319498886617cb10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | tokenspeed_engine-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6fcfef4a89ac9804efe439f88bd46af34f433f6df025652ab5650f9f598148ce
|
|
BLAKE2b-256 checksum How to use checksums |
fbb4985d3cd7bfc029ed13abfc804e7b500a209ac9f7cfaa34f7ec4a569fc6a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / tokenspeed_engine-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl
| Download URL | tokenspeed_engine-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
08d99d13ce33c1c7974e1f590c2d651997d400e86089f260741261969569a864
|
|
BLAKE2b-256 checksum How to use checksums |
27eaad0e7f880bf488fb9c3da3d6dd4d82144554dc9d5f0f4f5f69bc9cfd9620
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for tokenspeed-engine 0.1.0
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.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for tokenspeed_engine-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA 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.