Interface Node

All Known Implementing Classes:
BaseAgent, BaseNode, ClassifierNode, FunctionNode, JoinNode, LlmAgent, LoopAgent, NodeViewAgent, ParallelAgent, PlannerAgent, RemoteA2AAgent, SequentialAgent, Start, Workflow

public interface Node
A unit of work in a workflow graph. Node names must be unique within a graph. Every member except name() and description() is experimental, so implementing this interface is too.
  • Method Summary

    Modifier and Type
    Method
    Description
    default NodeConfig
    Returns the node's retry policy and execution timeout.
    default String
    Returns what the node does, for humans and for a model that may call it.
    default Optional<com.google.genai.types.Schema>
    Returns the schema the node's input must match.
    Returns the name that identifies the node within its graph.
    default Optional<com.google.genai.types.Schema>
    Returns the schema that the node's output value must match.
    default boolean
    Returns true if the node runs only once every predecessor has completed, receiving all their outputs keyed by node name, as a fan-in node does.
    default boolean
    Returns true if a resumed node runs again from scratch, rather than completing with the resuming answer as its output.
    io.reactivex.rxjava3.core.Flowable<?>
    runNode(Context context, @Nullable Object nodeInput)
    Runs the node on nodeInput, the output it receives from its predecessors.
    default Optional<com.google.genai.types.Schema>
    Returns the schema of the state keys that the node and its children may write; a child inherits it unless it declares its own.
    default boolean
    Returns true if the node stays re-triggerable until it produces an output or a route, instead of completing when its run completes.
  • Method Details

    • name

      String name()
      Returns the name that identifies the node within its graph.
    • description

      default String description()
      Returns what the node does, for humans and for a model that may call it.
    • rerunOnResume

      @Experimental default boolean rerunOnResume()
      Returns true if a resumed node runs again from scratch, rather than completing with the resuming answer as its output.
    • waitForOutput

      @Experimental default boolean waitForOutput()
      Returns true if the node stays re-triggerable until it produces an output or a route, instead of completing when its run completes.
    • config

      @Experimental default NodeConfig config()
      Returns the node's retry policy and execution timeout.
    • inputSchema

      @Experimental default Optional<com.google.genai.types.Schema> inputSchema()
      Returns the schema the node's input must match. An edge into the node fails at build when its source's output schema lists a key or type this one rejects, so an open producer such as a map builds, and a FunctionNode on a Content port checks the edge against the Content schema. A node that requires all predecessors applies it to each predecessor's output, not the joined map. A run checks a node's schemas only for type, nullable, enum, anyOf, properties, required and items; it ignores minimum, maximum, pattern, lengths and format.
    • outputSchema

      @Experimental default Optional<com.google.genai.types.Schema> outputSchema()
      Returns the schema that the node's output value must match. The content of a message-as-output event is not checked against this schema. A run checks a record, POJO or enum input or output in its JSON form and hands on that form: a map for a record, the name for an enum.
    • stateSchema

      @Experimental default Optional<com.google.genai.types.Schema> stateSchema()
      Returns the schema of the state keys that the node and its children may write; a child inherits it unless it declares its own. The runtime converts writes through Context.state() in a node or in a tool node's tool, emitted events' state deltas and tool nodes' deltas to the declared type, throwing StateSchemaException on a mismatch or undeclared key; a FunctionTool lets it through, so it fails the node. Keys with a colon and a node's direct writes to its own Context.eventActions()'s state delta pass unchecked. A stored value reads back in the form a stored session gives: lists and maps unmodifiable, a record as a map, an enum by its name, a small whole number as an Integer.
    • requiresAllPredecessors

      @Experimental default boolean requiresAllPredecessors()
      Returns true if the node runs only once every predecessor has completed, receiving all their outputs keyed by node name, as a fan-in node does.
    • runNode

      @Experimental io.reactivex.rxjava3.core.Flowable<?> runNode(Context context, @Nullable Object nodeInput)
      Runs the node on nodeInput, the output it receives from its predecessors. The workflow runner calls this method; to run a node from another node's body, call Context.runNode(Node, Object).

      An emitted Event passes through, an emitted RequestInput pauses the workflow until the user answers it, and any other emitted value becomes the node's output (at most one per run); emit nothing for no output, since RxJava forbids null. The wildcard lets an implementation return a Flowable of its own type.