Class BaseNode
java.lang.Object
com.google.adk.workflow.BaseNode
- All Implemented Interfaces:
Node
- Direct Known Subclasses:
BaseAgent, ClassifierNode, FunctionNode, JoinNode, Workflow
Base class for nodes in a workflow graph. It is meant for the framework's own nodes; to write a
node, implement
Node. Subclasses implement Node.runNode(Context, Object), and the framework turns each
emission into an Event.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a node with every property other than its name and description at its default.protectedBaseNode(String name, String description, boolean rerunOnResume, boolean waitForOutput, NodeConfig config, @Nullable com.google.genai.types.Schema inputSchema, @Nullable com.google.genai.types.Schema outputSchema, @Nullable com.google.genai.types.Schema stateSchema) Creates a node; each parameter sets theNodeproperty of the same name. -
Method Summary
Modifier and TypeMethodDescriptionconfig()Returns the node's retry policy and execution timeout.Returns what the node does, for humans and for a model that may call it.Optional<com.google.genai.types.Schema> Returns the schema the node's input must match.final Stringname()Returns the name that identifies the node within its graph.Optional<com.google.genai.types.Schema> Returns the schema that the node's output value must match.booleanReturnstrueif a resumed node runs again from scratch, rather than completing with the resuming answer as its output.Optional<com.google.genai.types.Schema> Returns the schema declaring the state keys the node uses.protected voidvalidateOutgoingEdges(Collection<Edge> edges) ThrowsGraphValidationExceptionif this node cannot serve theedgesthat leave it, such as an edge for a route it never emits.booleanReturnstrueif the node stays re-triggerable until it produces an output or a route, instead of completing when its run completes.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Node
requiresAllPredecessors, runNodeModifier and TypeMethodDescriptiondefault booleanReturnstrueif the node runs only once every predecessor has completed, receiving all their outputs keyed by node name, as a fan-in node does.io.reactivex.rxjava3.core.Flowable<?> Runs the node onnodeInput, the output it receives from its predecessors.
-
Constructor Details
-
BaseNode
-
BaseNode
protected BaseNode(String name, String description, boolean rerunOnResume, boolean waitForOutput, NodeConfig config, @Nullable com.google.genai.types.Schema inputSchema, @Nullable com.google.genai.types.Schema outputSchema, @Nullable com.google.genai.types.Schema stateSchema) Creates a node; each parameter sets theNodeproperty of the same name.
-
-
Method Details
-
name
-
description
Description copied from interface:NodeReturns what the node does, for humans and for a model that may call it.- Specified by:
descriptionin interfaceNode
-
rerunOnResume
public boolean rerunOnResume()Description copied from interface:NodeReturnstrueif a resumed node runs again from scratch, rather than completing with the resuming answer as its output.- Specified by:
rerunOnResumein interfaceNode
-
waitForOutput
public boolean waitForOutput()Description copied from interface:NodeReturnstrueif the node stays re-triggerable until it produces an output or a route, instead of completing when its run completes.- Specified by:
waitForOutputin interfaceNode
-
config
Description copied from interface:NodeReturns the node's retry policy and execution timeout. -
inputSchema
Description copied from interface:NodeReturns 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 aFunctionNodeon aContentport checks the edge against theContentschema. A node that requires all predecessors applies it to each predecessor's output, not the joined map.- Specified by:
inputSchemain interfaceNode
-
outputSchema
Description copied from interface:NodeReturns the schema that the node's output value must match. The content of a message-as-output event is not checked against this schema.- Specified by:
outputSchemain interfaceNode
-
stateSchema
Description copied from interface:NodeReturns the schema declaring the state keys the node uses. Child nodes inherit it unless they declare their own.- Specified by:
stateSchemain interfaceNode
-
validateOutgoingEdges
ThrowsGraphValidationExceptionif this node cannot serve theedgesthat leave it, such as an edge for a route it never emits. The default accepts any edges. Building the workflow graph calls it after its own checks.
-