CustomNode class final

Runs a caller-supplied function.

The escape hatch, and the node most real workflows use most. A workflow that cannot call ordinary code for the ordinary parts forces everything through the model, which is slower, less reliable and far more expensive.

Inheritance

Constructors

CustomNode({required String id, required FutureOr<NodeOutcome> run(NodeContext context), Set<String> reads = const <String>{}, Map<String, JsonSchema> writes = const <String, JsonSchema>{}, String? description, String typeName = 'custom', Set<String> jumpTargets = const <String>{}})
Creates a node backed by run.
const

Properties

children → List<WorkflowNode>
Nodes this one contains, for validation and tracing.
no setterinherited
description → String?
What this node does, for diagrams and traces.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
id → String
Unique identifier within a graph.
finalinherited
jumpTargets → Set<String>
Nodes this one may jump to with NodeOutcome.goTo.
final
reads → Set<String>
State keys this node needs before it can run.
finalinherited
run → FutureOr<NodeOutcome> Function(NodeContext context)
The function to run.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → String
Stable type name, such as llm or condition.
no setteroverride
typeName → String
The type reported in traces and diagrams.
final
writes → Map<String, JsonSchema>
State keys this node produces, with the shape of each.
finalinherited

Methods

execute(NodeContext context) → Future<NodeOutcome>
Runs the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → JsonMap
Describes the node for serialisation and diagrams.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited