AIAgentNodeDelegate

open class AIAgentNodeDelegate<Input, Output>(val name: String?, val inputType: TypeToken, val outputType: TypeToken, val execute: suspend AIAgentGraphContextBase.(Input) -> Output)(source)

A delegate for creating and managing an instance of AIAgentNodeBase.

This class simplifies the instantiation and management of AI agent nodes. It leverages property delegation to lazily initialize a node instance. The node's name can either be explicitly provided or derived from the delegated property name.

Parameters

name

The optional name of the node. If not provided, the name will be derived from the property to which the delegate is applied.

Type Parameters

Input

The type of input data the delegated node will process.

Output

The type of output data the delegated node will produce.

Constructors

Link copied to clipboard
constructor(name: String?, inputType: TypeToken, outputType: TypeToken, execute: suspend AIAgentGraphContextBase.(Input) -> Output)

Initializes the delegate with the provided node name and builder.

constructor(name: String?, inputType: KType, outputType: KType, execute: suspend AIAgentGraphContextBase.(Input) -> Output)

Secondary constructor for AIAgentNodeDelegate that allows direct specification of input and output types as KType instead of using ai.koog.serialization.KotlinTypeToken.

Properties

Link copied to clipboard
Link copied to clipboard
val inputType: TypeToken
Link copied to clipboard
val name: String?
Link copied to clipboard
val outputType: TypeToken

Functions

Link copied to clipboard
operator fun getValue(thisRef: Any?, property: KProperty<*>): AIAgentNodeBase<Input, Output>

Retrieves an instance of AIAgentNodeBase associated with the given property. This operator function acts as a delegate to dynamically provide a reference to an AI agent node.

Link copied to clipboard
inline fun <T> transform(noinline transformation: suspend (Output) -> T): AIAgentNodeDelegate<Input, T>

Creates a transformed version of this node delegate that applies a transformation to the output.