Quickstart
In this guide, you will author and deploy a Program, start an Execution, suspend it on an event, and resume it by sending that event.
Install
Section titled “Install”npm install @trigora/sdk @trigora/client trigoraThe npm trigora package provides a Node launcher for the Rust CLI. Node 22 is required for this package and for TypeScript or JavaScript projects that use the TypeScript adapter. Python and Rust installation instructions are available on Install; projects that use only Python or Rust do not require Node.
Local recovery is trigora-local writing .trigora/state.db. See the runtime chain in the CLI reference.
Write a Program
Section titled “Write a Program”import { effect, waitForEvent } from "@trigora/sdk";
export default async function approval() { const result = await effect("generate", async () => { return 42; });
const review = await waitForEvent("approved");
return { result, review };}effect is the durable boundary for external work. waitForEvent suspends the execution until something sends approved. Waiting does not hold compute.
This hello-world stays sequential. Promise.all, gather, and join, and Promise.race and race, are on Structured concurrency.
Point trigora.toml at the file:
[project]name = "approval"programs = ["src/**/*.ts"]The Program id is approval, taken from the named default export. Because the Program has no parameters, this example does not provide start input.
To receive start input, declare parameters. Those values are an ordered argument list:
export default async function research(topic, limit) { return { topic, limit };}trigora start research --input '["tcc", 10]'See Programs.
Deploy
Section titled “Deploy”Create an API token in Trigora Cloud and set it. There is no trigora login command.
export TRIGORA_TOKEN=...trigora deployThe CLI also reads TRIGORA_TOKEN from a .env file in the project. trigora init writes .env.example with the variable commented out.
Run it
Section titled “Run it”trigora start approvaltrigora send <execution-id> approvedtrigora executions inspect <execution-id>start prints the execution id. After start, the execution runs the effect, commits that outcome, and waits. send delivers approved. The execution resumes from the wait and returns { result, review }. It does not run generate again.
Next: Your first Program · Structured concurrency · Events · How recovery works