Metadata-Version: 2.5
Name: sequence-ai
Version: 0.66.0
Summary: SequenceLink is an open-source framework for serving robot policies from remote GPUs over wide-area networks (WANs).
Project-URL: Homepage, https://generalsequences.com
Project-URL: Documentation, https://generalsequences.com/docs/
Project-URL: Console, https://app.generalsequences.com
Project-URL: Repository, https://github.com/General-Sequences/sequence-ai
Project-URL: Issues, https://github.com/General-Sequences/sequence-ai/issues
Project-URL: Changelog, https://generalsequences.com/docs/changelog/
Author: General Sequences
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
License-File: THIRD_PARTY_NOTICES.md
Keywords: action chunk,batching,cuda graphs,gr00t,inference,latency,lerobot,manipulation,openpi,policy,remote inference,robot policy serving,robotics,vla,wide-area network
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: av>=17.1; python_version >= '3.10' and (sys_platform != 'win32' or platform_machine != 'ARM64' or python_version >= '3.11')
Requires-Dist: httpx<1,>=0.24
Requires-Dist: numpy>=1.24
Requires-Dist: pillow>=10
Requires-Dist: pydantic>=2; python_version >= '3.10'
Requires-Dist: sequence-base<0.9,>=0.8.15; python_version >= '3.10'
Requires-Dist: uvicorn<1,>=0.30
Requires-Dist: zstandard>=0.22
Provides-Extra: data
Requires-Dist: pyarrow>=14; extra == 'data'
Provides-Extra: dev
Requires-Dist: aioice<0.14,>=0.13; (python_version >= '3.11') and extra == 'dev'
Requires-Dist: aiortc<1.17,>=1.16; (python_version >= '3.11') and extra == 'dev'
Requires-Dist: eclipse-zenoh<2,>=1.10; extra == 'dev'
Requires-Dist: jax>=0.4.30; (python_version >= '3.10') and extra == 'dev'
Requires-Dist: moq-ffi==0.4.27; (python_version >= '3.10') and extra == 'dev'
Requires-Dist: moq-rs==0.5.2; (python_version >= '3.10') and extra == 'dev'
Requires-Dist: msgpack-numpy<0.5,>=0.4.8; extra == 'dev'
Requires-Dist: msgpack<2,>=1.0; extra == 'dev'
Requires-Dist: numpy>=1.24; extra == 'dev'
Requires-Dist: opencv-python-headless>=4.8; extra == 'dev'
Requires-Dist: pillow>=10; extra == 'dev'
Requires-Dist: pyarrow>=14; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff<1,>=0.6; extra == 'dev'
Requires-Dist: sequence-base<0.9,>=0.8.15; (python_version >= '3.10') and extra == 'dev'
Requires-Dist: torch<3,>=2.4; extra == 'dev'
Requires-Dist: uvicorn<1,>=0.30; extra == 'dev'
Requires-Dist: websockets<19,>=14; extra == 'dev'
Requires-Dist: zstandard>=0.22; extra == 'dev'
Provides-Extra: moq
Requires-Dist: moq-ffi==0.4.27; (python_version >= '3.10') and extra == 'moq'
Requires-Dist: moq-rs==0.5.2; (python_version >= '3.10') and extra == 'moq'
Provides-Extra: teleop
Requires-Dist: aioice<0.14,>=0.13; (python_version >= '3.11') and extra == 'teleop'
Requires-Dist: aiortc<1.17,>=1.16; (python_version >= '3.11') and extra == 'teleop'
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/General-Sequences/sequence-ai/main/docs/banner-dark.png">
    <img alt="SequenceLink" src="https://raw.githubusercontent.com/General-Sequences/sequence-ai/main/docs/banner-light.png" width="720">
  </picture>
</p>

<h3 align="center">Serve robot policies from GPUs anywhere</h3>

<p align="center">
| <a href="https://generalsequences.com/"><b>Platform</b></a> | <a href="https://generalsequences.com/docs/open-source/"><b>Documentation</b></a> | <a href="https://generalsequences.com/blog/"><b>Blog</b></a> | <a href="https://generalsequences.com/papers/scaling-robot-policies-over-wide-area-networks.pdf"><b>Paper</b></a> | <a href="https://x.com/generalsequence"><b>Twitter/X</b></a> |
</p>

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/General-Sequences/sequence-ai/main/docs/hero-dark.png">
    <img alt="Ten robot tables, each robot connected to one GPU" src="https://raw.githubusercontent.com/General-Sequences/sequence-ai/main/docs/hero-light.png" width="720">
  </picture>
</p>

<p align="center">
  <a href="https://github.com/General-Sequences/sequence-ai/actions/workflows/tests.yml"><img alt="tests" src="https://github.com/General-Sequences/sequence-ai/actions/workflows/tests.yml/badge.svg"></a>
  <img alt="pip install sequence-ai" src="https://img.shields.io/badge/pip%20install-sequence--ai-15775C?style=flat-square">
  <img alt="Python 3.9 or later" src="https://img.shields.io/badge/python-3.9%2B-15775C?style=flat-square">
  <a href="https://github.com/General-Sequences/sequence-ai/blob/main/LICENSE"><img alt="license: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-15775C?style=flat-square"></a>
</p>

<p align="center">
  <a href="#how-it-fits-together">Architecture</a> ·
  <a href="#quick-start">Quick start</a> ·
  <a href="#the-problem-by-layer">The problem</a> ·
  <a href="#inference-layer">Inference layer</a> ·
  <a href="#network-layer">Network layer</a> ·
  <a href="#results">Results</a> ·
  <a href="#documentation">Docs</a>
</p>

## How it fits together

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/General-Sequences/sequence-ai/main/docs/architecture-dark.png">
    <img alt="How it fits together. On the robot: your control loop over sequence_ai.network (connect, openpi, window, frames, wifi_power). Across the WAN, the observation goes to the GPU and the action chunk comes back. On the GPU: your policy over sequence_ai.engine (serve, optimize, load, batcher, replicas, slack) and sequence_ai.network (one_write, ping, tcp_link). Both ends: msgpack_io and latency_stats. Your own link, measured: bench/." src="https://raw.githubusercontent.com/General-Sequences/sequence-ai/main/docs/architecture-light.png" width="900">
  </picture>
</p>

**`sequence_ai.network`** is the connection between a robot and the GPU its policy runs on. On the robot, `connect()`
applies the client-side components to one connection, and `openpi.keep()` does the same on the connection that openpi's
own client holds. On the server, `one_write` and `ping` wrap a uvicorn or a WebSocket server. **`sequence_ai.engine`**
is the inference layer on the GPU: `seq serve` serves a policy with the server's side of both layers on, `optimize`
shortens one inference with the speed-ups that keep its outputs exactly the same, `batcher` and `slack` share a GPU among robots, and `replicas` runs one process per GPU. **`bench/`** measures a link before anything is added to it.

## Install

```bash
pip install sequence-ai
```

The same package goes on the GPU and on the robot: Python 3.10 or later, on Linux or macOS (a robot can `connect()` from
3.9). The speed-ups use your model's own torch (2.4 or later) or JAX.

## Quick start

**On the GPU**, save this as `policy.py` in a folder of its own:

```python
import numpy as np
import seq


@seq.policy(hz=15, action_chunk_valid_len=8, action_chunk_replan_at=5)
class QuickstartPolicy_user:
    @seq.sample
    def sample_user(self):
        observation_user = {"image": np.zeros((224, 224, 3), dtype=np.uint8), "state": np.zeros(7, dtype=np.float32)}
        return [("observe", observation_user), ("act",)] * 3          # an observation, then an act, three times

    @seq.infer
    def infer_user(self, observation_user):
        frame_user = observation_user["image"]                       # your model here: the next 10 steps, 7 joints each
        return {"actions": np.full((10, 7), float(frame_user.mean()), dtype=np.float32)}
```

Then serve it from that folder:

```bash
seq serve
```

```text
serving quickstart-policy-user on port 8000, each robot held and seated by its time at 15 Hz: a robot connects with sequence_ai.connect("http://<this machine>:8000")
```

**On the robot**:

