Package-level declarations

Types

Link copied to clipboard
abstract class BaseNode(val name: String, val description: String = "", val rerunOnResume: Boolean = false, val waitForOutput: Boolean = false, val config: NodeConfig = NodeConfig(), val inputSchema: Schema? = null, val outputSchema: Schema? = null, val stateSchema: Schema? = null) : Node

The base class for units of work in a workflow graph. A Workflow is itself a node, so graphs nest, and every agent is one too.

Link copied to clipboard

Thrown by com.google.adk.kt.agents.Context.runNode when the dispatched child fails: error is the child's failure and errorNodePath the path of the node that failed.

Link copied to clipboard
data class Edge(val from: Node, val to: Node, val routes: List<Route> = emptyList())

A connection between two nodes.

Link copied to clipboard

A chain of edges for Java callers, positioned at a node. EdgesBuilder.from starts a chain, and each call adds the same edges as the edges DSL function of the same name and continues from its target.

Link copied to clipboard

The receiver that collects the edges declared in an edges or workflow block. A node is identified by its instance, so create each node once and reuse it. To add a tool as a step, convert it once with asNode and reuse that node.

Link copied to clipboard

A block that declares edges or routes on a T builder. In Kotlin, pass a lambda with the builder as its receiver. In Java, pass a lambda that takes the builder as an argument, with no Unit to return.

Link copied to clipboard

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.

Link copied to clipboard

A workflow graph failed validation. Raised when the graph is built, not when it runs.

Link copied to clipboard
class JoinNode @JvmOverloads constructor(name: String, description: String = "", inputSchema: Schema? = null, outputSchema: Schema? = null) : BaseNode

Waits for every predecessor to complete, then outputs their outputs keyed by predecessor name.

Link copied to clipboard
interface Node

A unit of work in a workflow graph.

Link copied to clipboard
data class NodeConfig(val retryConfig: RetryConfig? = null, val timeout: Duration? = null)

Bundles a node's retry policy and execution timeout. A null timeout imposes no limit, so an attempt is then bounded only by any ambient deadline. Validation lives here, so every Node implementation inherits it.

Link copied to clipboard
open class NodeExecutionException(val typeName: String, message: String, cause: Throwable? = null) : RuntimeException

A node failure that reports under a typeName other than this class's own, so a failure raised in one ADK implementation is matched by the same name in another.

Link copied to clipboard

Nodes grouped by nodes(...) or a fan-out then, which EdgesBuilder.joinTo connects to a JoinNode.

Link copied to clipboard

A chain of edges for Java callers, positioned at a NodeGroup from a fan-out or EdgesBuilder.from.

Link copied to clipboard
data class NodeInfo(val path: String = "", val outputFor: List<String>? = null, val messageAsOutput: Boolean = false)

Identifies the workflow-node activation that emitted an com.google.adk.kt.events.Event; null outside a workflow.

Link copied to clipboard

Raised when a node's runtime input fails validation. Reports typeName = "NodeInputValidationError".

Link copied to clipboard

A node exceeded its configured timeout. An ordinary exception, so a timed-out node is still eligible for retry.

Link copied to clipboard

An edge started by EdgesBuilder.on, which has a source and its routes but no target yet. EdgesBuilder.then completes it.

Link copied to clipboard

A chain of edges for Java callers, positioned at a routed edge started by EdgeChain.on; then completes it.

Link copied to clipboard
data class RequestInput(val interruptId: String = Uuid.random(), val message: String? = null, val payload: Any? = null, val responseSchema: Schema? = null)

A node's request for user input, which pauses the workflow until a matching response arrives.

Link copied to clipboard
data class RetryConfig(val maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, val initialDelay: Duration = DEFAULT_INITIAL_DELAY, val maxDelay: Duration = DEFAULT_MAX_DELAY, val backoffFactor: Double = DEFAULT_BACKOFF_FACTOR, val jitter: Double = DEFAULT_JITTER, val exceptions: List<String>? = null)

How a node is retried when it raises.

Link copied to clipboard
sealed interface Route

A value on a workflow edge, and the value a node emits to select which of its outgoing edges are followed. An edge fires when the value it carries matches one the node emitted.

Link copied to clipboard

The receiver of an EdgesBuilder.route block, which maps each route the source node may emit to a target node, written on("billing") then billing or "billing" then billing. Mapping one route to several nodes fans out on that route.

Link copied to clipboard

A routing-map entry started by RouteMapBuilder.on whose routes have no target yet. then completes it.

Link copied to clipboard

Routes that select a single edge, which fires once when its source emits any of them. Separate edges to the same target would fire once each. Build one with anyOf(...) in the workflow DSL.

Link copied to clipboard

Marks where a graph starts. Never runs: the scheduler seeds its successors directly.

Link copied to clipboard
class Workflow(name: String, val edges: List<Edge> = emptyList(), description: String = "", val maxConcurrency: Int? = null, rerunOnResume: Boolean = true, waitForOutput: Boolean = false, config: NodeConfig = NodeConfig(), inputSchema: Schema? = null, outputSchema: Schema? = null, stateSchema: Schema? = null) : BaseNode

A graph of nodes, and a Node itself, so graphs nest: a workflow drops into another workflow wherever an ordinary node goes.

Link copied to clipboard

Thrown when a workflow or node configuration is invalid.

Functions

Link copied to clipboard
fun BaseTool.asNode(name: String = this.name, config: NodeConfig = NodeConfig()): Node

Returns a workflow node that runs this tool as a fixed step: the predecessor's output becomes the tool's arguments, and the tool's result becomes the node's output.

Link copied to clipboard

Returns the edges declared by block for a Workflow; workflow builds both in one step.

Link copied to clipboard
inline fun <I, O> node(name: String, description: String = "", rerunOnResume: Boolean = false, waitForOutput: Boolean = false, config: NodeConfig = NodeConfig(), inputSchema: Schema? = null, outputSchema: Schema? = null, stateSchema: Schema? = null, crossinline block: suspend FlowCollector<Event>.(context: Context, input: I) -> O): FunctionNode<I, O>

Creates a FunctionNode that runs block on an input of type I and returns an output of type O, emitting progress Events through its FlowCollector receiver. Schemas inferred from I and O describe the node, while an explicit inputSchema or outputSchema is also enforced on every run.

Link copied to clipboard
inline fun <I, O> parallelNode(node: FunctionNode<I, O>, maxParallelWorkers: Int? = null): FunctionNode<List<I>, List<O>>

Wraps node so it runs concurrently on each item of a list input and returns the results in input order. node's configuration applies to each item's run.

inline fun <I, O> parallelNode(name: String, description: String = "", rerunOnResume: Boolean = false, waitForOutput: Boolean = false, maxParallelWorkers: Int? = null, config: NodeConfig = NodeConfig(), inputSchema: Schema? = null, outputSchema: Schema? = null, stateSchema: Schema? = null, crossinline block: suspend FlowCollector<Event>.(context: Context, input: I) -> O): FunctionNode<List<I>, List<O>>

Creates a FunctionNode that runs block concurrently on each item of a list input and returns the results as a List of O in input order. A non-list input runs as one item.

Link copied to clipboard
fun workflow(name: String, description: String = "", maxConcurrency: Int? = null, rerunOnResume: Boolean = true, waitForOutput: Boolean = false, config: NodeConfig = NodeConfig(), inputSchema: Schema? = null, outputSchema: Schema? = null, stateSchema: Schema? = null, block: EdgesDslBlock<EdgesBuilder>): Workflow

Builds a Workflow from the edges block declares.