Skip to Content
Fusee Docs
Getting started

Examples

Five small applications, each in Python, TypeScript, Rust, Go and Java. They print the same results in every language, and scripts/check_examples.sh runs all twenty-five in CI.

PythonTypeScriptRustGoJava
Payment saga: reserve, charge, wait for shipping; compensations undo on failurepytsrsgojava
Agent loop: model and tool calls, each a steppytsrsgojava
Scheduled job: a schedule starts a report each second (a cron expression in a real job)pytsrsgojava
Human approval: ask, wait up to three days for a decision, act on itpytsrsgojava
Cart object: one object per user, calls that take turns, a repeated call that runs oncepytsrsgojava

Each keeps its data in ./data/<example> under the directory it runs from, and its workflow IDs attach to an earlier run (use-existing), so running one again, or killing it midway and running it again, continues where it was.

Run one:

PYTHONPATH=bindings/python/python python3 examples/python/payment_saga.py
cargo run --release -p fusee --example payment_saga
(cd examples/go && go run ./payment_saga)
java -cp bindings/java/target/classes examples/java/PaymentSaga.java

The TypeScript examples import fusee: run them from a project where it is installed (npm install @bitsinfra/fusee), as scripts/check_examples.sh arranges. invoked_worker.py and invoked-worker.mjs show a worker the server starts on demand (server mode).