```python
import numpy as np
import sequence_ai

with sequence_ai.connect("http://127.0.0.1:8000") as policy_user:     # your GPU's address
    policy_user.wait_until_ready()                                     # once, before the robot moves
    frame_user = np.zeros((224, 224, 3), dtype=np.uint8)               # your camera's frame, streamed as video
    policy_user.observe({"image": sequence_ai.Video(frame_user), "state": np.zeros(7, dtype=np.float32)})
    print(policy_user.act()["actions"].shape)                           # (10, 7)
```

The robot plays 15 steps a second (`hz`), uses the first 8 steps of each chunk (`action_chunk_valid_len`), and asks for
the next chunk at step 5 (`action_chunk_replan_at`). [Quickstart](https://github.com/General-Sequences/sequence-ai/blob/main/docs/quickstart.md) has the whole loop. Names ending in
`_user` are yours to change.

- **An official template**: `seq init pi05-libero my_pi05_user`, then `seq serve` in that folder
  ([how](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-run-a-template-on-my-own-gpu.md)).
- **Both halves on one machine**: in a clone of this repository, `seq serve examples/quickstart_policy & python examples/quickstart_robot.py`.
- **A server you already run**: [its parts](https://github.com/General-Sequences/sequence-ai/blob/main/docs/parts-for-a-server-you-already-run.md), one file each.
- **What is on by default**: [each part, and how to turn it off](https://github.com/General-Sequences/sequence-ai/blob/main/docs/what-is-on-by-default.md).
- **GPUs run for you**: deploy the same folder to [General Sequences](https://generalsequences.com/docs/deploy/).

## The problem, by layer

A robot policy built on a vision-language-action (VLA) model runs each inference on a GPU, and a robot without a
suitable GPU on board sends its observations over a WAN to a remote one. Each layer of that path has its own problem.

**The model is most of the latency.** Across thirteen model and network configurations, the model is 68 to 96% of a
request's latency. The time of one inference is therefore the main lever, and `optimize` shortens it without changing
the model's output.

**One robot leaves its GPU mostly idle.** One robot keeps a GPU busy 21 to 55% of the time, so several robots can share
one, provided that no robot's action chunk runs out while its request waits. `batcher` batches the requests that are
waiting, `slack` computes how long each may wait and how many robots a replica can serve, and `replicas` runs one
replica per GPU.

**A robot pauses, and Linux restarts its connection.** A robot executes a chunk between requests, and Linux restarts a
TCP connection's congestion window after an idle period. The upload after a pause then takes one extra round trip, at
RTTs from 12 to 101 ms. `window`, `ping` and `connect` keep the window open.

**A request carries more round trips and bytes than it needs.** A response split across writes can wait a round trip
behind a tunnel, and a camera frame is 50 to 100 KB. `one_write` sends each response in one write, `connect()` sends each
camera as video and compresses a large array only when that shortens the upload, and `frames` resizes a frame before it
is sent.

**GPUs are in short supply.** Few are near any given robot, and every millisecond of round-trip time comes out of the
slack an action chunk leaves. Getting a GPU near the robot is the routing layer, which is outside this package.

## Inference layer

| Component | What it does | To add it | Requires |
|---|---|---|---|
| [`seq serve`](https://github.com/General-Sequences/sequence-ai/blob/main/seq/serve_local.py) | Serves a `@seq.policy` class to robots elsewhere: on a thread of its own, pings answered at once, a warm-up on its `@seq.sample`, pictures and compressed arrays restored, a `@seq.concurrent` policy's acts in batches. | one command | what `pip install sequence-ai` installs |
| [`optimize`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/engine/optimize.py) | Makes a policy faster on its GPU: each speed-up is kept only when its outputs on your observations stay exactly the same and acts are at least 10% faster. `seq serve` runs it on the `@seq.sample` episode. The speed-ups that change the outputs run with the difference you accept. | nothing with `seq serve`, else one call | torch 2.4 or later and a CUDA GPU, or JAX |
| [`load`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/engine/load.py) | Reads a model's weights onto the GPU from one contiguous file in parallel reads, through the page cache where memory holds it: in about 60% of the time of a checkpoint read tensor by tensor from a cold disk, every tensor the bytes it was packed with. | one call to pack, one to load | torch for a GPU, or JAX |
| [`batcher`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/engine/batcher.py) | Batches the calls waiting for a model into one call, in the batch sizes the model lists. | one object, one `await` | nothing |
| [`replicas`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/engine/replicas.py) | Runs replicas of a model, each in its own process on the GPU assigned to it, and replaces one that dies. | one object, one `await` | nothing |
| [`slack`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/engine/slack.py) | Schedules by the slack an action chunk leaves: how many robots a replica can serve, each by its own round-trip time (RTT), how long a request may wait for a batch, and which requests are dispatched first. | a few calls in your server's loop | nothing |

```python
from sequence_ai.engine import optimize, slack
from sequence_ai.engine.batcher import Batcher
from sequence_ai.engine.replicas import ReplicaPool

optimize(model_user, examples_user)                                # 32 or more of your robot's observations
batcher_user = Batcher(model_on_a_list_user, sizes=[1, 2, 4, 8], wait_ms=2.0)
pool_user = ReplicaPool(load_user, replicas=2, devices=[0, 1])     # one replica per GPU

table_user = slack.measure(forward_of_user, sizes=[1, 2, 4])       # forward_of_user(n): one forward pass of n requests
play_user = slack.playback(hz=20, valid_len=15, replan_at=8)       # 15 valid steps, the next requested at the 8th
seating_user = slack.Seating(table_user, play_user["buffer_s"] * 1000, sizes=[1, 2, 4],
                             cycle_ms=(play_user["play_s"] - play_user["buffer_s"]) * 1000)
seats_user, over_user = seating_user.seat([("near", 30.0), ("far", 200.0)])     # (robot, its RTT in ms)
```

- **`optimize`** tries `cuda_graphs` on every module that repeats and `whole_graph` on a run's whole call, keeps
  each where the outputs stay exactly the same and acts get faster, and reports why each is on or off.
  `torch_compile`, `fused_kernels`, `tensorrt` and `precision` change the outputs and need `tolerance=`.
  [How do I make a policy faster without changing its outputs, and what does each switch change?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-make-a-policy-faster-without-changing-its-outputs.md)
- **Its graphs** speed up PyTorch policies whose time goes to launching kernels. XLA already compiles each jitted
  function of a JAX policy such as π0.5 whole and puts most of its work in command buffers, so on a JAX policy they are
  tried only when you turn them on.
  `cuda_graphs` replays each module called many times per run with the same shapes from CUDA graphs of its own eager
  kernels, and checks each new shape against eager mode byte for byte. A shape whose capture fails or differs runs in eager mode from then on. The module stays the same
  object of the same class, with its weights, `state_dict` and hooks unchanged.
  [How do I make a PyTorch robot policy faster without changing its outputs?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-make-a-pytorch-robot-policy-faster-without-changing-its-outputs.md)
- **`batcher`** dispatches a batch as soon as it is full, or `wait_ms` after its first call while the model is free.
  While the model is busy, waiting calls accumulate and are dispatched together. Only the listed sizes are used, and a
  batch in which the model raised is re-run call by call.
  [How many robots can one GPU serve?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-many-robots-can-one-gpu-serve.md)
- **`replicas`** runs each replica in its own process on its own GPU, so a forward pass never blocks the server's
  event loop. `ReplicaError` is the model's own error, and the replica takes the next call. `ReplicaDied` is a process
  that has exited, and it is replaced.
  [Should I run two replicas of a policy on one GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/should-i-run-two-replicas-of-a-policy-on-one-gpu.md)
- **`slack`** computes a replica's capacity from the playback time an action chunk leaves when its robot requests
  the next one, each robot by its own RTT, and tells a server how long the open batch may wait.
  [`slack`: scheduling by the slack an action chunk leaves](https://github.com/General-Sequences/sequence-ai/blob/main/docs/slack.md)

[How do I use the inference components with openpi, LeRobot or GR00T?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-use-the-inference-components-with-openpi-lerobot-or-gr00t.md)

## Network layer

"Client" is the robot's program and "server" is the policy server on the GPU.

| Component | Side | What it does | Requires |
|---|---|---|---|
| [`window`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/window.py) | client | Keeps the connection's congestion window across the robot's pauses: BBR on its socket, TCP keepalive, a ping while the connection is idle. | nothing |
| [`frames`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/frames.py) | both | Resizes a frame to the policy's input size and encodes it as JPEG, and turns it back into its array on the server: what openpi's own client and server carry. | Pillow |
| [`wifi_power`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/wifi_power.py) | client | Detects Wi-Fi power saving on the robot's link and reports how to disable it. | Linux |
| [`one_write`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/one_write.py) | server | Sends each HTTP response of a uvicorn server in one write instead of three. | uvicorn |
| [`tcp_link`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/tcp_link.py) | server | Reads each client's TCP state from the server's kernel: RTT, retransmitted segments, congestion window. | Linux |
| [`ping`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/ping.py) | server | A server-side ping, so that the robot's connection is not left idle while the server can answer it: the options to pass to your server. | a WebSocket server |
| [`msgpack_io`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/msgpack_io.py) | both | Encodes observations and responses as msgpack, with numpy arrays as raw bytes. Also reads openpi's layout. | nothing |
| [`latency_stats`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/latency_stats.py) | both | Counters, gauges and latencies with their p50, p95 and p99, read as one snapshot. | nothing |

Combined, and for clients you may already use:

| | Side | What it does | Requires |
|---|---|---|---|
| [`connect`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/__init__.py) | client | `sequence_ai.connect(url)`: the same policy a deployed one's name gives, on the robot's stream to your own server: each observation as it is made, a `sequence_ai.Video` item as video, each act after them. | nothing |
| [`lines`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/_core/lines_stream.py) | client | `connect(url, lines=["eth0", "wwan0"])`: the robot's stream over each of its uplinks, each line bound to its own network interface, every observation and act on every line and the first answer used. | Linux 5.7 or macOS |
| [`check`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/check.py) | client | `python -m sequence_ai.check <url>`: which defaults are on between a robot and its server, and what the server is. | httpx |
| [`openpi`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/openpi.py) | client | The client-side components on the connection held by openpi's own client. | openpi-client |
| [`lerobot`](https://github.com/General-Sequences/sequence-ai/blob/main/sequence_ai/network/lerobot.py) | both | The Zenoh setting that keeps LeRobot's remote-inference connection from going idle. | lerobot 0.7 |
| [`bench/`](https://github.com/General-Sequences/sequence-ai/tree/main/bench/) | both | Measures your own link: what a pause, a ping and a camera stream cost on it. | nothing |

```python
from sequence_ai.network import lerobot, openpi

kept_user = openpi.keep(policy_user)                              # openpi: one line on its WebsocketClientPolicy
path_user = lerobot.keep_alive_file("zenoh-keep-alive.json5")     # LeRobot 0.7: one Zenoh setting, given to both sides
```

[What does each component do?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/components.md) gives the lines to add, the reason and the measurement for each
one, and [`examples/components/`](https://github.com/General-Sequences/sequence-ai/tree/main/examples/components/) has a runnable file for each.
[How do I run π0 (openpi) on a remote GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-run-pi0-openpi-on-a-remote-gpu.md) |
[How do I reduce the latency of LeRobot remote inference?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-reduce-the-latency-of-lerobot-remote-inference.md)
| [How do I serve a robot policy from my own GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-serve-a-robot-policy-from-my-own-gpu.md)

## Language models

`sequence_ai.chat()` and `Conversation` (an agent's history and its tool calls) take `server="openrouter"` with your
own OpenRouter key, or the address of a server of your own with the OpenAI chat completions API:

```python
result_user = sequence_ai.chat("qwen/qwen3-next-80b-a3b-instruct", [{"role": "user", "content": "Plan the next step."}],
                               server="openrouter")      # your key in OPENROUTER_API_KEY
```

[How do I use an LLM with my own OpenRouter key?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-use-an-llm-with-my-own-openrouter-key.md)

## Results

Across thirteen model and network configurations, the time a request spends outside the model ranges from 13 to
137 ms, and its share of the latency from 4 to 32%. A remote GPU is therefore close to an on-board GPU of the same
type, and inference time is the main lever.

Inference layer:

| Component | Result | Measured on |
|---|---|---|
| `cuda_graphs` | 1.54× faster (224 → 146 ms), exactly the same outputs | GR00T N1.7's diffusion transformer, one L4, 2026-11-01 |
| `cuda_graphs` against `torch.compile` | 1.54×, against 1.45× with different outputs (inductor) and 1.00× (cudagraphs) | the same model and GPU |
| `cuda_graphs` | 6.7× faster (16.1 → 2.4 ms), byte for byte | a small model of many small kernels, one T4 |
| Batching | up to 1.78× the requests per second (5.99 → 10.66) | π0.5, one L4, batch 16 |
| `slack` | 94.1% of responses in time, against 85.7% with all robots on one replica | four robots, a model paced like a 15 Hz policy |

Network layer:

| Component | Result | Measured on |
|---|---|---|
| `window`, `ping` | an upload after a pause in 1.0 round trips, not 2.0 | a 24 KB upload, RTTs of 12 to 101 ms |
| `window`: BBR | no extra round trip after a pause, also with 1% loss | a 24 KB upload, RTT about 21 ms |
| `ping`, the server's | 1.1 to 1.25 round trips, not 3.0 | 100 KB to 1 MB after 500 ms of silence |
| `window.Warm`, the robot's ping | under 1 ms, not 303.6 ms, for an upload to arrive | 162 KB uploads 3 s apart, RTT 226 ms |
| `one_write` | 106.7 ms, not 189.7, for a response | a GET through a tunnel |
| `sequence_ai.Video` | about 2.5 KB a frame, not 921,600 bytes as an array | a 640×480 camera, a textured background and three moving discs |

[Measurements](https://github.com/General-Sequences/sequence-ai/blob/main/docs/measurements.md) lists the network layer's commands, and [`bench/`](https://github.com/General-Sequences/sequence-ai/tree/main/bench/) measures your own link.

## Repository layout

```
sequence_ai/
  engine/        inference layer: serve · optimize · load · cuda_graphs · batcher · replicas · slack
  network/       network layer
                   client: connect · window · frames · wifi_power · openpi
                   server: one_write · ping · tcp_link
                   both:   msgpack_io · latency_stats · lerobot
  chat/          chat() and Conversation: on General Sequences, or at a server of your own (server=)
  check.py       python -m sequence_ai.check: which defaults are on between a robot and its server
seq/             seq init, seq serve and seq weights get, and the decorators a policy is written with
bench/           measures a link: a TCP client and server, WebSocket, Zenoh
examples/        the quick starts, and one runnable file per component
docs/            one page per question, the measurements, the FAQ
tests/           the components' tests: Python 3.9 to 3.12, on a machine with no GPU
tools/           writes llms-full.txt
```

## Documentation

- [What is open source, and what does General Sequences host?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/what-is-open-source-and-what-is-hosted.md)
- [Quickstart: a policy and a robot](https://github.com/General-Sequences/sequence-ai/blob/main/docs/quickstart.md)
- [Parts for a server you already run](https://github.com/General-Sequences/sequence-ai/blob/main/docs/parts-for-a-server-you-already-run.md)
- [Quickstart: batching and replicas](https://github.com/General-Sequences/sequence-ai/blob/main/docs/quickstart-inference.md)
- Inference layer
  - [How do I make a policy faster without changing its outputs, and what does each switch change?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-make-a-policy-faster-without-changing-its-outputs.md)
  - [How do I make a PyTorch robot policy faster without changing its outputs?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-make-a-pytorch-robot-policy-faster-without-changing-its-outputs.md)
  - [How many robots can one GPU serve?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-many-robots-can-one-gpu-serve.md)
  - [Should I run two replicas of a policy on one GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/should-i-run-two-replicas-of-a-policy-on-one-gpu.md)
  - [How do I use the inference components with openpi, LeRobot or GR00T?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-use-the-inference-components-with-openpi-lerobot-or-gr00t.md)
  - [`slack`: scheduling by the slack an action chunk leaves](https://github.com/General-Sequences/sequence-ai/blob/main/docs/slack.md)
- Network layer
  - [How do I serve a robot policy from my own GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-serve-a-robot-policy-from-my-own-gpu.md)
  - [How do I run a template on my own GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-run-a-template-on-my-own-gpu.md)
  - [How do I run π0 (openpi) on a remote GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-run-pi0-openpi-on-a-remote-gpu.md)
  - [How do I reduce the latency of LeRobot remote inference?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-reduce-the-latency-of-lerobot-remote-inference.md)
  - [Why does my robot's upload get slow after a pause?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/why-does-my-robots-upload-get-slow-after-a-pause.md)
  - [How do I measure the link between my robot and my GPU?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-measure-the-link-between-my-robot-and-my-gpu.md)
  - [How do I keep a WebSocket policy server's connection warm?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-keep-a-websocket-policy-servers-connection-warm.md)
  - [What do the network components save, measured with the tools in this repository?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/measurements.md)
  - [How do the components compare with openpi's remote inference and LeRobot's?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/comparison.md)
  - [What does each network component do?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/components.md)
- Language models
  - [How do I use an LLM with my own OpenRouter key?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-use-an-llm-with-my-own-openrouter-key.md)
- A GPU near your robot
  - [How do I get a GPU near my robot?](https://github.com/General-Sequences/sequence-ai/blob/main/docs/how-do-i-get-a-gpu-near-my-robot.md)
- [FAQ: errors you may see, and what to do next](https://github.com/General-Sequences/sequence-ai/blob/main/docs/faq.md)

[`llms.txt`](https://github.com/General-Sequences/sequence-ai/blob/main/llms.txt) is a map of the repository for a coding assistant, and [`llms-full.txt`](https://github.com/General-Sequences/sequence-ai/blob/main/llms-full.txt) is
this README and every page of `docs/` in one file.

## A note on the numbers

Every number in this README is given with the model, the GPU or the link it was measured on, and
[Measurements](https://github.com/General-Sequences/sequence-ai/blob/main/docs/measurements.md) lists the command behind each of the network layer's. What a network component saves depends on the
link, so [`bench/`](https://github.com/General-Sequences/sequence-ai/tree/main/bench/) measures yours before you add anything. Each module's docstring states what the component
does in one sentence, why, and what was measured.

## Develop

```bash
uv venv --python 3.11
uv pip install -e ".[dev]"
.venv/bin/python -m pytest -q
.venv/bin/ruff check sequence_ai/engine sequence_ai/network tests examples bench tools
```

The tests are the components', and run on Python 3.9 to 3.12 on a machine with no GPU. Each release is published here
from General Sequences' own repository: [CONTRIBUTING.md](https://github.com/General-Sequences/sequence-ai/blob/main/CONTRIBUTING.md) has what that means for a pull request.

## Contributing

Questions and ideas go to [Discussions](https://github.com/General-Sequences/sequence-ai/discussions). Issues and pull
requests are welcome: see [CONTRIBUTING.md](https://github.com/General-Sequences/sequence-ai/blob/main/CONTRIBUTING.md) and the
[Code of Conduct](https://github.com/General-Sequences/sequence-ai/blob/main/CODE_OF_CONDUCT.md). To report a security problem, see [SECURITY.md](https://github.com/General-Sequences/sequence-ai/blob/main/SECURITY.md).

## Cite

If you use SequenceLink in research, please cite it:

```bibtex
@software{generalsequences2026sequenceai,
  title  = {SequenceLink},
  author = {{General Sequences}},
  year   = {2026},
  url    = {https://github.com/General-Sequences/sequence-ai}
}
```

[CITATION.cff](https://github.com/General-Sequences/sequence-ai/blob/main/CITATION.cff) has the same, with the version.

## License

[Apache-2.0](https://github.com/General-Sequences/sequence-ai/blob/main/LICENSE). Copyright 2026 General Sequences Company. Parts of five components and one example are adapted from three other
projects: [THIRD_PARTY_NOTICES.md](https://github.com/General-Sequences/sequence-ai/blob/main/THIRD_PARTY_NOTICES.md).
