---
title: "How Tato works"
description: "Projects, streams and graph documents; the three kinds of node; inputs, links and messages; sending an output to a MoQ relay; and the one runtime per machine that runs it all."
type: "docs-page"
url: "https://tatolab.com/docs/how-it-works"
site: "Tatolab"
section: "Start here"
---

# How Tato works

> Projects, streams and graph documents; the three kinds of node; inputs, links and messages; sending an output to a MoQ relay; and the one runtime per machine that runs it all.

## The short version

- **A project** is a folder. It holds `tatolab-project.json`, a `pyproject.toml`, your node code, and one graph document per stream in `streams/`.
- **A stream** is a composition: a graph of nodes and the wires between their pins, which you build in Tato Studio. It's saved as a graph document, `streams/<name>.graph.json`: its nodes, the values each one holds, and the links between their ports. Reading it runs no code.
- **A node** is one unit of a stream: a source, a step that transforms data, or a consumer. You write nodes in Python, as a class, a function or a Slang shader.
- **One runtime per machine**, `tatolabd`, opens projects, plays them, and runs every stream on the machine. Tato Studio, the `tatolab` CLI and agents all talk to it.
- **An output leaves its stream** only through nodes you add: the `tatolab.moq` gateway nodes send it to a MoQ relay, where other streams, other machines and any MoQ client read it.

## Projects and streams

```txt
my-show/
├── tatolab-project.json      the project's name, UUID and imports
├── pyproject.toml            the Python packages your nodes use
├── streams/
│   ├── main.graph.json       one stream
│   └── lobby.graph.json      another
└── nodes/
    └── crowd_counter.py      a node of your own
```

A project is the unit the runtime opens, plays and stops. Every graph document in it outside its hidden folders is loaded as its own stream, and the whole project plays, pauses and stops together; no verb stops one stream of it. An open project is recorded, so the runtime opens it again, playing or stopped as it was, each time it starts, until you close or remove it.

A stream is addressed by its **stream ID**, `<project>-<stream>-<hash>`, such as `my-show-main-3f2a9c`. The hash is over the project's UUID and the stream's, so the ID stays the same when the project moves or the document is renamed. A stream is shown under the `display_name` its document writes, or its file name.

Each change made through the runtime, from Studio, the CLI or an agent, is one transaction: applied to the running stream, saved to the graph document, and recorded as one commit on the project's own history in `.tatolab/history.git`, which undo walks back. A document you edit yourself is read again on the next reload.

A project can **import** another: the runtime copies it whole into `imports/<folder>/`, and its nodes and streams become this project's to use. The runtime links its core nodes into every project as `imports/core-nodes`.

## Nodes

There are three kinds of node, and a stream mixes them freely.

| Kind | You write | Where it runs |
|---|---|---|
| **Process node**, `@node.process` | A class with ports and lifecycle methods | In a process of its own, with its own Python interpreter started from your project's `.venv` |
| **Function node**, `@node.function` | A function whose signature is its inputs and outputs | Compiled to native code and evaluated where its result is read; no process of its own |
| **Shader node**, `@node.shader` | A Slang function from pictures and numbers to a picture | On the GPU, compiled by the runtime; no Python runs |

```python title="nodes/brighten.py"
from tatolab.stream import ImageFrame, node


@node.meta(category="Color", description="Brighten a picture.")
@node.shader(
    """
float4 Brighten(ImageInput image, float amount)
{
    return float4(image.pixel.rgb * amount, image.pixel.a);
}
"""
)
def Brighten(image: ImageFrame, amount: float = 1.5) -> ImageFrame: ...
```

A graph document names a node's type by its import path, `module:Name`: `nodes.brighten:Brighten` for the node above, `tatolab.camera:CameraSource` for one from an installed package, `imports/core-nodes/core_nodes.filters:Blur` for one from an import. There is no registration file and no build step: the runtime learns a node's ports by asking your project's interpreter to describe it.

