You write .rkg programs. Rastok itself is written in Rust; you do not need
Rust to use it.
Install and run Rastok
Section titled “Install and run Rastok”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.
macOS Apple silicon
Section titled “macOS Apple silicon”For Macs with an Apple M-series chip, running macOS 11 or later:
( 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 --versionLinux x86-64
Section titled “Linux x86-64”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.
( 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 --versionEach 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.
Other platforms and source builds
Section titled “Other platforms and source builds”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:
rustup toolchain install 1.97.1Install the published release. Cargo downloads the sources and dependencies, compiles them on your machine and installs the executable:
cargo +1.97.1 install rastok --version 0.2.0-alpha --locked --features hosted-ui,hosted-websocketrastok --versionModify 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:
git clone https://github.com/rastok-io/rastok.gitcd rastokcargo +1.97.1 run --locked -p rastok --features hosted-ui,hosted-websocket -- --helpCargo 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.
Create your first application
Section titled “Create your first application”In a directory for your work, run:
rastok new hellorastok simulate hello.rkg --uiOpen 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.
Get the examples
Section titled “Get the examples”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):
git clone --depth 1 --branch v0.2.0-alpha https://github.com/rastok-io/rastok.git rastok-examplescd rastok-examplesrastok simulate examples/echo.rkgThe 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 file rastok new hello writes
Section titled “The file rastok new hello writes”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.
Editor support
Section titled “Editor support”The 0.2.0-alpha release includes an installable syntax-highlighting package. Install it in VS Code with:
curl -fLO https://github.com/rastok-io/rastok/releases/download/v0.2.0-alpha/rastok-dsl-0.2.0.vsixcode --install-extension rastok-dsl-0.2.0.vsixFor 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.
Three ways to learn
Section titled “Three ways to learn”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 chapter | What it explains |
|---|---|
| 1. A program | Graphs, Nodes, ports and wiring |
| 2. Types and expressions | Values and typed decisions |
| 3. Connectors and outcomes | External boundaries and explicit dispositions |
| 4. The Lab | Scenarios, mocks and golden comparisons |
| 5. Running for real | Deployment and diagnostic replay |
| 6. Instances, state and time | Ownership, lifetimes and bounded waits |
| 7. Loops and retries | Finite progression and safe repetition |
| 8. Privacy, secrets and measurements | Data policy and original quantities |
| 9. Command line | Commands, options and exit statuses |
| 10. When the answer is lost | Distinguishing 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.
| Example | Your question | What you learn to keep explicit |
|---|---|---|
| 1. Echo: one graph, two worlds | Can I test a flow without starting its external program? | Computation, effects and the Lab |
| 2. File pipeline: effects with a contract | What 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 together | Can I qualify an integration before the partner is available? | Admission, validation, deduplication, effects and audit |
| 5. Sensor alarm: make time an input | How do I test an absence, or a day of waiting? | Stateful decisions, timed joins and virtual time |
| 6. Agent gateway: keep a conversation isolated | Can Alice and Bob share a graph without sharing a child process? | Resident Sessions, protocol adaptation and exact closure |
| 7. Countdown: a bounded loop | Can I prove that repeated work finishes? | Manager commands and a decreasing measure |
| 8. HTTP model adapter | What 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.
How to use the examples
Section titled “How to use the examples”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.