apache / apache/burr

feat: `ActionGraph` vs. `StateGraph`

Open
#420 1 comment 0 reactions 0 assignees View on GitHub
area/visualization kind/feature priority/low
Dominant language
Python
Stars
2.5k
Forks
195
Avg merge
6d 10h
Merged PRs (30d)
17

Description

Currently, the `.visualize()` method returns a graph where **actions** are nodes and **transitions** are edges. Parameters allow to display conditional edges and state values that are read/written. Let's call this the **action graph**. This helps understand the logic of the application and shows the previous/next action at runtime.

Here's an example:

![image](https://github.com/user-attachments/assets/ee60a0ae-cace-4b10-a5d9-d1f77937e73b)

Another relevant visualization would be the **state graph** where **state fields** are nodes and **actions** are edges. Currently, there are no visual tools to know all the **state fields** before execution. This puts emphasis on the dataflow of the application (converts a state machine graph to a dataflow, similar to Hamilton). During monitoring or debugging, we can number nodes with a `sequence_id` to know when it was last updated.

![image](https://github.com/user-attachments/assets/6aede995-58e7-437c-8c52-3de662bc882b)
> This graph being confusing is not indicative of the value of the plot, but rather that simplification could be made. It becomes obvious that `feedback_history` is redundant with the many persisted instance of `feedback`

(This other graph structure is key to create rollback mechanisms. If the field `input_document` is updated on sequence `1` and `7`, and you want to rollback the value of `input_document` when at sequence `10`, we know we have to rollback to sequence `1` (or do some diff with `7` rather "undo" each step from 10 to 1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.