FunctionNode

A workflow Node backed by a suspending function that may emit progress Events and returns an output of type O. Its schemas inferred from I and O only describe it; an explicit schema passed to node is also enforced.

Inline workflow steps use node or parallelNode.

Type Parameters

I

Expected type of nodeInput from predecessor nodes.

O

Type of output value this node returns (Unit/null emits no output event; Event passes through directly; a Content becomes a message event with no node output; any other value becomes the node's output on an Event).

Properties

Link copied to clipboard
open override val config: NodeConfig

The node's retry policy and execution timeout.

Link copied to clipboard
open override val description: String

What the node does, for humans and for a model that may call it.

Link copied to clipboard
open override val inputSchema: Schema?

Validates the node's input before it runs.

Link copied to clipboard
override val name: String

Identifies the node within its graph.

Link copied to clipboard
open override val outputSchema: Schema?

Validates the output value the node emits. A value assigned to Context.output and a message-as-output event's content are not checked.

Link copied to clipboard
open override val requiresAllPredecessors: Boolean

Whether the node runs only once every predecessor has completed, receiving all their outputs keyed by node name. A fan-in node overrides this to true.

Link copied to clipboard
open override val rerunOnResume: Boolean

On resume, whether to run the node again from scratch rather than completing it with the resuming answer as its output.

Link copied to clipboard
open override val stateSchema: Schema?

Declares the state keys the node uses. Child nodes inherit it unless they declare their own.

Link copied to clipboard
open override val waitForOutput: Boolean

Whether the node stays re-triggerable until it produces an output or a route, instead of completing when runNode returns. A node that never produces either then waits forever, which is a graph-authoring error.

Functions

Link copied to clipboard
fun run(context: Context, nodeInput: Any?): Flow<Event>

Runs the node and normalizes each raw emission of runNode into an Event: null and Unit are skipped, a RequestInput becomes an adk_request_input interrupt event, an Event keeps its content and has its output validated, and any other value becomes the output.

Link copied to clipboard
open override fun runNode(context: Context, nodeInput: Any?): Flow<Any?>

The user-facing implementation of the node's execution logic.