Skip to content
docsv0.17.1

Graph

The class IS the graph, and its constructor IS the state. A graph here is not a new kind of thing: it is a DECLARATION THAT COMPOSES OPERATIONS. Each node names an operation that already exists — with its gates, its consent, its effect ceiling and its attribution — and the graph declares only the wiring, the channels and where it stops. Nothing about a node has to be restated to put it in a graph. ```php #[Graph(name: 'essay:review', description: 'Draft against a rubric until it passes.')] #[Start(Write::class)] #[Edge(from: Write::class, to: Grade::class)] #[Route(when: Verdict::Passed, to: Publish::class)] #[Route(when: Verdict::Failed, to: Write::class, atMost: 3, thenAsk: EditorCall::class)] final readonly class EssayReview { public function __construct( #[Target] public string $title, public string $rubric, public string $draft = '', ) { } } ```

Graph::__construct()

public function __construct(string $name, string $description, ?string $version = null):

Parameters

Parameters of __construct()
NameTypeDescription
$namestringHow a human and an agent both call this graph (`domain:verb`).
$descriptionstringWhat it does, in one sentence — one truth, two readers.
$version(string | null)The contract version, when this graph has one.