Skip to content

Writing Workflows

Workflows in Brane are written in BraneScript, a domain-specific language designed to be accessible. If you’ve used Python or JavaScript, BraneScript will feel familiar.

  • The Brane CLI installed
  • Access to a running Brane instance (ask your administrator)
  • Packages published to the instance (ask your developers)
Terminal window
brane login http://<INSTANCE_ADDRESS> --username <YOUR_NAME>
brane package search # See available packages
import hello_world;
let result := hello_world();
println(result);
let name := "Alice";
let count := 42;
let ratio := 3.14;
let active := true;
let items := [1, 2, 3];

Reassignment: x := x + 1;

TypeExampleDescription
String"hello"Text
Integer42Whole numbers
Real3.14Floating-point
BooleantrueTrue or false
Array[T][1, 2, 3]Ordered collection
Datanew Data { name := "x" }Dataset reference
// If/else
if count > 10 {
println("Many items");
} else {
println("Few items");
}
// While loop
let i := 0;
while i < 5 {
println(i);
i := i + 1;
}
// For loop
for item in items {
println(item);
}

Reference datasets on worker nodes:

let patient_data := new Data { name := "patient_records" };
let summary := analyze(patient_data);
println(summary);

Brane runs analyze on the node where patient_records lives — data never moves.

Terminal window
brane workflow repl --remote http://<INSTANCE>:50053

Save your workflow to a .bs file and run it:

Terminal window
brane workflow run --remote http://<INSTANCE>:50053 workflow.bs
Terminal window
brane workflow repl
CategoryOperators
Arithmetic+, -, *, /, %
Comparison==, !=, <, >, <=, >=
Logical&&, ||, !
FunctionDescription
println(value)Print a value to output
len(array)Get array length
commit_result(name, value)Store a named result
to_string(value)Convert to string
to_int(value)Convert to integer
to_real(value)Convert to float