VibeGraphing
This chapter explains MASFactory’s VibeGraphing workflow: generate a graph_design.json artifact from natural-language intent, then compile it into runnable MASFactory graphs.
Key objects
VibeGraph: aGraph-like node responsible for:- generating or loading a
graph_design, - compiling
graph_designinto runnable nodes/edges, - caching the design artifact for iteration.
- generating or loading a
graph_design.json: a versionable, human-readable intermediate representation (IR) of the workflow structure.- Build workflow: the workflow used to generate
graph_design(default:VibeWorkflow). You can swap it with your own. - Compiler: compiles
graph_designinto a real MASFactory graph (seemasfactory/components/vibe/compiler.py).
Typical usage
python
from pathlib import Path
from masfactory import VibeGraph, NodeTemplate
Workflow = NodeTemplate(
VibeGraph,
invoke_model=invoke_model,
build_model=build_model,
build_instructions=build_instructions,
build_cache_path=Path("assets/cache/graph_design.json"),
)Runtime behavior:
- If
build_cache_pathdoes not exist: run the build workflow to generategraph_designand cache it. - If
build_cache_pathexists: load the cached design. - Compile
graph_designinto runnable nodes/edges inside thisVibeGraphinstance. - Execute like a normal
Graph.
The graph_design standard
The standard definition lives under the repository graph_design/ directory. All future generation/parsing of graph_design should align with that standard.
The same standard is used by the Visualizer Vibe tab when previewing/editing graph_design.json.
Working with Visualizer
Recommended workflow:
- Run once to generate
graph_design.json. - Open MASFactory Visualizer to preview the topology.
- Edit and save in the Vibe tab if needed.
- Go back to Python to validate compilation and runtime behavior.
Custom build workflows
If you want the design generation process to better fit your domain (role assignment, phase design, human confirmation, etc.), you can:
- provide
VibeGraph(..., build_workflow=...), and - implement your own “generate → preview → modify → confirm” loop.
The default build workflow lives under masfactory/components/vibe/vibe_workflow.