examples/

directory
v0.18.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT

README

/examples

cd /

[!NOTE] asyncmachine-go is a pathless control-flow graph with a consensus (AOP, actor model, state-machine).

Examples

Headers link to actual examples.

aRPC

aRPC client and server example.

  • #rpc #client #server #template
  • origin
Basic

Very basic, yet modern example of asyncmachine-go.

  • #relations #handlers #async #negotiation #auto
CLI

go-arg based CLI example.

  • #template #relations #handlers #template
CLI Daemon

go-arg based CLI with an aRPC daemon example.

  • #template #relations #handlers #arpc #payload #template
Mach Template

Copy-paste boilerplate to set up a new machine.

  • #template #handlers #telemetry #repl #relations #generator #negotiation #multi #template
Tree State Source

Single writer distributed to multiple readers in a tree structure.

  • #relations #negotiation #auto #arpc #otel #metrics #grafana #generator #data
  • origin
TUI

cview based TUI app example.

  • #relations #handlers #cview #ui #global-handlers
WASM

aRPC WASM architecture with a simple chat.

  • #relations #handlers #arpc-handlers #arpc #relay #ui #websocket
WASM Workflow

WebWorker WASM workflow example.

  • #relations #handlers #arpc-handlers #arpc #relay #websocket #webworkers #payload
DAG Dependency Graph

Sync and async DAG / dependency graph example.

  • #relations #handlers #async #auto #dependency-graph
Fan Out Fan In

Distributing work to multiple worker states and collecting the results.

  • #relations #handlers #async #auto #concurrency
FSM - Finite State Machine

Classic FSM example.

  • #relations #handlers #negotiation #auto
  • origin
NFA - Nondeterministic Finite Automaton

Classic NFA example.

  • #relations #handlers #async #multi
  • origin
PATH Watcher

Watch file system paths for changes.

  • #relations #handlers #async #negotiation #multi
  • origin
Pipes

How to pipe states between state machines.

  • #handlers #composition
  • origin
Raw Strings

Very basic and old school example of asyncmachine-go.

  • #relations #handlers #async #negotiation #auto
  • origin
Relations Playground

Code from the relations playground.

REPL

REPL boilerplate.

  • #arpc #repl #template
  • origin
Subscriptions

Very basic example of waiting for states.

Temporal Expense Workflow

Workflow ported from Temporal.

  • #relations #handlers #async #negotiation #auto #temporal
  • origin
Temporal FileProcessing Workflow

Workflow ported from Temporal.

Benchmarks

Benchmark State Source

Benchmark adding tree nodes to the state source example.

  • #docker #go-wrt #caddy
  • origin
Benchmark gRPC

Benchmark aRPC vs gRPC.

  • #relations #handlers #negotiation #arpc #grpc
  • origin
Benchmark libp2p PubSub

Very old benchmark of libp2p-pubsub ported to asyncmachine-go.

  • #relations #handlers #async #negotiation #libp2p

Demos

am-dbg Debugger

Interactively use the TUI debugger with data pre-generated by a secai bot:

go run github.com/pancsta/asyncmachine-go/tools/cmd/am-dbg@latest \
  --import-data https://pancsta.github.io/assets/asyncmachine-go/am-dbg-exports/secai-cook.gob.br \
  mach://cook

Apps

asyncmachine-go synchronizes state for the following projects:

monorepo

Go back to the monorepo root to continue reading.

Directories

Path Synopsis
arpc
client command
server command
client command
worker command
ProcessingFile to FileProcessed 1 async and 1 sync state
ProcessingFile to FileProcessed 1 async and 1 sync state
cli
states
Package states contains a stateful schema-v2 for a CLI.
Package states contains a stateful schema-v2 for a CLI.
cli_daemon
cli command
daemon command
states
Package states contains a stateful schema-v2 for a CLI.
Package states contains a stateful schema-v2 for a CLI.
states
Package states contains a stateful schema-v2 for MachTemplate.
Package states contains a stateful schema-v2 for MachTemplate.
nfa
Package main is an educational example of a state machine operating on string-based states.
Package main is an educational example of a state machine operating on string-based states.
temporal_expense
gen_states command
tui
client command
server command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL