Docs

What is on by default, and how do I turn each part off?

Everything on this page is on as soon as the GPU runs seq serve and the robot runs sequence_ai.connect(url): nothing needs to be added. The last column of each table is how to change a part.

shell
seq serve                                                  # on the GPU, in the policy's folder
python
policy_user = sequence_ai.connect("http://YOUR_GPU:8000")  # on the robot

On the GPU: seq serve

PartWhat it does by defaultTo change it
The policy’s threadThe policy runs on one thread of its own, one call at a time. Acts that arrive meanwhile wait their turn, in order; pings and uploads are not held behind italways on
BatchingOff: one observation per call@seq.concurrent(sizes=[1, 2, 4, 8]) on @seq.infer: it takes the observations waiting, stacked, and returns a row for each
SeatsWith hz on @seq.policy: a robot is let in at its first act only where every robot let in is still answered in time; another robot’s act is refused 503, saying why@seq.policy without hz: off
AddressesEvery address of the machine: 0.0.0.0, and :: where it has IPv6seq serve --host 127.0.0.1: this machine only
The robot’s streamEach robot’s observations and acts on one WebSocket (GET /stream), each message answered as a request; X-Seq-Act-Formats names it on every responsealways on
ObservationsKept by episode, in order; a robot’s Video, Depth and Tactile items turned back into the arrays they were. One that did not come is asked for again, and the act waits for italways on
PingGET /ping is answered at once: 503 with Retry-After until the warm-up is done, then 200 with what the server is, as JSON (server, version, up_s, pid, policy, optimized)always on
IdentityX-Seq-Server: sequence-ai/<version> on every response, so a robot can tell seq serve from another program at its addressalways on
Warm-upWith @seq.sample, the policy runs on its first observation twice at each batch size, four times when it declares hz, before /ping says ready; GET /example hands it outleave out @seq.sample
InputsThe observation as the robot made it, numpy arrays as arrays, each the policy’s own to write intoalways on
Outputstorch tensors and JAX arrays are sent as numpy arrays (bfloat16 as float32), copied on the policy’s threadalways on
One writeEach response leaves the server in one writealways on
Server timeEach act’s answer says how long the server took (perf: handler_ms from the act’s last byte to its answer, inference_ms the policy call’s), so the robot does not count it as the link’salways on
RecordingThe last minute of the robots’ steps kept in memory, for a recorder to read as they come (GET /record, python -m sequence_ai.network.record)always on
TokenNone, unless $SEQ_SERVE_TOKEN is setseq serve --token …, or SEQ_SERVE_TOKEN=…: every request and every robot’s stream must carry Authorization: Bearer …
Idle connectionsKept open 5 minutesalways on
SizeA request’s body, or a message of a robot’s stream, up to 64 MBlimit=

On the robot: connect()

PartWhat it does by defaultTo change it
The streamEvery observation and act on one WebSocket to the server, kept open: each observation sent as it is made, each act naming how many came before italways on
VideoA sequence_ai.Video item goes as low-latency video (H.264), a keyframe every second and after anything lostalways on
PicturesA picture you did not mark (a numpy array H×W×3 of uint8, each side 32 pixels or more, under any key) goes as a video keyframe of its own, lossy, decoded alonepictures="exact": every byte as it is
Depth and touchA sequence_ai.Depth item goes losslessly; a sequence_ai.Tactile image as high-quality videoalways on
CompressionLarge arrays are compressed where that saves upload timealways on
Lost and refusedAn observation the server lost is sent again; one it refused is left out, and the video’s next frame is a keyframealways on
Pings when idleA ping on the stream after each 100 ms of idle time, from the first observation until 60 s after the last observation or actalways on
BBR and TCP keepaliveRequested on the stream’s socket, where the machine allows themalways on
Machine checksOn Linux, one warning when Wi-Fi power saving is on, and one when the machine restarts its window after a pausealways on
TokenNonetoken="…": sent as Authorization: Bearer … to a server started with one
Two uplinksOff: one stream, by the default routelines=["eth0", "wwan0"]: a stream by each interface, every observation and act on every line, the first answer used (how)

sequence_ai.connect(url, ...) opens the stream with every default, and takes token=, lines=, pictures= and timeout_s=.

Check what is on

shell
python -m sequence_ai.check http://YOUR_GPU:8000

Against the Quickstart’s server on a Mac, it printed:

output
sequence-ai check: http://127.0.0.1:8000

  ok  server              sequence-ai 0.66.0, pid 68489, up 9 s, policy QuickstartPolicy_user.infer_user, no speed-up on; it answers /ping with 200 and takes the robot's stream (x-seq-stream/3)
  ok  round trip          0.3 ms for a ping on a kept connection (median of 10); 0.0 ms for a TCP connect
  ok  send window         macOS keeps a connection's send window through pauses
  --  BBR                 macOS has no BBR, and needs none for the window
  --  Wi-Fi power saving  not checked: macOS gives nothing to read it from; this machine's requests go over Wi-Fi (en0), and a wired connection takes the question away
  ok  pings when idle     connect() pings after each 100.0 ms of idle time, and the server answers /ping with 200: the pings go on the robot's stream, from its first observation until 60 s after its last observation or act, and keep the connection, and the Wi-Fi radio, from going idle
  ok  pings in inference  answered while the model ran: 0.4 ms against 0.3 ms idle (3 pings in 3 acts)
  ok  server time         the server says it took 0.3 ms of a 1.7 ms act: 1.4 ms outside it, on the network and in this machine
  ok  first act           108.3 ms, the next ones 1.7 ms (observation from GET /example)

A no line says what is off and why. It takes --token for a server started with one, and --observation FILE for a server that hands out no example. It exits 0 when no line says no.

Why each part is on

  • Video, and a keyframe for a picture. A camera’s frames sent as video carry what changed: on our test scene, a 640×480 camera with a textured background and three moving discs, about 2.5 KB a frame against 921,600 bytes as an array. A picture you did not mark goes as a keyframe of its own, about 24 KB a frame there, decoded with nothing before it, so a policy asked once a frame, whatever the gaps between frames, reads each as it was sent. Only H×W×3 uint8 arrays are sent this way: a depth map or a mask goes as it is. A policy that needs its pictures’ exact values is reached with pictures="exact".
  • Pings. Linux restarts an idle connection’s window, and the next upload then takes extra round trips: Why does my robot’s upload get slow after a pause? A ping on the stream is a WebSocket control frame: the server’s WebSocket answers it on its own, and an act never waits for its answer.
  • The policy’s own thread. A forward pass takes tens of milliseconds, and on the server’s event loop it would hold every ping and every upload for as long. With a 200 ms stand-in model and two robots, a ping’s p50 was 153 ms with the model on the event loop and 1.0 ms with it on its own thread. It does not make a robot’s act faster: with one policy, acts wait their turn either way (p50 316 ms against 320 ms in the same test). What serves several robots sooner is batching. CUDA and JAX keep state per thread, so the policy always runs on the same one.
  • Server time. Without it, a slow model looks like a slow link to the robot.
  • One write. Behind a tunnel, a response written in two pieces took a round trip more: one_write.py.
  • Batching is off because it changes what the policy is called with: a list instead of one observation. Turned on, it lets one forward pass serve several robots: one policy took 68.1 ms at batch 1 and 39.6 ms per sample at batch 16 on one GPU (batcher.py), and How many robots can one GPU serve? has what that gains in robots.

See also