AIAgentStrategy

class AIAgentStrategy(val name: String, val nodeStart: StartAIAgentNodeBase<String>, val nodeFinish: FinishAIAgentNodeBase<String>, toolSelectionStrategy: ToolSelectionStrategy) : AIAgentSubgraph<String, String> (source)

Represents a strategy for managing and executing AI agent workflows built as subgraphs of interconnected nodes.

Constructors

Link copied to clipboard
constructor(name: String, nodeStart: StartAIAgentNodeBase<String>, nodeFinish: FinishAIAgentNodeBase<String>, toolSelectionStrategy: ToolSelectionStrategy)

Properties

Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard
open override val name: String

The unique identifier for the strategy.

Link copied to clipboard

The finishing node of the strategy, marking the subgraph's endpoint.

Link copied to clipboard

The starting node of the strategy, initiating the subgraph execution. By default Start node gets the agent input and returns

Link copied to clipboard

Functions

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

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
open suspend override fun execute(context: AIAgentContextBase, input: String): String

Executes the desired operation based on the input and the provided context. This function determines the execution strategy based on the tool selection strategy configured in the class.

Link copied to clipboard

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.