subtask

suspend fun <Output : Any> subtask(taskDescription: String, outputClass: KClass<Output>, tools: List<Tool<*, *>>? = null, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null): Output(source)

Executes a subtask within the larger context of an AI agent's functional operation. This method allows defining a specific task to be performed with the given input, tools, and optional configuration.

Return

The result of the subtask execution.

Parameters

taskDescription

The subtask to be executed by AIAgent.

input

The input data required for the subtask execution.

outputClass

The output type expected from the subtask.

tools

A list of tools available for use within the subtask.

llmModel

The optional large language model to be used during the subtask, if different from the default one.

llmParams

The configuration parameters for the large language model, such as temperature.

runMode

The mode in which tools should be executed, either sequentially or in parallel.

assistantResponseRepeatMax

The maximum number of times the assistant response can repeat.


suspend fun <OutputTransformed> subtask(taskDescription: String, tools: List<Tool<*, *>>? = null, finishTool: Tool<*, OutputTransformed>, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null): OutputTransformed(source)

Executes a subtask within the AI agent's functional context. This method enables the use of tools to achieve a specific task based on the input provided.

Return

The transformed final result of executing the finishing tool to complete the subtask.

Parameters

taskDescription

The subtask to be executed by AIAgent.

input

The input data required to define and execute the subtask.

tools

An optional list of tools that can be used to achieve the task, excluding the finishing tool.

finishTool

A mandatory tool that determines the final result of the subtask by producing and transforming output.

llmModel

An optional specific LLM to use for executing the subtask.

llmParams

Optional parameters for configuring the behavior of the LLM during subtask execution.

runMode

The mode in which tools should be executed, either sequentially or in parallel.

assistantResponseRepeatMax

The maximum number of feedback attempts allowed from the language model if the subtask is not completed.


inline suspend fun <Output : Any> subtask(taskDescription: String, tools: List<Tool<*, *>>? = null, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null): Output(source)

Executes a subtask within the larger context of an AI agent's functional operation. This method allows defining a specific task to be performed with the given input, tools, and optional configuration.

Return

The result of the subtask execution.

Parameters

taskDescription

The subtask to be executed by AIAgent.

input

The input data required for the subtask execution.

tools

A list of tools available for use within the subtask.

llmModel

The optional large language model to be used during the subtask, if different from the default one.

llmParams

The configuration parameters for the large language model, such as temperature.

runMode

The mode in which tools should be executed, either sequentially or in parallel.

assistantResponseRepeatMax

The maximum number of times the assistant response can repeat.