![Every process node runs in its own process, so one that hangs or crashes is one node, named in the log, and the rest keep running.](https://tatolab.com/media/docs/isolation-light.jpg)

**Every process node runs in its own OS process.** A model that deadlocks, a C extension that segfaults, a library that leaks: each takes down one node, which the runtime restarts after a backoff and names in the graph and the log. The boundary is the kernel's, not a convention, and no mode runs a Python node inside the runtime's own process.

**The runtime ships no media nodes.** The camera, microphone, speaker, H.264, H.265 and Opus codecs, the virtual camera and the MoQ gateway are modules, packages built the way you'd build your own. The runtime's own built-ins only reshape data between families.

## Inputs, links and messages

A link joins one node's output to another's input, inside one stream. What crosses it is a **message** of one family:

| Family | Carries | Read as |
|---|---|---|
| `Image` | A picture, on the GPU | `ImageFrame` |
| `Array` | Named arrays or tensors | `ArrayFrame` |
| `Channels` | Audio and other sampled signals | `ChannelsBlock` |
| `Packets` | Encoded media, one unit per message | `PacketsUnit` |
| `Records` | Small structured values | `dict` |

Every input of every node has **one type**, which Tato Studio draws by its name and colour: a texture, audio, encoded video, a float, a colour, a menu, an asset and so on. An input with nothing wired into it holds **one value** of that type, saved in the graph document under the node's `input_values`, and a node's settings are values the same way. Studio shows a value on the node and edits it in place.

Every input says how it reads, and saying so is required:

- **`newest`**: it drains to the most recent message. Right for a display or a model that should always see the latest frame.
- **`ordered`**: messages in the order they were written, falling behind if it must. Right for a logger or a recorder.

Neither blocks the node that writes: under sustained pressure a link drops messages, and every drop is counted on the link in the live graph. One output can feed a `newest` reader and an `ordered` reader at once.

## Sending an output off the stream

A link's two ends are always in one stream. To reach anything else, a stream sends a port to a [MoQ](https://datatracker.ietf.org/group/moq/about/) (Media over QUIC) relay with the gateway nodes from `tatolab-moq`:

- `MoqGateway` holds one connection to a relay and publishes one broadcast there.
- `MoqTrack` declares one track of that broadcast.
- `MoqTrackSend` writes the messages of the port linked into it to that track.
- `MoqTrackReceive` reads a track of any broadcast on the same relay, into a stream.

![A stream sends a track to a relay through its gateway nodes. Another stream, another machine or any MoQ client reads it there.](https://tatolab.com/media/docs/relay-light.jpg)

The relay can be one you run, such as `moq-relay`, one Cloudflare provisioned, or a moq.pro project. Nothing leaves a stream unless you add these nodes. Pictures are encoded first: an `Image` message is a GPU surface, which means nothing off its machine. See [Share between streams](https://tatolab.com/docs/share/between-streams) and [Across machines](https://tatolab.com/docs/share/across-machines).

## The runtime

`tatolabd` is the machine's one runtime. A second is refused, naming the first one's user and process. Tato Studio runs the runtime it carries as its own child process; without Studio, you start `tatolabd` yourself or under a service manager.

It is native code: the engine, the built-in nodes, and a local socket only your user can open, which the CLI, Studio and MCP clients talk to. It opens no network port for control. It never imports your code: each Python node runs in an interpreter started from your project's `.venv`, with the runtime's own Python half put first on its path.

The runtime makes each project's `.venv` itself, with the uv it carries, whenever `.venv/bin/python` doesn't run. It carries CPython 3.12, `tatolab-stream` and its core modules too, so a new project syncs without the network.

## Seeing inside

- **Tato Studio** shows each stream's graph, its logs, and any node's output in its Node visualizer, read on the machine with no copy.
- **`tatolab streams`** lists every stream and why any failed.
- **`tatolab graph`** prints the live graph as JSON: every node's state and counters, every link's state and drops.
- **`tatolab logs`** reads the project's log, one JSON Lines file written by every node and every load.
- **Agents** do all of this over MCP, which the runtime serves.

## Video, audio and the GPU

Every GPU operation in the runtime goes through Vulkan. A frame stays on the GPU from capture to output, and reaches torch, or any framework that takes DLPack, as device memory with no CPU copy. Reading pixels on the CPU is an explicit `frame.cpu()`. Pixel work is a shader node, or a Slang compute, graphics or ray-tracing kernel built from a process node.

Audio is `Channels` blocks. A node states the shape it wants on an input, its rate, channel count, sample type and block size, and the runtime converts what arrives before the node reads it.

## One clock

Every node reads the stream's clock as `ctx.time`, in nanoseconds, and every message is stamped on it. That's how a frame and the detections made from it are paired, and how audio lines up with video. A stream can also run on a scaled or stepped clock, for simulations.

## What Tato leaves to you

| You keep | Tato's part |
|---|---|
| Your model runtime: torch, ONNX Runtime, TensorRT, MLX | Hands it the frame as device memory, and gets out of the way |
| Your Python packages | A node imports whatever your project's `.venv` holds; `uv add` is how a dependency arrives |
| Your network: Tailscale, ssh | Control stays on the machine. Reaching another machine's runtime is `ssh <machine> tatolab mcp` |
| Your robotics stack: ROS, Zenoh | Out of scope. Where you need a bridge, it is a node you write |
