| Platform | Documentation | Blog | Paper | Twitter/X |
Architecture · Quick start · The problem · Inference layer · Network layer · Results · Docs
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.
pip install sequence-aiThe 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.
On the GPU, save this as policy.py in a folder of its own:
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:
seq serveserving 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:
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 has the whole loop. Names ending in
_user are yours to change.
- An official template:
seq init pi05-libero my_pi05_user, thenseq servein that folder (how). - 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, one file each.
- What is on by default: each part, and how to turn it off.
- GPUs run for you: deploy the same folder to General Sequences.
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.
| Component | What it does | To add it | Requires |
|---|---|---|---|
seq serve |
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 |
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 |
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 |
Batches the calls waiting for a model into one call, in the batch sizes the model lists. | one object, one await |
nothing |
replicas |
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 |
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 |
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)optimizetriescuda_graphson every module that repeats andwhole_graphon 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,tensorrtandprecisionchange the outputs and needtolerance=. How do I make a policy faster without changing its outputs, and what does each switch change?- 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_graphsreplays 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_dictand hooks unchanged. How do I make a PyTorch robot policy faster without changing its outputs? batcherdispatches a batch as soon as it is full, orwait_msafter 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?replicasruns each replica in its own process on its own GPU, so a forward pass never blocks the server's event loop.ReplicaErroris the model's own error, and the replica takes the next call.ReplicaDiedis a process that has exited, and it is replaced. Should I run two replicas of a policy on one GPU?slackcomputes 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
How do I use the inference components with openpi, LeRobot or GR00T?
"Client" is the robot's program and "server" is the policy server on the GPU.
| Component | Side | What it does | Requires |
|---|---|---|---|
window |
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 |
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 |
client | Detects Wi-Fi power saving on the robot's link and reports how to disable it. | Linux |
one_write |
server | Sends each HTTP response of a uvicorn server in one write instead of three. | uvicorn |
tcp_link |
server | Reads each client's TCP state from the server's kernel: RTT, retransmitted segments, congestion window. | Linux |
ping |
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 |
both | Encodes observations and responses as msgpack, with numpy arrays as raw bytes. Also reads openpi's layout. | nothing |
latency_stats |
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 |
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 |
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 |
client | python -m sequence_ai.check <url>: which defaults are on between a robot and its server, and what the server is. |
httpx |
openpi |
client | The client-side components on the connection held by openpi's own client. | openpi-client |
lerobot |
both | The Zenoh setting that keeps LeRobot's remote-inference connection from going idle. | lerobot 0.7 |
bench/ |
both | Measures your own link: what a pause, a ping and a camera stream cost on it. | nothing |
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 sidesWhat does each component do? gives the lines to add, the reason and the measurement for each
one, and examples/components/ has a runnable file for each.
How do I run π0 (openpi) on a remote GPU? |
How do I reduce the latency of LeRobot remote inference?
| How do I serve a robot policy from my own GPU?
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:
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_KEYHow do I use an LLM with my own OpenRouter key?
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 lists the network layer's commands, and bench/ measures your own link.
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
- What is open source, and what does General Sequences host?
- Quickstart: a policy and a robot
- Parts for a server you already run
- Quickstart: batching and replicas
- Inference layer
- How do I make a policy faster without changing its outputs, and what does each switch change?
- How do I make a PyTorch robot policy faster without changing its outputs?
- How many robots can one GPU serve?
- Should I run two replicas of a policy on one GPU?
- How do I use the inference components with openpi, LeRobot or GR00T?
slack: scheduling by the slack an action chunk leaves
- Network layer
- How do I serve a robot policy from my own GPU?
- How do I run a template on my own GPU?
- How do I run π0 (openpi) on a remote GPU?
- How do I reduce the latency of LeRobot remote inference?
- Why does my robot's upload get slow after a pause?
- How do I measure the link between my robot and my GPU?
- How do I keep a WebSocket policy server's connection warm?
- What do the network components save, measured with the tools in this repository?
- How do the components compare with openpi's remote inference and LeRobot's?
- What does each network component do?
- Language models
- A GPU near your robot
- FAQ: errors you may see, and what to do next
llms.txt is a map of the repository for a coding assistant, and llms-full.txt is
this README and every page of docs/ in one file.
Every number in this README is given with the model, the GPU or the link it was measured on, and
Measurements lists the command behind each of the network layer's. What a network component saves depends on the
link, so bench/ measures yours before you add anything. Each module's docstring states what the component
does in one sentence, why, and what was measured.
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 toolsThe 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 has what that means for a pull request.
Questions and ideas go to Discussions. Issues and pull requests are welcome: see CONTRIBUTING.md and the Code of Conduct. To report a security problem, see SECURITY.md.
If you use SequenceLink in research, please cite it:
@software{generalsequences2026sequenceai,
title = {SequenceLink},
author = {{General Sequences}},
year = {2026},
url = {https://github.com/General-Sequences/sequence-ai}
}CITATION.cff has the same, with the version.
Apache-2.0. Copyright 2026 General Sequences Company. Parts of five components and one example are adapted from three other projects: THIRD_PARTY_NOTICES.md.