Docs

Deploy

seq deploy

Deploy the decorated class. The command returns once its version has passed its check, and the line it prints then, ready:, says robots can connect. A version is checked on a machine of its own, which builds the policy’s image, loads the policy and plays its sample episode (@seq.sample); once the check passes, that machine stays on as the version’s first worker, and a robot that connects is seated on it at once. A new worker loads the image the check saved and fetches the weights first: about 4 minutes for a small policy, longer for one with an image and weights the size of pi05-libero’s, and before that it waits for a card, which can take more than 10 minutes. A worker with no robot connected ends after its idle timeout, and the next robot starts on a new machine, a cold start each time. For robots that must not wait for a start, min_workers and buffer_workers keep workers running (Scaling), each billed as any worker while it runs. The version’s image is built on the machine you declare for it, the one its check runs on, and billed at its card from the moment that machine starts (its boot, the image built on it and the check), passed or failed. Before it, a machine of its own prepares the build’s files, billed by the second at the CPU and memory price: a line of its own on the bill (Build CPU time, Build memory). A worker that has ended is not billed. Each time a worker starts, it is billed from the moment its machine has its card (the wait for one is not billed), its start included (What keeping a deployment costs). So a deploy needs room to spend: at your plan’s monthly limit or a contract’s credit line, with your credits used up and no payment method on the account, or with its key’s credit limit used up, it is refused with 402 insufficient_credit before anything starts. seq policy status <name> --wait waits until robots can connect.

deployshell
seq deploy my_folder_user --name my_policy_user --gpu L4      # the folder my_folder_user, its @seq.policy class deployed as my_policy_user
# returns once it passed its check on its first worker, which serves from then on:
#   ready: my_policy_user v1 is deployed — connect with sequence_ai.connect('my_policy_user')
seq policy status my_policy_user --wait     # returns once robots can connect: addressable as model="my_policy_user"

seq deploy my_folder_user --gpu L4 --dry-run         # check and price it, nothing built: the card per hour, the warm floor, use per day and month
seq policy logs my_policy_user --build      # the newest version's build: each phase's time and its full log

While it builds, seq deploy shows each build step as it begins (the code, the weights, the wait for a machine, the image, the load, the act and saving the image) and every line the build writes under it. The build log (seq policy logs <name> --build, and the console’s Logs tab) names the files the upload took (the first 40 by path with their sizes, the rest counted) and what your .seqignore names; and where the weights come from (your volume, a Hugging Face repo at its commit, or an official template) with how much of them is copied, how fast, and about how long is left. A deploy of a name that already exists builds a new version beside the serving one. See Versions and traffic.

What its declarations make of it. Before anything is built, seq deploy and its --dry-run say it a line a part: whose its episodes are, what its build check acts on, and how many robots a copy seats. A policy whose infer batches (@seq.concurrent) is timed on its sample episode (@seq.sample), which it needs: seq deploy refuses one without it, saying to add it.

Names. A deployment’s name is what robots connect to, and it is your account’s own: another account may give a deployment of its own the same name, and it is never yours. Without name= or --name it is the class name, lower-case with hyphens: ToyReacher deploys as toy-reacher; seq init <template> without a directory names it after the template (toy-policy). A name is 1 to 64 letters, digits, _ or -, starting with a letter or digit; a name another account already uses is made yours with a 9-character mark after it, so one of those is refused past 55 characters. Give every policy robots connect to a name= of its own. Deploying the same class to its name again is a new version; deploying another class to a name you already use is refused unless you add --override. Its robots then switch to the new policy once it builds, and the version it replaces is deleted for good once its workers have ended. Without --override, every earlier version is kept. seq deploy --dry-run says which it would be before anything is sent. In a folder of several classes (a benchmark’s GPU and CPU entries, say) --name picks one by its name= (or its class name), and that is its name; without it, the deploy is refused, listing them.

Which version of a template. seq init <template> writes the template’s current version, and @vN after the name an exact one, each with a warning when your sequence-ai cannot deploy it. seq init --list shows each template’s current version.

What a deploy uploads

