invoke

inline operator fun <Input, Output> invoke(promptExecutor: PromptExecutor, agentConfig: AIAgentConfig, strategy: AIAgentGraphStrategy<Input, Output>, toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, clock: Clock = Clock.System, noinline installFeatures: GraphAIAgent.FeatureContext.() -> Unit = {}): AIAgent<Input, Output>(source)

Creates an instance of an AI agent based on the provided configuration, input/output types, and execution strategy.

Return

An instance of an AI agent configured with the specified parameters and capable of executing its logic.

Parameters

Input

The type of the input the AI agent will process.

Output

The type of the output the AI agent will produce.

promptExecutor

The executor responsible for processing prompts and interacting with the language model.

agentConfig

The configuration for the AI agent, including the prompt, model, and other parameters.

toolRegistry

The registry of tools available for use by the agent. Defaults to an empty registry.

strategy

The strategy for executing the AI agent's graph logic, including workflows and decision-making.

id

An optional unique identifier for the agent. Defaults to null if not specified.

clock

The clock to be used for time-related operations. Defaults to the system clock.

installFeatures

A lambda expression to install additional features in the agent's feature context. Defaults to an empty implementation.


operator fun invoke(promptExecutor: PromptExecutor, agentConfig: AIAgentConfig, strategy: AIAgentGraphStrategy<String, String> = singleRunStrategy(), toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, installFeatures: GraphAIAgent.FeatureContext.() -> Unit = {}): AIAgent<String, String>(source)

Operator function to create and invoke an AI agent with the given parameters.

Return

An instance of AIAgent configured with the graph strategy.

Parameters

promptExecutor

The executor responsible for running the prompt and generating outputs.

prompt

The prompt to be processed by the AI agent.

agentConfig

Configuration settings for the AI agent.

strategy

The strategy to be used for the AI agent's execution graph. Defaults to a single-run strategy.

toolRegistry

Registry of tools available for the AI agent to use. Defaults to an empty registry.

installFeatures

Lambda function for installing additional features into the feature context. Defaults to an empty lambda.


operator fun <Input, Output> invoke(promptExecutor: PromptExecutor, agentConfig: AIAgentConfig, strategy: AIAgentFunctionalStrategy<Input, Output>, toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, clock: Clock = Clock.System, installFeatures: FunctionalAIAgent.FeatureContext.() -> Unit = {}): FunctionalAIAgent<Input, Output>(source)

Creates a functional AI agent with the provided configurations and execution strategy.

Return

A FunctionalAIAgent instance configured with the provided parameters and execution strategy.

Parameters

Input

The type of the input the AI agent will process.

Output

The type of the output the AI agent will produce.

promptExecutor

The executor responsible for running prompts against the language model.

agentConfig

The configuration for the AI agent, including prompt setup, language model, and iteration limits.

toolRegistry

The registry containing available tools for the AI agent. Defaults to an empty registry.

func

The suspendable functional context defining the behavior of the AI agent, processing the input of type Input and producing the output of type Output.


operator fun invoke(promptExecutor: PromptExecutor, llmModel: LLModel, strategy: AIAgentGraphStrategy<String, String> = singleRunStrategy(), toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, systemPrompt: String = "", temperature: Double = 1.0, numberOfChoices: Int = 1, maxIterations: Int = 50, installFeatures: GraphAIAgent.FeatureContext.() -> Unit = {}): AIAgent<String, String>(source)

Construction of an AI agent with the specified configurations and parameters.

Return

An instance of AIAgent configured with the provided parameters.

Parameters

promptExecutor

The executor responsible for processing language model prompts.

llmModel

The specific large language model to be used for the agent.

strategy

The strategy that defines the agent's workflow, defaulting to the singleRunStrategy.

toolRegistry

The set of tools available for the agent, defaulting to an empty registry.

id

An optional unique identifier for the agent.

systemPrompt

The system-level prompt used as context for the agent, defaulting to an empty string.

temperature

The randomness or creativity of the model's responses, with valid values ranging typically from 0.0 to 1.0. Defaults to 1.0.

numberOfChoices

The number of response choices to be generated, defaulting to 1.

maxIterations

The maximum number of iterations the agent is allowed to perform, defaulting to 50.

installFeatures

A function to configure additional features into the agent during initialization. Defaults to an empty configuration.


inline operator fun <Input, Output> invoke(promptExecutor: PromptExecutor, llmModel: LLModel, strategy: AIAgentGraphStrategy<Input, Output>, toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, clock: Clock = Clock.System, systemPrompt: String = "", temperature: Double = 1.0, numberOfChoices: Int = 1, maxIterations: Int = 50, noinline installFeatures: GraphAIAgent.FeatureContext.() -> Unit = {}): AIAgent<Input, Output>(source)

Creates and configures an AI agent using the provided parameters.

Return

A configured AIAgent instance that can process inputs and generate outputs using the specified strategy and model.

Parameters

Input

The input type for the AI agent.

Output

The output type for the AI agent.

promptExecutor

An instance of PromptExecutor responsible for executing prompts with the language model.

llmModel

The language model LLModel to be used by the agent.

strategy

The agent strategy AIAgentGraphStrategy defining how the agent processes inputs and outputs.

toolRegistry

An optional ToolRegistry specifying the tools available to the agent for execution. Defaults to [ToolRegistry.EMPTY].

id

An optional unique identifier for the agent. Defaults to null.

clock

A Clock instance used for time-related operations. Defaults to Clock.System.

systemPrompt

A string representing the system-level prompt for the agent. Defaults to an empty string.

temperature

A double value controlling the randomness of the model's output. Defaults to 1.0.

numberOfChoices

The number of choices the model should generate per invocation. Defaults to 1.

maxIterations

The maximum number of iterations the agent can perform. Defaults to 50.

installFeatures

An extension function on FeatureContext to install custom features for the agent. Defaults to an empty lambda.


operator fun <Input, Output> invoke(promptExecutor: PromptExecutor, llmModel: LLModel, toolRegistry: ToolRegistry = ToolRegistry.EMPTY, strategy: AIAgentFunctionalStrategy<Input, Output>, id: String? = null, systemPrompt: String = "", temperature: Double = 1.0, numberOfChoices: Int = 1, maxIterations: Int = 50, installFeatures: FunctionalAIAgent.FeatureContext.() -> Unit = {}): AIAgent<Input, Output>(source)

Creates an FunctionalAIAgent with the specified parameters to execute a strategy with the assistance of a tool registry, configured language model, and associated features.

Return

An AI agent instance configured with the provided parameters and ready to execute the specified strategy.

Parameters

promptExecutor

The executor used to process prompts for the language model.

llmModel

The language model configuration defining the underlying LLM instance and its behavior.

func

The operational strategy for the AI agent, which determines how to handle the provided input.

toolRegistry

Registry containing tools available to the agent for use during execution. Default is an empty registry.

id

An optional identifier for the AI agent.

systemPrompt

The system prompt that sets the initial context or instructions for the AI agent.

temperature

The temperature setting for the language model, which adjusts the diversity of output. Default is 1.0.

numberOfChoices

The number of response choices to generate when querying the language model. Default is 1.

maxIterations

The maximum number of iterations the agent is allowed to perform during execution. Default is 50.

installFeatures

A lambda to configure and install features in the agent's context.