Skip to content
How it works

How it works

A machine is a Firecracker microVM, on a host in the region. space-env talks to a socket in the machine, /run/space-env/api.sock (HTTP with JSON, so curl --unix-socket works too; see the socket API). vmagent, the platform’s agent in the machine, serves it:

  1. Services calls are answered by vmagent itself, in the machine.
  2. Everything else (messages, schedules, metadata, fork) becomes one call on a fresh virtual socket (vsock) connection to the host the machine runs on.
  3. The host knows which machine a vsock connection comes from. It stamps the call with that machine’s id and passes it to the region’s control plane, which answers within the machine’s project.

The connection is the identity. No key or token is stored in the machine, so there is nothing in it to steal or leak; a machine can’t claim to be another one.

Who a machine works for

The machine is the unit the platform knows: everyone in a machine is root and can use its socket, so the platform can’t and doesn’t tell users inside a machine apart. Two parties who need different rights need different machines.

Every machine records, once, when it is created:

  • created_by: a person (user:ID, a machine made in the portal or with space), another machine (vm:ID, a fork made with space-env fork) or operator.
  • on_behalf_of: the person the machine works for (user:ID). A fork gets its parent’s, so a whole tree of forks works for the person who created the first machine. The machine can’t change it.

space-env whoami prints both, the space/created_by and space/on_behalf_of metadata carry them (with the creating machine by name), and the portal shows them with the person’s name. In the machine they are ids only: no names or email addresses go into the machine. Machines created before this was recorded show them as unknown.

Today this decides one thing: a machine may delete the machines it created (space-env forks delete), and nothing else. Who may message whom, and how many forks a machine may start, will build on it.

What a machine may do

A machine holds grants: messages, machines (fork), resize_self (resize itself), schedules, meta.read, meta.write, artifacts, shares, buckets, secrets.read, secrets.list, secrets.capture, credentials.request, tools, agents, web_portal, topics, and a few the platform will check later (idle, egress, model_gateway, acp, git, browser). By default a machine holds all of them. A machine limited to some is refused every other call with forbidden, whatever runs in it: the region checks, not the machine. identity (whoami) is always held, and space-env whoami prints the machine’s grants (all, or the list).

A fork holds its parent’s grants, and an agent’s subagent its supervisor’s, so a limited machine can’t get more by forking itself or starting an agent. For now the platform’s operators set grants; the portal and space follow.

Limits of the model

  • One machine, one identity. Anything that runs as root in the machine can use the socket, and so act as that machine: send messages in its name, schedule, publish metadata, fork it.
  • The project is the boundary. An organization has one or more projects, and every machine belongs to one. Any machine of a project can message, read the metadata of, and find any other machine of it; no machine can reach the machines of another project, even of its own organization: to it they don’t exist. A fork lands in its parent’s project, and a machine is created only from a checkpoint of its own project. Machine names stay unique in the organization, so a fork named like a machine of another project is refused, with the same answer as for a name taken in its own. The message budget (rate and inbox size) counts per project; other quotas are the organization’s. Beyond that, a machine can be limited to some kinds of calls (see “What a machine may do” below); who may message whom comes later.
  • Messages are data, not orders. What arrives is information from a colleague, which may be wrong or written by a confused agent. Agents should treat it that way (the agent instructions, space-env docs, say so), and you should not give a machine more access than you would give a colleague who can be talked into things.
  • Inside the platform, the trust boundary is still open. The region trusts the host’s stamp the way it trusts the host for everything else; the host’s control connection is not separately authenticated yet. This is known and scheduled work.
  • Not real time. Each call is a round trip to the region; a long receive waits on the platform, at most a minute per call (space-env repeats it). A machine that is suspended or moves cuts open calls; they fail with “temporary; try again”.
  • No secrets. Messages and metadata are stored in the region (messages until received or expired). Don’t put credentials in them.
Last updated on