subgraphWithTask

fun <Input, ProvidedResult : SubgraphResult> AIAgentSubgraphBuilderBase<*, *>.subgraphWithTask(toolSelectionStrategy: ToolSelectionStrategy, finishTool: ProvideSubgraphResult<ProvidedResult>, model: LLModel? = null, params: LLMParams? = null, shouldTLDRHistory: Boolean = true, defineTask: suspend AIAgentContextBase.(input: Input) -> String): AIAgentSubgraphDelegateBase<Input, ProvidedResult>(source)

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.

Use this function if you need the agent to perform a single task which outputs a structured result.


fun <Input, ProvidedResult : SubgraphResult> AIAgentSubgraphBuilderBase<*, *>.subgraphWithTask(tools: List<Tool<*, *>>, finishTool: ProvideSubgraphResult<ProvidedResult>, model: LLModel? = null, params: LLMParams? = null, shouldTLDRHistory: Boolean = true, defineTask: suspend AIAgentContextBase.(input: Input) -> String): AIAgentSubgraphDelegateBase<Input, ProvidedResult>(source)
fun <Input> AIAgentSubgraphBuilderBase<*, *>.subgraphWithTask(tools: List<Tool<*, *>>, model: LLModel? = null, params: LLMParams? = null, shouldTLDRHistory: Boolean = true, defineTask: suspend AIAgentContextBase.(input: Input) -> String): AIAgentSubgraphDelegateBase<Input, StringSubgraphResult>(source)


fun <Input> AIAgentSubgraphBuilderBase<*, *>.subgraphWithTask(toolSelectionStrategy: ToolSelectionStrategy, model: LLModel? = null, params: LLMParams? = null, shouldTLDRHistory: Boolean = true, defineTask: suspend AIAgentContextBase.(input: Input) -> String): AIAgentSubgraphDelegateBase<Input, StringSubgraphResult>(source)

subgraphWithTask with StringSubgraphResult result.