Skip to content

Getting Started

You write .rkg programs. Rastok itself is written in Rust; you do not need Rust to use it.

Rastok is currently in alpha. The release job builds binaries for macOS Apple silicon and Linux x86-64. Windows is not supported. The commands below install v0.2.0-alpha from its release page. Copy the command for your system below into a terminal. It downloads, verifies and installs Rastok.

For Macs with an Apple M-series chip, running macOS 11 or later:

Terminal window
( cd "$(mktemp -d)" && curl -fLO https://github.com/rastok-io/rastok/releases/download/v0.2.0-alpha/rastok-0.2.0-alpha-aarch64-apple-darwin.tar.gz && curl -fLO https://github.com/rastok-io/rastok/releases/download/v0.2.0-alpha/rastok-0.2.0-alpha-aarch64-apple-darwin.tar.gz.sha256 && shasum -a 256 -c rastok-0.2.0-alpha-aarch64-apple-darwin.tar.gz.sha256 && tar -xzf rastok-0.2.0-alpha-aarch64-apple-darwin.tar.gz rastok && mkdir -p "$HOME/.local/bin" && install -m 755 rastok "$HOME/.local/bin/rastok" ) && export PATH="$HOME/.local/bin:$PATH" && rastok --version

For 64-bit Intel or AMD systems with glibc 2.39 or later, such as Ubuntu 24.04. uname -m should report x86_64; ldd --version reports your glibc version. For Linux ARM64, older glibc or a system using musl, use the source installation below.

Terminal window
( cd "$(mktemp -d)" && curl -fLO https://github.com/rastok-io/rastok/releases/download/v0.2.0-alpha/rastok-0.2.0-alpha-x86_64-unknown-linux-gnu.tar.gz && curl -fLO https://github.com/rastok-io/rastok/releases/download/v0.2.0-alpha/rastok-0.2.0-alpha-x86_64-unknown-linux-gnu.tar.gz.sha256 && sha256sum -c rastok-0.2.0-alpha-x86_64-unknown-linux-gnu.tar.gz.sha256 && tar -xzf rastok-0.2.0-alpha-x86_64-unknown-linux-gnu.tar.gz rastok && mkdir -p "$HOME/.local/bin" && install -m 755 rastok "$HOME/.local/bin/rastok" ) && export PATH="$HOME/.local/bin:$PATH" && rastok --version

Each command installs rastok in ~/.local/bin for your user account and prints rastok 0.2.0-alpha. To use it in new terminals, add export PATH="$HOME/.local/bin:$PATH" to your shell configuration: ~/.zshrc for zsh (the macOS default), or ~/.bashrc for bash.

Installation and contribution instructions

Rastok is written in Rust. You can compile it from source if your platform has no prebuilt binary, or if you prefer to build it yourself.

First, follow the official Rust installation instructions, including the build tools listed for your system. This also installs rustup, which selects the Rust version, and Cargo, which builds and installs Rust software. Open a new terminal and install the version used by Rastok:

Terminal window
rustup toolchain install 1.97.1

Install the published release. Cargo downloads the sources and dependencies, compiles them on your machine and installs the executable:

Terminal window
cargo +1.97.1 install rastok --version 0.2.0-alpha --locked --features hosted-ui,hosted-websocket
rastok --version

Modify the source and contribute. Clone the repository instead, then build and run your local copy. For a pull request, fork the repository on GitHub first and use your fork’s URL in the clone command:

Terminal window
git clone https://github.com/rastok-io/rastok.git
cd rastok
cargo +1.97.1 run --locked -p rastok --features hosted-ui,hosted-websocket -- --help

Cargo builds and runs the executable from your working copy. After editing, repeat this command or replace --help with the Rastok command you want to test. The contribution guide explains the checks and review process for a pull request.

Both installation routes include HTTP/1.1, HTTP/2, WebSocket and the debugger; HTTP/3 is not included.

In a directory for your work, run:

Terminal window
rastok new hello
rastok simulate hello.rkg --ui

Open the loopback URL printed by the last command, including its access token. The simulation starts paused. Choose Next transition, or Finish to reach Hello, world. The CLI reports PASS hello.roundtrip_greeting when the scenario finishes. Close the viewer from its toolbar when done.

Whether you installed Rastok from an archive or with cargo install, fetch the example sources and reference traces at the tag of your binary. This creates a rastok-examples checkout; it does not build or reinstall Rastok. Run these commands from the directory where you want to keep it (Git is required):

Terminal window
git clone --depth 1 --branch v0.2.0-alpha https://github.com/rastok-io/rastok.git rastok-examples
cd rastok-examples
rastok simulate examples/echo.rkg

The simulation prints three PASS lines and 3 scenario(s), 0 failed. If you already have a checkout at that tag, use it without cloning again.

The version policy explains corrective releases, language changes and the independently numbered formats.

The whole program, nineteen lines: one App graph with typed ports, one Operator with a handler, and a Lab with one scenario. No Connector, no external system.

graph hello : App {
input in: string
output out: string
operator greet {
input in: string
output out: string
on in { out = "Hello, " + data }
}
in -> greet -> out
}
lab hello {
scenario roundtrip_greeting {
app.in = "world"
expect app.out == "Hello, world"
}
}

rastok check hello.rkg answers ok: 2 node(s) with the semantic hash; rastok simulate hello.rkg prints PASS hello.roundtrip_greeting and 1 scenario(s), 0 failed. Start from this file rather than from the grammar; Echo then adds a Connector, a mock and a recording.

Debug: follow The debugger, a guided tour for its controls, source view and assertion evidence.

Without the browser, rastok simulate hello.rkg runs the same scenario. rastok new creates one file with a typed Operator and a Lab; it never overwrites an existing file. Change the source on disk, then run it again.

Use rastok --help for the command syntax and rastok --version to identify your build. The Command line chapter explains all commands, options, output streams and exit statuses.

From a checkout, continue with echo for a real Process and an effect-free recorded replay. Then follow webhook to partner: its command supplies the synthetic deployment profile and can open the same graph with --ui. No real server, partner or credential is required for that simulation. rastok run prints each App output value on its own line when the App declares one output port. An App with several output ports prints port: value instead. Read what run waits for before using it with a listening Connector or a pending deadline. Two unaided timed installation trials are still required before this quickstart is qualified. No elapsed-time claim is made yet.

The 0.2.0-alpha release includes an installable syntax-highlighting package. Install it in VS Code with:

Terminal window
curl -fLO https://github.com/rastok-io/rastok/releases/download/v0.2.0-alpha/rastok-dsl-0.2.0.vsix
code --install-extension rastok-dsl-0.2.0.vsix

For VSCodium, use codium --install-extension rastok-dsl-0.2.0.vsix. The editor instructions explain how to package a local checkout; they also cover the JetBrains bundle. For Vim or Neovim, load the native runtime from the same checkout as the examples, following the Vim and Neovim setup. Emacs has a native Rastok mode loaded from that checkout as well. These integrations color source and detect .rkg files; they do not provide completion or type checking. rastok check validates the program.

Some people read the book first; others open an example and break it; others hand the first step to a coding assistant and read what it wrote. All three paths lead to the same place.

Keep Authoring rules open for common refusals, working alternatives and links to the corresponding Reference sections.

  • By the book. The user guide reads the language in order: a program, types and expressions, Connectors and outcomes, the Lab, running for real, instances, recurrence, data policy, then the command line and what to do when a partner’s answer is lost.
  • By example. Eight examples, each built from a question, with a graph to read, a scenario to run, something to break and the first golden difference to read.
  • With a coding assistant. Open your preferred LLM harness or coding agent in an empty directory and give it a specification, for example: “Using https://docs.rastok.com/llms.txt, develop a Rastok application and its Lab that meet the following specification: <your spec>.” The documentation tells it how to check and simulate what it wrote; read the result as you would read a colleague’s: the compiler and the scenarios are the review.
Guide chapterWhat it explains
1. A programGraphs, Nodes, ports and wiring
2. Types and expressionsValues and typed decisions
3. Connectors and outcomesExternal boundaries and explicit dispositions
4. The LabScenarios, mocks and golden comparisons
5. Running for realDeployment and diagnostic replay
6. Instances, state and timeOwnership, lifetimes and bounded waits
7. Loops and retriesFinite progression and safe repetition
8. Privacy, secrets and measurementsData policy and original quantities
9. Command lineCommands, options and exit statuses
10. When the answer is lostDistinguishing a lost reply from a refused operation

An Operator computes. A Connector is the only thing that touches the outside. Echo shows both in one program.

ExampleYour questionWhat you learn to keep explicit
1. Echo: one graph, two worldsCan I test a flow without starting its external program?Computation, effects and the Lab
2. File pipeline: effects with a contractWhat may this flow read or replace, and what happens when it cannot?Bounded I/O and fault destinations
3. Two tenants: whose state is this?Can Alice retry while Bob is already done?Instance ownership, finite retry and lifetime
4. Webhook to partner: put it togetherCan I qualify an integration before the partner is available?Admission, validation, deduplication, effects and audit
5. Sensor alarm: make time an inputHow do I test an absence, or a day of waiting?Stateful decisions, timed joins and virtual time
6. Agent gateway: keep a conversation isolatedCan Alice and Bob share a graph without sharing a child process?Resident Sessions, protocol adaptation and exact closure
7. Countdown: a bounded loopCan I prove that repeated work finishes?Manager commands and a decreasing measure
8. HTTP model adapterWhat usage did the model actually report?Typed responses, original measurements and absent versus zero

Chapter 6 connects WebSockets to resident Process Sessions: Alice and Bob keep distinct children and correctly addressed JSON replies. Chapter 8 sends independent HTTP jobs and inspects typed usage supplied by the model. A scripted answer exercises the adapter; it is not evidence of a real token bill.

Read in order, or take the short route: echo, then webhook to partner. Every chapter runs independently from the checkout; no chapter requires files or state left by the previous one.

Run the scenario, inspect the graph, make the suggested edit on disk, and read the first golden difference. Restore the edit before continuing. Keep a new scenario when you discover a useful failure: it becomes a check for your next revision. The debugger explains recorded execution; it does not edit the flow or fork an alternative world.

By the end, the same ideas apply to a file, a partner API and an agent: who owns the state, where effects occur, what time means, and where each outcome goes. You do not need a different testing model for each integration.

Diagram