seq deploy [folder] (this one, ., by default) uploads the folder, whole (its helpers, configs and third_party/ with it) and that snapshot is the version’s code: nothing of an earlier version is kept. The class it deploys is found by reading the folder’s files: its one @seq.policy, @seq.benchmark or @seq.adapter class (an adapter beside a policy or a benchmark is not the one); of several, --name picks one. Its file is then imported here, on your machine, as it is on the platform, so what the file imports at its top (torch and the like) must be installed where you run seq deploy, --dry-run too: by its path in the folder (policy/OpenWAM/model.py is policy.OpenWAM.model), the folder first on sys.path and the class’s own folder second, as running its file would, and a module the folder’s code imports from outside the folder is refused, with the ways to bring it in.

Left out, and named in the output: version control and caches anywhere; a symbolic link anywhere (copy what it points to into the folder); a virtualenv or a build’s output at the folder’s root (.venv/, venv/, env/, build/, dist/, node_modules/, *.egg-info); the build-context/ at the folder’s root, where seq policy source and seq benchmark source put a version’s Dockerfile context, so a downloaded version deploys again as it is; a .env file (secrets go through seq secret, and a !.env line uploads it); and what a .seqignore lists, one in any folder, for that folder down, in gitignore’s form: a path from its folder (third_party/openpi/docs), a name at any depth (data), * and **, a trailing / for folders only, and ! to take back what a line before it left out.

The deploy prints how many files, how large, and their tree sha256: the hash the platform keeps beside the version, which seq policy source checks what it downloads against; the code column of Versions on the policy’s page in the console shows how many files and how large. The code a deploy uploads is at most 8 MiB compressed; a folder over 64 MiB is refused before it is sent, naming its largest paths and how to leave them out with .seqignore. Weights go through weights=, not the code: a checkpoint left in the folder is uploaded with it like any other file, within those limits. Leave it out with .seqignore.

you changeddeploy again, and
policy.py, a helper, a config, any file in the folderthe new version has the folder’s files as they are now, every one of them, and nothing of the version before
a template’s third_party/<upstream>the image installs from your copy: your deployment runs your version of it
an upstream listed in third_party/SOURCES.json (LIBERO, robosuite)the deploy is refused: a large upstream runs as published for now
the weightsnothing of them is uploaded with the code: they come from where weights= says

A template’s third_party/ is the source its image installs. An upstream too large to upload with a deploy is listed in third_party/SOURCES.json: seq init downloads its official package there and checks it (seq init --no-source leaves it out), and the image installs that same package by its sha256.

What a deploy measures

Before a version serves, its build check starts one worker and plays the policy’s sample episode (@seq.sample) on it at the policy’s hz, as one robot would; a policy that marks none is loaded but not acted on. From that run seq deploy and seq policy status report the same three things; the console’s deployment page shows its card’s price beside its running workers. seq deploy reports them for the version it made, which may not serve yet. The other two report the version that serves:

  • One copy’s GPU memory: the most the model’s framework held at once (JAX’s own peak, or PyTorch’s), plus what the process holds outside it. A JAX model alone on a card takes 75% of the card as it starts, so the card’s own figure shows that pool, not what the model needs.
  • Whether the copy fits on the card, given 10% more than it measured. A worker runs one copy of the model on each card, and copies never share one: two policy copies on an L4, each a process of its own, took nearly twice as long per act when both acted (442 ms against 210 ms alone) and a 15 Hz robot executing 8 steps of each chunk ran dry. To serve several robots from one copy, list the batch sizes your model is built for, @seq.concurrent(sizes=[1, 2, 4, 8]), on the @seq.infer method (Batching requests). A copy that runs out of GPU memory as it loads fails the deploy with what it measured; declare a card with more memory; one that loads but leaves less than a tenth of what it measured free is said not to fit, and still serves. The card is the deployment’s one card (which GPU a worker gets).
  • What a worker is billed per hour, as the price list has it: its card’s price, and its machine’s cores and GiB, each at the serving rate for CPU and memory (on Pricing), the size its card sets, one wherever it runs, or what it declares where that is more, whatever it uses.
  • Host memory a load can outgrow: loading a policy can briefly take more host memory than its weights hold on disk (a model read in full precision and then cast down, say). A worker that runs out of host memory while it loads never becomes ready, and each of its starts is billed as any start: the robot waiting on it is told the worker ran out of memory while it started, with the --memory to deploy it with, and seq policy status <name> names it as the last failure. seq deploy --dry-run reminds you when the --memory you ask for is below your weights’ size. Raise it above that; the platform does not refuse the deploy for it.

seq deploy <folder> --dry-run checks a deploy without building it and says what its workers are billed: its card’s price an hour, and the cores and GiB of the machine its card sets, at the serving rates for CPU and memory. For a policy deployed before, it shows too whether its copy fits on each card. The card the build check ran on is measured; the others are estimated from their size.

A worker of several cards runs a copy on each card when it is deployed so (seq deploy <folder> --gpu L4:2 --gpus-per-replica 1), and starts them all at once. Their loads’ peaks of host memory land together: two policy copies loading at once took 34 GB, and 14 GB once serving. --replica-start one_by_one starts each after the one before is serving, for a model whose copies’ load peaks would not fit in host memory at once: a worker with a memory limit (seq policy set <name> memory_limit=N) that starts many copies together can be stopped for running out of memory at that peak. Start them one by one then. Each copy holds its own host memory; deploy with --memory for all of them.

What keeping a deployment costs

Workers are billed by the second from the moment each one’s machine starts (has its GPU, for a worker with one), its start included; the wait for a GPU is not billed, and each time one comes up, its GPU is billed for at least 60 seconds. A worker whose machine goes away is billed up to when it was last heard from, not to when the platform noticed. A start that ends before its worker is up is billed by the second, with no minimum, when it ends for the deployment’s own reason (its startup time running out, its code failing, a stop, a delete, its budget or its GPU cap) and not when the platform ends it, but for one: a worker runs on the closest GPU available, and another start that got a card for it is billed from that card until it ended (extra in seq usage --group kind). The first worker’s start is also its version’s check (seq deploy): once it passes, that machine stays on and serves, its model already loaded, billed as a worker from the end of its check. It first saves the version’s image for its next machines, usually a minute or two, longer for a large image and an hour at most; then with no robot connected it ends after its idle timeout, 60 seconds unless set (Scaling). It is billed until it ends as any worker is: for a policy template on an L4, its card at $0.80 an hour, and its machine’s CPU and memory at the serving rates; seq policy stop ends it sooner. What the platform keeps for a deployment is billed for as long as the deployment exists, whether or not a worker runs: its copy of its weights, made when it deploys and kept once however many of its versions use those same weights, and the image each version it keeps saved for its new machines (deps in seq volume ls), at $0.12 per GB a month, counted every day. Saving a version’s image there is billed once, as it deploys: what leaves the machine its check ran on, at what that machine’s cloud charges for it, by where the check ran (Pricing has the range per GB), passed through at cost. Only what is not stored yet is sent, often far less than the image, so a version that changes a little of the last sends a little. Deleting a deployment deletes its images with it, and their billing stops. seq volume show deps lists each image with the versions it is for and its size. Weights of your own the size of a policy’s, about 12.4 GB, come to about $1.49 a month while the deployment is kept. A deployment of an official template with its code unchanged keeps no copy of its weights (it reads the platform’s copy of every part, which is not billed), so only its image is. Change any of the template’s code and the deployment keeps a copy of its own, billed as weights of your own are. Volumes you upload are billed the same way. seq deploy --dry-run says what a policy’s come to before it is built, seq gpus the price, and so does Pricing.

Everything you keep counts toward one storage limit: weights and their copies, saved images and version dependencies, volumes, captured data and eval recordings. It is your plan’s (200 GB on Starter, 1.5 TB on Team) until you set your own, any size, on your Account page or with seq account set --storage-limit 500GB (plan puts back your plan’s); either way you pay for what you store, by the GB. From 80% of it, seq account, seq storage and the commands that store something say how full it is. At the limit nothing new is stored, and what you keep stays: seq volume put and a deploy whose weights need a copy of their own are refused when they would go past it, before anything is sent; an eval runs without its 3D replays and records; and a new version’s image is not saved, so its machines build it as they start, which takes longer. Raise the limit, or delete something, and storing starts again.

