AIAgentSubgraphBuilder

class AIAgentSubgraphBuilder<Input, Output>(val name: String? = null, inputType: TypeToken, outputType: TypeToken, toolSelectionStrategy: ToolSelectionStrategy, llmModel: LLModel?, llmParams: LLMParams?, responseProcessor: ResponseProcessor? = null) : AIAgentSubgraphBuilderBase<Input, Output> , BaseBuilder<AIAgentSubgraphDelegate<Input, Output>> (source)

Builder class for creating AI agent subgraphs with a defined tool selection strategy.

This class facilitates the construction of customized subgraphs in an AI agent's execution pipeline. It provides methods for defining start and finish nodes and ensuring the connectivity between them. The subgraph can be configured with a tool selection strategy to control the tools available during its execution.

Parameters

llmModel

Initial LLM model used in this subgraph

llmParams

Initial LLM prompt parameters used in this subgraph

responseProcessor

Initial optional processor defining the post-processing of messages returned from the LLM.

Type Parameters

Input

The input type expected by the starting node of the subgraph.

Output

The output type produced by the finishing node of the subgraph.

Constructors

Link copied to clipboard
constructor(name: String? = null, inputType: TypeToken, outputType: TypeToken, toolSelectionStrategy: ToolSelectionStrategy, llmModel: LLModel?, llmParams: LLMParams?, responseProcessor: ResponseProcessor? = null)
constructor(name: String? = null, inputType: KType, outputType: KType, toolSelectionStrategy: ToolSelectionStrategy, llmModel: LLModel?, llmParams: LLMParams?, responseProcessor: ResponseProcessor? = null)

Constructs an instance of AIAgentSubgraphBuilder with the provided parameters, using KTypes for input and output type representation.

Properties

Link copied to clipboard
val name: String?

Optional name of the subgraph for identification.

Link copied to clipboard
open override val nodeFinish: FinishNode<Output>

Represents the "finish" node in the AI agent's subgraph structure. This node indicates the endpoint of the subgraph and acts as a terminal stage where the workflow stops.

Link copied to clipboard
open override val nodeStart: StartNode<Input>

Represents the starting node of the subgraph in the AI agent's strategy graph.

Functions

Link copied to clipboard
open override fun build(): AIAgentSubgraphDelegate<Input, Output>

Builds and returns the instance of type T that has been configured using the builder.

Link copied to clipboard
Link copied to clipboard
inline fun <Input, Output, OutputTransformed> AIAgentSubgraphBuilderBase<Input, OutputTransformed>.setupSubgraphWithTask(finishTool: Tool<Output, OutputTransformed>, assistantResponseRepeatMax: Int? = null, noinline defineTask: suspend AIAgentGraphContextBase.(Input) -> String)

Configures a subgraph within the AI agent framework, associating it with required tasks and operations.

inline fun <Input, Output, OutputTransformed> AIAgentSubgraphBuilderBase<Input, OutputTransformed>.setupSubgraphWithTask(finishTool: Tool<Output, OutputTransformed>, runMode: ToolCalls, assistantResponseRepeatMax: Int? = null, noinline defineTask: suspend AIAgentGraphContextBase.(Input) -> String)
fun <Input, Output, OutputTransformed> AIAgentSubgraphBuilderBase<Input, OutputTransformed>.setupSubgraphWithTask(finishTool: Tool<Output, OutputTransformed>, inputType: TypeToken, outputTransformedType: TypeToken, runMode: ToolCalls, assistantResponseRepeatMax: Int? = null, defineTask: suspend AIAgentGraphContextBase.(Input) -> String)

Configures and sets up a subgraph with task handling, including tool execution operations, assistant response management, and task finalization logic.

Link copied to clipboard