AIAgentNode

Platform-specific expect/actual declaration of SimpleAIAgentNodeImpl.

Type Parameters

TInput

The type of input data this node processes.

TOutput

The type of output data this node produces.

See also

Inheritors

Represents a simple implementation of an AI agent node, encapsulating a specific execution logic that processes the input data and produces an output.

Type Parameters

TInput

The type of input data this node processes.

TOutput

The type of output data this node produces.

Represents a simple implementation of an AI agent node, encapsulating a specific execution logic that processes the input data and produces an output.

Type Parameters

TInput

The type of input data this node processes.

TOutput

The type of output data this node produces.

Types

Link copied to clipboard
object Companion

Companion object for the AIAgentNode class.

Properties

Link copied to clipboard
expect var edges: List<AIAgentEdge<TOutput, *>>

The directed edges connecting this node to other nodes in the AI agent strategy graph. Each edge defines the flow and optional transformation of output data from this node to another.

The directed edges connecting this node to other nodes in the AI agent strategy graph. Each edge defines the flow and optional transformation of output data from this node to another.

The directed edges connecting this node to other nodes in the AI agent strategy graph. Each edge defines the flow and optional transformation of output data from this node to another.

Link copied to clipboard
expect val execute: suspend AIAgentGraphContextBase.(input: TInput) -> TOutput

A suspendable lambda function that defines the execution logic of the node. It operates in the context of an AIAgentGraphContextBase, taking an input of type TInput and producing an output of type TOutput.

A suspendable lambda function that defines the execution logic of the node. It operates in the context of an AIAgentGraphContextBase, taking an input of type TInput and producing an output of type TOutput.

A suspendable lambda function that defines the execution logic of the node. It operates in the context of an AIAgentGraphContextBase, taking an input of type TInput and producing an output of type TOutput.

Link copied to clipboard
val id: String

Represents the unique identifier of the AI agent node.

val id: String

Represents the unique identifier of the AI agent node.

val id: String

Represents the unique identifier of the AI agent node.

Link copied to clipboard
open override val inputType: TypeToken

The TypeToken representing the expected type of input for the node.

open override val inputType: ai/koog/serialization/TypeToken

The TypeToken representing the expected type of input for the node.

open override val inputType: TypeToken

The TypeToken representing the expected type of input for the node.

Link copied to clipboard
open override val name: String

The name of the node, used for identification within the graph.

open override val name: String

The name of the node, used for identification within the graph.

open override val name: String

The name of the node, used for identification within the graph.

Link copied to clipboard
open override val outputType: TypeToken

The TypeToken representing the type of output produced by the node.

open override val outputType: ai/koog/serialization/TypeToken

The TypeToken representing the type of output produced by the node.

open override val outputType: TypeToken

The TypeToken representing the type of output produced by the node.

Functions

Link copied to clipboard
expect open fun addEdge(edge: AIAgentEdge<TOutput, *>)

Adds a directed edge from the current node, enabling connections between this node and other nodes in the AI agent strategy graph.

open fun addEdge(edge: AIAgentEdge<TOutput, *>)

Adds a directed edge from the current node, enabling connections between this node and other nodes in the AI agent strategy graph.

open fun addEdge(edge: AIAgentEdge<TOutput, *>)

Adds a directed edge from the current node, enabling connections between this node and other nodes in the AI agent strategy graph.

Link copied to clipboard
expect open suspend override fun execute(context: AIAgentGraphContextBase, input: TInput): TOutput

Executes a specific operation based on the given context and input.

open suspend override fun execute(context: AIAgentGraphContextBase, input: TInput): TOutput

Executes a specific operation based on the given context and input.

open suspend override fun execute(context: AIAgentGraphContextBase, input: TInput): TOutput

Executes a specific operation based on the given context and input.

Link copied to clipboard
suspend fun executeUnsafe(context: AIAgentGraphContextBase, input: Any?): Any?

Executes the node operation using the provided execution context and input, bypassing static type checks. This method internally performs an unchecked cast of input to TInput and delegates to execute. The caller is responsible for ensuring that input is actually assignable to TInput; otherwise a ClassCastException may be thrown at the call site or later during execution.

suspend fun executeUnsafe(context: AIAgentGraphContextBase, input: Any?): Any?

Executes the node operation using the provided execution context and input, bypassing static type checks. This method internally performs an unchecked cast of input to TInput and delegates to execute. The caller is responsible for ensuring that input is actually assignable to TInput; otherwise a ClassCastException may be thrown at the call site or later during execution.

suspend fun executeUnsafe(context: AIAgentGraphContextBase, input: Any?): Any?

Executes the node operation using the provided execution context and input, bypassing static type checks. This method internally performs an unchecked cast of input to TInput and delegates to execute. The caller is responsible for ensuring that input is actually assignable to TInput; otherwise a ClassCastException may be thrown at the call site or later during execution.

Link copied to clipboard

Creates a directed edge from this AIAgentNodeBase to another AIAgentNodeBase, allowing data to flow from the output of the current node to the input of the specified node.

Creates a directed edge from this AIAgentNodeBase to another AIAgentNodeBase, allowing data to flow from the output of the current node to the input of the specified node.

Creates a directed edge from this AIAgentNodeBase to another AIAgentNodeBase, allowing data to flow from the output of the current node to the input of the specified node.

Link copied to clipboard
expect suspend fun resolveEdge(context: AIAgentGraphContextBase, nodeOutput: TOutput): AIAgentNodeBase.ResolvedEdge?

Resolves the edge associated with the provided node output and execution context. Iterates through available edges and identifies the first edge that can successfully process the given node output within the provided context. If a resolvable edge is found, it returns a ResolvedEdge containing the edge and its output. Otherwise, returns null.

Resolves the edge associated with the provided node output and execution context. Iterates through available edges and identifies the first edge that can successfully process the given node output within the provided context. If a resolvable edge is found, it returns a ResolvedEdge containing the edge and its output. Otherwise, returns null.

Resolves the edge associated with the provided node output and execution context. Iterates through available edges and identifies the first edge that can successfully process the given node output within the provided context. If a resolvable edge is found, it returns a ResolvedEdge containing the edge and its output. Otherwise, returns null.