Beside that one limit, a few sizes are technical, set by how a thing travels or is held, not by how much you may keep: one upload, or one copy of weights from the Hub, lists at most 10 000 files; the code a deploy uploads is at most 8 MiB compressed; a benchmark’s 3D scene is at most 256 MiB; one episode’s 3D replay is at most 16 MiB, a longer one keeping every few frames; and a worker holds at most 32 MiB of its robots’ newest steps, for all of them together, for your own recorder (Your own recorder).

The dry run prices a worker by the hour while robots use it, as no use of a policy is known before it runs: the robots a worker seats (as many as its deployed version’s check measured, else one a copy) and what more robots add, the spares beside them while robots are connected, the idle minutes after each use and each start, and its warm floor around the clock, a day and a month. In the example, my_policy_user is your policy’s folder.

price itshell
seq deploy my_policy_user --gpu L4 --dry-run   # a worker by the hour, the robots it seats, its warm floor a day and a month

seq policy rm <name> says first what goes with it (--dry-run says it alone), then deletes it for good: nothing can bring it back. Its workers and its storage billing stop at once, and what it kept goes within minutes, apart from the field data it captured, which is never deleted with it: that stays yours as a dataset, billed as storage until you delete it (What was kept before).

Which GPU a worker gets

--gpu names one card, and every worker of the deployment runs on it: with seq deploy <folder> --gpu L4 each worker starts on an L4 and never on another card. When no L4 is available, a worker’s start waits for one (the platform’s wait, the same for every policy), which can take more than 10 minutes. The robot keeps waiting, and the wait for a card is not billed. Any other card held for it while its worker started is billed for the seconds it was held, as an extra start on your usage. A robot every place turns away at once waits in line for the card, and past 10 minutes in line it is told which card (503, reason gpu_low_stock, with gpu). A deploy names its card: deploy again with another --gpu, or change it with seq policy set <name> gpu=, to run on another. Its max GPUs and your account’s GPU limit bound how many GPUs it holds at once.

seq policy status names the card, with one worker’s price per hour and the workers on it now, and whose card it is: your policy’s own, a template’s own, or one you chose in place of the template’s (with the template’s beside it, its current version’s); then what a start’s wait for it can take, and the most GPUs it holds at once. The policy’s page in the console shows the card, its own price per hour and the workers on it now (max GPUs is under Settings), and the console’s Deploy dialog shows a template’s card before you deploy.

Regions

A robot’s worker starts on the closest GPU available to the robot, by the public IP address its connect comes from; a worker started before any robot connects (min_workers) starts nearest where the policy was deployed from. The address is read at every connect: a robot that moves plays the episode it is in where it is and moves at its next episode boundary to a worker in the region it is nearest now, one started there first when none has a seat. Behind a VPN, a proxy or one address shared by several sites, the address is where that network meets the internet, not where the robot is. The regions are the platform’s own, seven across the US, each a metro, never a provider’s region. The price of a card is the same in every region.

An eval’s machines run wherever a card is available. Addresses are placed with IP Geolocation by DB-IP.

Control plane, data plane

A call is two phases: the first call after connect(), which itself sends nothing, goes through the gateway and gets the worker’s address, a pinned certificate, a short-lived secret and a lease; every act() then connects directly to the worker. Beside the acts, sequence-ai keeps the robot’s seat from a thread of its own (a keepalive to the gateway about every 20 seconds, and the lease renewed before it runs out), which no act waits on.

phasereachespurpose
the first call after connect(model)the gateway, at the first calladmit, ensure a worker is up, return its address, cert, secret and lease
act(...)the worker, directlyrun inference on a reused connection; the gateway is not in this path
reconnectthe gateway, on demandon a rotated secret, expired lease or scaled-to-zero worker, fetch fresh coordinates and replay, transparently

You do not handle the 401/503 yourself: a rotated secret, expired lease, or worker that scaled to zero surfaces as a transparent reconnect, and the in-flight call is replayed, never one its worker is still running (see how long an act waits).

Scaling

