Class NodeExecutionState
java.lang.Object
com.google.adk.workflow.NodeExecutionState
The state of one workflow node run, held by the run's
Context. Only the workflow runtime
creates it and updates the bookkeeping that records which results an event has carried. Its
output, interrupt IDs and child run IDs are safe to update from several threads, since children
that a node runs itself may start and finish on other threads.-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of this attempt at running the node, counting from 1.static ObjectcheckStateValue(@Nullable com.google.genai.types.Schema stateSchema, String key, Object value) Returnsvaluechecked againststateSchemaforkey, in the form a stored session reads back, as for node outputs; public only forContext.booleanemitFromBody(Event event) Sendsevent, which needs an ID, on behalf ofContext.emit(Event); false if no body runs.Returns the author of the events this run emits, or empty to use the node's name.voideventAuthor(String eventAuthor) Sets the author of the events this run emits.com.google.common.collect.ImmutableSet<String> Returns the IDs of the long-running tool calls the node is waiting on.Returns the isolation scope this run's events carry unless they set their own, or empty when unscoped.node()Returns the node this run belongs to.nodePath()Returns the path of this run:name@runIdsegments joined by/, starting at the outermost node.booleanotherRunInProgress(String path) Returns whether another run atpath, under the same root, started in this turn and has not finished, such as a delegator whose task handed off to this run.output()Returns the node's output, which is the output of itsuseAsOutputchild once that child emits one, or empty if it has none.parent()Returns the context of the node that ran this node, or empty for a run at the top of the invocation: a root node or a handoff target that runs beside it.voidproduceOutput(Object output) Records the node's output, which an event carries when the node finishes unless an earlier event already carried it.Returns the user's answers to the requests for input and long-running calls that this node or its descendants raised in an earlier turn, keyed by interrupt ID.runId()Returns the ID of this run among the node's runs, counting from"1".Returns the routes the node selected, which decide the outgoing edges to follow, or empty if it made no routing decision.voidselectRoutes(List<? extends Route> routes) Selects the node's routes, replacing any earlier selection.Optional<com.google.genai.types.Schema> Returns the state schema in force for this run: its node's own or the nearest ancestor's.
-
Method Details
-
node
Returns the node this run belongs to. -
nodePath
Returns the path of this run:name@runIdsegments joined by/, starting at the outermost node. -
runId
Returns the ID of this run among the node's runs, counting from"1". -
attemptCount
public int attemptCount()Returns the number of this attempt at running the node, counting from 1. -
parent
-
isolationScope
-
eventAuthor
Returns the author of the events this run emits, or empty to use the node's name. A run under a parent starts with the parent's author. -
eventAuthor
Sets the author of the events this run emits. -
output
-
produceOutput
Records the node's output, which an event carries when the node finishes unless an earlier event already carried it. A node produces at most one output. Once the node delegates its output to auseAsOutputchild, an output it produces itself is dropped, as in Python ADK.- Throws:
IllegalStateException- if the node already produced an output of its own, even one that was dropped
-
selectedRoutes
-
selectRoutes
-
interruptIds
Returns the IDs of the long-running tool calls the node is waiting on. -
resumeInputs
Returns the user's answers to the requests for input and long-running calls that this node or its descendants raised in an earlier turn, keyed by interrupt ID. A null answer has a null value in the map. The map is empty unless the node reruns on resume. -
stateSchema
Returns the state schema in force for this run: its node's own or the nearest ancestor's. -
checkStateValue
public static Object checkStateValue(@Nullable com.google.genai.types.Schema stateSchema, String key, Object value) Returnsvaluechecked againststateSchemaforkey, in the form a stored session reads back, as for node outputs; public only forContext. Keys with a colon,State.REMOVEDand writes under no schema pass unchecked.- Throws:
StateSchemaException- if the schema does not declarekey, or if the value does not match or converts to null
-
emitFromBody
Sendsevent, which needs an ID, on behalf ofContext.emit(Event); false if no body runs. -
otherRunInProgress
Returns whether another run atpath, under the same root, started in this turn and has not finished, such as a delegator whose task handed off to this run.
-