FullAgentEdgeBuilder

A builder class for constructing a specialized edge in an AI agent strategy graph. This edge enables data flow between two nodes while supporting a composition of the output transformation logic.

Parameters

fromNode

The source node in the strategy graph. This node produces the input data.

toNode

The destination node in the strategy graph. This node consumes the transformed data.

forwardOutputComposition

A suspendable function that transforms the output of the fromNode into an intermediate format before passing it to the toNode. The transformation output is represented as an Option type, allowing for optional chaining and flexibility in data flow.

Type Parameters

IncomingOutput

The type of input data from the fromNode.

IntermediateOutput

The type of processed data output by the forwardOutputComposition function.

OutgoingInput

The type of input data expected by the toNode.

Inheritors

Functions

Link copied to clipboard
fun asToolResultMessage(condition: SimpleCondition<ReceivedToolResult> = { true }): FullAgentEdgeBuilder<IncomingOutput, ERROR CLASS: Symbol not found for Message.User, OutgoingInput>

Creates an edge that transforms an intermediate output into a Message.User using the provided transform.

Link copied to clipboard
fun asUserMessage(transformation: SimpleTransformation<IntermediateOutput, String> = { it.toString() }): FullAgentEdgeBuilder<IncomingOutput, ERROR CLASS: Symbol not found for Message.User, OutgoingInput>

Creates an edge that transforms an intermediate output into a Message.User using the provided transform.

Link copied to clipboard

Builds the edge between the source and destination nodes.

Link copied to clipboard

Applies a contextual condition to filter the output being processed and forwarded within the graph.

Attaches a condition that filters intermediate outputs before they are propagated to the target node within the agent's processing graph.

Link copied to clipboard

Filters the outputs of the current processing edge based on their type, forwarding only those that are instances of the specified class.

Filters intermediate outputs to only process those that are instances of the specified class type.

Link copied to clipboard
fun <T : ERROR CLASS: Symbol not found for MessagePart> onMessageParts(clazz: Class<T>): FullAgentEdgeBuilder<IncomingOutput, List<T>, OutgoingInput>

Filters the intermediate output to only Message instances that contain parts of type T, and transforms the output to a list of those parts.

Link copied to clipboard

Creates an edge that extracts text content from message parts.

Link copied to clipboard
fun onToolCalls(condition: SimpleCondition<ERROR CLASS: Symbol not found for MessagePart.Tool.Call> = { true }): FullAgentEdgeBuilder<IncomingOutput, ToolCalls, OutgoingInput>

Creates an edge that filters assistant messages containing tool calls matching the provided condition. The default condition onToolCalls { true } accepts any message with at least one tool call.

Link copied to clipboard

Transforms the intermediate output of the edge by applying the given action. This is an alias for transformed providing naming consistency with the node builder API.