A worker stays up while a robot is connected to it, whether or not that robot acts, with no limit, and is billed as it runs: a robot can stay connected to several policies and act on one at a time, each answering the moment it is asked, each billed as its own. Close a connection you no longer need. Once its last robot disconnects, a worker ends after its idle timeout, 60 seconds unless you set the deployment’s idle_timeout, from 2 seconds to 20 minutes, live with no redeploy (seq policy set <name> idle_timeout=300, or Settings on the policy’s page in the console), and is billed until it ends: a worker waiting out its idle timeout is billed as one that serves. A robot disconnects when it closes, or about a minute after its process dies. A worker can end up to about a minute after its idle timeout runs out, and that time is billed too. A robot that comes back after that starts on a new machine, a cold start every time. It starts its image, loads the weights and warms (a pi05-class policy: several minutes); the first call after connect() warms it, so wait it out before you drive it (see warming).

A deployment grows as robots connect, up to max_gpus (seq deploy --max-gpus, one worker’s cards unless you set it): the most GPUs it may hold at once, and seq deploy prints what all of them cost per hour busy. How many robots each worker seats is the policy’s own (seq policy status <name> shows its seats). Each robot joins a worker with a seat for it, the closest available: the nearest first and then the least busy, with @seq.concurrent(sizes=[...]), as many robots a copy as the largest listed size it answers on time, each robot’s round trip counted, while, run together on a simulated clock, every answer is in time however their acts fall and their batches fill at most 90% of the time between a robot’s asks, as the worker measures it (Batching requests); one a copy without it, and keeps it across its lease renewals; when every worker is full another starts. A robot waiting for that start takes the first seat that frees on a running worker instead, if one frees first, and the start it no longer needs goes on: once up, it ends a minute later with no robot on it, billed until then. A robot is never crowded onto a full worker: when no worker has room and none may start, it waits in line before its control loop begins, up to 2 minutes, and takes the next slot that frees. A robot that closes its connection, or whose process ends, frees its slot at once; one whose process is killed or loses its network frees it within a minute. min_workers=N keeps N workers running even with no robot connected, and buffer_workers=N keeps N idle beside the busy ones while robots are connected (a missing one is started at once, one at a time, and is up in about 4 minutes or more; with none connected none is kept, so the first robot after a quiet spell waits for one unless min_workers keeps a worker running), so a robot that connects beside others never waits for a cold start; they are billed from their machine’s start until they end. Each robot also holds a connection to one of them: when its worker cannot be reached, its act goes there at once and its episode goes on from its state saved a few seconds before (A standby copy). seq policy set <name> min_workers=1 max_gpus=4 changes these live, with no redeploy, max GPUs also in Settings on the policy’s page in the console; seq policy status <name> shows each worker’s robots and the line.

Two waits. A robot waits for a slot or for a card, both the platform’s waits. In line it waits up to 2 minutes while the deployment holds its max_gpus and every slot is taken, a wait you shorten by raising max_gpus. A worker’s start waits for an available card of the deployment’s type, which can take more than 10 minutes, the robot waiting and nothing billed. A seat that frees on a running worker meanwhile ends the wait: the robot takes it. A robot every place turns away at once waits in line for the card, and past 10 minutes in line it is told which card and how long it waited; it is never moved to another card.

