subgraphWithTask
Creates a subgraph, which performs one specific task, defined by defineTask, using the tools defined by toolSelectionStrategy. When LLM believes that the task is finished, it will call finishTool, generating ProvidedResult as its argument. The generated ProvidedResult is the result of this subgraph. The subgraph returns a wrapper SafeTool.Result to handle cases when the model didn't reach the finish condition or didn't generate a final ProvidedResult due to an error (reported as SafeTool.Result.Failure)
Use this function if you need the agent to perform a single task which outputs a structured result.
Creates a subgraph with a task definition and specified tools. The subgraph uses the provided tools to process input and execute the defined task, eventually producing a result through the provided finish tool.
Return
A delegate representing the subgraph that processes the input and produces a result through the finish tool.
Parameters
The list of tools that are available for use within the subgraph.
The tool responsible for producing the final result of the subgraph.
An optional language model to be used in the subgraph. If not specified, a default model may be used.
Optional parameters to customize the behavior of the language model in the subgraph.
A suspend function that defines the task to be executed by the subgraph based on the given input.
Defines a subgraph with a specific task to be performed by an AI agent.
Return
A delegate object representing the constructed subgraph for the specified task.
Parameters
The input type provided to the subgraph.
The output type returned by the subgraph.
The transformed output type after finishing the task.
The strategy to be used for selecting tools within the subgraph.
The tool responsible for finalizing the task and producing the transformed output.
The optional language model to be used in the subgraph for processing requests.
The optional parameters to customize the behavior of the language model.
A lambda function to define the task logic, which accepts the input and returns a task description.
Creates a subgraph with a specified task definition, a list of tools, and a finish tool to transform output.
Return
A subgraph delegate that handles the input and produces the transformed output for the defined task.
Parameters
The type of the input for the subgraph task.
The type of the raw output produced by the finish tool.
The transformed type of the output after applying the finish tool.
A list of tools to be used within the subgraph.
The tool responsible for transforming the output of the subgraph.
The language model to be used within the subgraph. Defaults to null if not provided.
Optional parameters to customize the behavior of the language model. Defaults to null if not provided.
A suspend function that defines the task to be executed in the subgraph, based on the provided input.
Creates a subgraph within an AI agent graph using a defined task, a tool selection strategy, and a finish tool function. This method provides the capability to integrate task-specific logic and tool selection into the AI agent's subgraph.
Return
An AIAgentSubgraphDelegate representing the constructed subgraph with the specified configuration.
Parameters
The input type to the task defined in the subgraph.
The output type produced by the task and the finish tool.
The strategy to be used for selecting tools within the subgraph.
The function to finalize the task execution, providing the result as Output.
The language model to be used within the subgraph, if specified.
Parameters to configure the language model's behavior, if specified.
A suspend function defining the task logic for the subgraph.
Defines a subgraph with a specific task in an AI agent graph, enabling the coordination of tools, task definitions, and execution logic.
Return
An instance of AIAgentSubgraphDelegate that represents the defined subgraph with input and output types.
Parameters
The input type expected for the subgraph task.
The output type expected from the subgraph task.
A list of tools available for the subgraph task to utilize.
The function that represents the tool used to finish the task, producing the output.
An optional LLModel to use within the subgraph for task execution. Defaults to null.
Optional parameters for configuring the behavior of the LLModel. Defaults to null.
A suspend lambda function that defines the task, taking an input of type Input and returning a task description as a String.