0.0
No release in over 3 years
A minimal Ruby graph runtime that suspends on external work and resumes later.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0
~> 3.10
~> 1.12
~> 0.6.0
~> 2.14.2
 Project Readme

AsyncGraph

AsyncGraph is a small Ruby runtime for graph-style workflows that suspend on external work, store jobs outside the graph, and resume on later passes. It supports:

  • single-step graph execution
  • barrier joins such as edge %i[left right], :merge
  • library-owned join processing for persisted branch tokens
  • await.call(...) for one external job
  • await.all(...) for multiple parallel jobs in one node
  • graph validation before execution

Installation

gem install async-graph

Example

require 'async-graph'

graph = AsyncGraph::Graph.new do
  node :fetch_user do |state, await|
    user = await.call("user", :fetch_user, user_id: state[:user_id])
    { user: user }
  end

  set_entry_point :fetch_user
  set_finish_point :fetch_user
end

step = graph.step(state: { user_id: 7 }, node: graph.entry)
request = step.requests.first

resumed = graph.step(
  state: step.state,
  node: step.node,
  resolved: { request.key => { id: 7, name: "Ada" } }
)

resumed.state
# => { user_id: 7, user: { id: 7, name: "Ada" } }

Demo

The repository includes a runnable example in examples/:

bash examples/run.sh