How long a worker serves. A worker is replaced about once a day: after 23 hours, ahead of the platform’s end of every worker at 23 h 50 min. Its replacement starts beside it (at your deployment’s cap too, as the one worker more than max_gpus, billed like any worker, for up to 45 minutes) and each of its robots moves to the replacement at the end of its current episode: sequence-ai does this by itself, so no episode is cut and no start is waited out (a client of your own that does not ask to move stays until the latest time it was told, and is moved at its first lease renewal after it). Only a robot moving off the worker being replaced sits on that one worker past the cap; a robot that connects meanwhile is held to max_gpus. Whatever you do while two run (seq policy stop, a lower max_gpus, min_workers=0), neither is kept for it: a stop ends both, the others end at once the one no robot is on, and a replacement no robot has taken is billed up to its end. A worker with a robot mid-episode on it, or two robots that never end episodes together, keeps them until 5 minutes before its forced end, waiting for such a moment. Until it is replaced, a robot that connects starts on it and moves with the others. Each robot is told why it will move and the latest it is moved by within 20 seconds of its worker beginning to leave, by its seat’s keepalive, and moves at the end of its current episode, or, while no worker has a place for it yet (the replacement still starting), at the end of the first episode after one has. When that worker is up within 15 seconds of an episode’s end, the next episode waits for it, 20 seconds at most, rather than start on the worker the robot leaves. sequence-ai says why it moves once, in one [sequences] line on stderr, and says why when a move cuts an episode. seq policy status <name> says how your deployment’s workers are replaced and when the next one is. Your account’s GPU limit counts every worker, so a replacement starts beside a worker only while your account has a GPU available; with none, its robots move just before the worker’s forced end. A worker that stops answering is replaced at once. An act the policy is stuck in is cut short long before its timeout: once it has run 10 times as long as its copy usually takes for a batch of that size, and at least 10 seconds, it is answered copy_stuck, the copy is started again on the same worker and its robots move (A standby copy). An act still running at your deployment’s request timeout (5 minutes, or 10 times its check’s slowest p95 where that is longer, up to an hour) is answered with a timeout; if it is still running one timeout later, the copy running it is ended and a fresh copy starts on the same worker (seq policy logs says the copy stopped: an act ran far past its time limit), and a worker even that does not free is replaced (12 minutes after the act came in, at the default). A worker still running 23 h 50 min after it started is ended whatever it is doing, the last line of defence. Rarely, the provider ends a GPU machine under its robots; they reconnect to another worker, through a cold start unless one is kept warm. For robots that must not wait, seq policy set <name> buffer_workers=1 keeps one spare while robots are connected. seq policy status <name> shows how long each worker has served and when it is replaced.

One machine per worker

For now a worker runs on one machine: at most 8 cards, --gpu H100:8. A model across several machines is not available yet: a deploy, upgrade, rollback or eval that asks for more than 8 cards per worker is refused, and says so. For more robots, raise max_gpus: more workers, each on a machine of its own.

Versions and traffic

Every deploy of a name is a new version. It builds beside the serving one, which keeps serving until the new version is ready, and keeps serving if the new one fails. A new version is checked on an available GPU of the deployment’s cap, and while it is checked that GPU is one of the deployment’s: a robot that connects then and finds every serving worker busy waits in line, as it does at the cap. When the version that runs holds all of them, it is checked on one GPU more than max_gpus, billed like any worker, the one worker past the cap a replacement takes (how long a worker serves), and while it is checked, a worker due to be replaced waits for it (up to 22.5 minutes) rather than start a second one past the cap. While a worker is being replaced beside a new one, that place is taken, and the deploy is refused until the replacement has taken over, a few minutes. A new version is checked on a machine of its own, and robots go on to the version before it until it is ready. A new version that fails its check never serves, and the version before it keeps serving. Every earlier version is kept until you delete it, so seq policy rollback, or Roll back on a version in Versions on the policy’s page in the console, makes one serve again from that moment, with nothing rebuilt: the robots on the version it replaces are disconnected, as a new version’s are, and the first to connect again starts a worker of it when none is running (a cold start). A rollback drops a version still building. seq policy rm my_policy_user@v2 (or Delete on a version) deletes one version for good once its workers have ended; the policy and its other versions stay, and the version that serves cannot be deleted alone. seq deploy --override deletes the version it replaces once the new one has passed its check and serves; if the new one fails, nothing is deleted.

versions and rollbackshell
seq policy versions my_policy_user           # building / serving / kept until you delete them
seq policy rollback my_policy_user@v4
seq policy rm my_policy_user@v2              # that version alone, for good
seq deploy . --override                      # replace the version serving: it goes once this one serves

A policy serves one version at a time. The moment a new version starts serving, a rollback too, every worker of any other version ends and the robots on it are disconnected, mid-episode too: nothing moves them and no worker is started for them, so two versions are never billed side by side. A robot is not taken to the new version: within 20 seconds it says why in a [sequences] line on stderr, and its next call raises NewVersion, the connection over and an episode it had open ended there. An act sent as the machine stops waits for its answer as long as an act may, and raises the same. connect() again reaches the version that serves, at once while the machine that version’s check passed on is still up as its first worker; otherwise it waits for a worker to start. Until then it holds no worker and is billed nothing. To try a version on some robots first, deploy it as another policy and put it on those robots’ lists (Robots).

A new version keeps the deployment’s settings as they are when it takes over: its max GPUs, warm floor and buffer, every other setting changed with seq policy set, and the machine’s own (gpu, cpu, memory, replica_start) where the deploy does not name them. Deployed again with no --max-gpus, a deployment with a cap of 8 keeps 8; with no --gpu, it keeps its card. seq deploy says what it kept, and so does its --dry-run. Change the settings with seq policy set; a rollback keeps them too.

The code a version runs

Each version keeps the code its deploy sent, exactly as the platform received it. Download it with seq policy source <name> (the version serving, or <name>@vN) or with a version’s Download in Versions on its page in the console. You get the files of its code as they deployed and, when its image was built from a Dockerfile, that build’s context under build-context/; each is checked against what the version deployed before it is sent, and seq policy source checks the files it unpacks against the version’s tree sha256 (What a deploy uploads). A version whose code was not kept says so, and its Download is greyed out.

get the code a version runsshell
seq policy source my_policy_user                # the version serving, into ./my_policy_user-v3
seq policy source my_policy_user@v2 -o v2    # v2's files, into ./v2

Debugging

You can open a terminal on the machines your code runs on, and stop at a breakpoint() on a machine set up exactly as your workers are.

A terminal in a running worker. seq policy shell <name> opens a shell in a worker serving your deployment now (--worker a0012 picks one), and seq policy shell <name> -- python runs a command in a terminal there: python, top and pdb all work. It runs as your policy’s code does there, with the same image, files and card, and none of the platform’s secrets nor your own. Your keys reach it as you type them, Ctrl-C included, its window follows yours, and seq exits with its exit code. A dropped connection comes back by itself within a minute. The terminal ends when you leave it or when the worker ends. Where stdin or stdout is no terminal, as in a script, a pipe or > out.txt, a command after -- runs once instead, prints its output and stops at its time limit (30 s, or up to 120 s with --timeout).

Breakpoints. seq policy debug <name> opens a machine of its own on the version your deployment serves, with the same image, card, files and settings, and sends no robot to it. Your policy loads there as a worker loads it, and its constructor’s output shows in your terminal. Then its @seq.sample episode plays as the build check plays it, with each act’s time printed, or an episode its field data kept, with --episode ID. Any breakpoint() in your code, in the constructor or in @seq.infer alike, opens pdb in your terminal. Ctrl-C does not stop your policy there: in pdb, c goes on and q quits. Once the episode is over, you get a terminal on that machine. While the machine opens, seq says what it waits for. A policy with no @seq.sample and no --episode loads, says it has nothing to play, and gives you the terminal.

A breakpoint() in your code does nothing in the build’s check or on a serving worker, so a version with one builds and serves as usual; it stops only on the machine seq policy debug opens. Each seq policy debug starts your policy again and plays its episode from the start, on the machine still up from the last one if there is one. A terminal opened while another terminal’s policy is still running gets a shell instead, and says why. The machine plays the episode it was opened with each time: to play another, end it with --stop first.

A benchmark’s machine. seq benchmark shell <name> opens a terminal on a machine of the benchmark’s newest version, on its card, as a command after -- runs on one.

a terminal, and a breakpointshell
seq policy shell my_policy_user                    # a shell in a worker serving now
seq policy debug my_policy_user                    # plays its sample; a breakpoint() stops in your terminal
seq policy debug my_policy_user --episode ep_user  # an episode its field data kept, in place of its sample
seq policy debug my_policy_user --stop             # ends its debug machine now
seq benchmark shell my_benchmark_user              # a terminal on a machine of its newest version
it endsit is billed
seq policy shellwhen you leave it, or when its worker endsit opens no machine: the worker is billed as it serves
seq policy debug10 minutes after you leave it (the next seq policy debug plays again on it), at --stop, or after an hourby its card, or its CPU and memory where it has none, from its first second to its end
seq benchmark shell10 minutes after your last command or terminal, at --stop, or after an hourby its card, or its CPU and memory where it has none, from its first second to its end

seq usage and Billing list the debug and benchmark machines as shells. A terminal opens from macOS or Linux; on Windows, a command after -- runs once.

Upgrade a template deployment

A deployment made from an official template knows which version of the template it runs: seq policy status and seq policy versions say it (“template toy-policy v13”), with the template’s current version when it is newer, and what it brings, and so does its page in the console. Once you edit the code seq init wrote, the deployment is no version of the template: they name the template its folder came from (“template toy-policy v3 (edited)”), with no upgrade to offer. When the platform cannot deploy the template’s current version, the newer version is the newest one it can deploy instead, and both say which and why; a deploy from the console’s template cards gives the same version. A version you name with --to <template>@vN that the platform cannot deploy is refused, naming one it can. seq policy upgrade <name> (or the page’s Upgrade) deploys the newer version as the deployment’s next one: built beside the serving version, taking over when it is ready, the old one kept for seq policy rollback. What you changed of the old version stays yours (your checkpoint, cards, CPU or memory); what you never touched follows the template. It keeps the name, the robots that list it, scaling, monthly budget, alerts and parameters. Before anything is built it says what changes, what stays and, when it changes, one worker’s price an hour before and after; --dry-run says only that. Code you changed after seq init is yours, and no upgrade is offered for it: deploy it with seq deploy. A benchmark registered from a template moves the same way, with seq benchmark upgrade <name>; until its new version passes its check, evals run its latest version that passed its check. On either, --to <template>@vN names any published version of its template. What each version changed and what it needs is on the template’s update page, in the template library.

move to the template's newer versionshell
seq policy status my_policy_user             # template  toy-policy v13 · toy-policy v14 is available: ...
seq policy upgrade my_policy_user --dry-run  # what changes, what stays, the price before and after
seq policy upgrade my_policy_user            # v2 builds beside v1 and takes over when ready
seq policy rollback my_policy_user           # back to v1, nothing rebuilt

Budgets, alerts and warm hours

run a deployment on a budget and a scheduleshell
seq policy set my_policy_user budget.monthly_usd=300  # USD this month; budget.monthly_usd= removes it
seq policy set my_policy_user schedule.hours="Mon-Fri 08:00-18:00" schedule.min_workers=1 schedule.tz=America/Los_Angeles
seq policy set my_policy_user alerts.webhook=https://ops.example.com/seq
  • Budget. Within minutes of this month’s spend reaching it, the deployment is stopped: its workers end and a connect is refused with 402 budget_exhausted. Starting it again (seq policy start, or Start on its page in the console) stays refused until you raise the budget or remove it.
  • Warm hours. schedule.hours takes days and a time span (Mon-Fri, Sat,Sun, daily 22:00-06:00) in schedule.tz (UTC by default). In those hours at least schedule.min_workers workers run with no robot connected. They start before the hours, by the time your deployment’s workers take to come up, so they serve as the hours open, and they are billed while they run, from that start; after the hours the deployment scales to zero as usual. schedule.hours= removes the schedule.
  • Alerts. The platform posts JSON (deployment, kind, detail, at) to your https webhook when an hour’s error rate reaches twice its last 7 days’ and 5 points over it, or its p95 latency twice theirs, each over at least 20 acts (error_rate, latency), when spend reaches 80% of the budget and the budget itself (budget_threshold, budget_reached), when a new version fails to build (deploy_failed), and when the deployment reaches half of its max_gpus (gpu_ceiling_near) or a robot finds it full and waits or is refused (gpu_ceiling_reached). Each kind is sent at most once an hour, the budget kinds once a month. Setting the webhook prints a secret once: each body is signed with it in X-Seq-Signature: sha256=<HMAC-SHA256 of the body>. The webhook must be https on a public address, and redirects are not followed.
  • Rate limit. Each API key may make 600 calls a minute to the gateway on Starter, 2,400 on Team; past that a call answers 429 with Retry-After. Acts sent directly to a worker are not counted, nor are the timings sequence-ai reports of them.

Budget, schedule and alerts are settings of the deployment, not of a version: a new deploy keeps them, and seq policy settings my_policy_user lists them with the rest.